stac-utils / stac-utils/stac-fastapi

User transforms on item documents

Open
#405 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

api layer enhancement
Dominant language
Python
Stars
324
Forks
126
Avg merge
1d 22h
Merged PRs (30d)
10

Description

I would like to inject custom code to transform item documents in some way as they travel from database to the user. I feel like this would be a useful feature to have regardless of the db backend.

My specific use-case is to adjust asset hrefs from relative paths to absolute based on the original self link recorded in the database. I would like to keep storing relative links for assets in the database, but since item self link changes when accessed over api those hrefs become invalid. Recording those in absolute form would solve this specific problem, but makes data relocation more involved.

Alternatively an option to "make asset href absolute using original self link" can be useful and avoids the need to write custom code.

in pgstac this can inside this function for example:

https://github.com/stac-utils/stac-fastapi/blob/162a1a2c324b4c2bfe3451f7ae19d7840a0e0452/stac_fastapi/pgstac/stac_fastapi/pgstac/core.py#L187-L191

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with stac_fastapi/pgstac/stac_fastapi/pgstac/core.py at lines 187-191, linked in the issue, and compare how item documents travel from the database to the API response. Clarify whether the project should support a general transform hook or only absolute asset hrefs; done requires an agreed behavior, implementation scope, and coverage for the selected approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.