stac-utils / stac-utils/stac-fastapi
User transforms on item documents
Nobody has claimed this yet.
- 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:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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