Skip to content

item level derived_from link #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NorahBrown opened this issue Sep 11, 2023 · 0 comments
Open

item level derived_from link #49

NorahBrown opened this issue Sep 11, 2023 · 0 comments

Comments

@NorahBrown
Copy link

NorahBrown commented Sep 11, 2023

The current ItemSerializer.stac_to_db does not write any non inferred links to the links field in the items table.

We propose :
An adjustment to filter for derived_from in the input and then explicitly set the links value

# Proposed mod to stac_fastapi/sqlalchemy/serializers.ItemSerializer.py

from stac_fastapi.types.links import filter_links
# ...
class ItemSerializer(Serialiazer):
# ...
    @classmethod
    def stac_to_db(...):
        # ...
        # Before instantiation of the database.Item, pull out derived_from link
        derived_from = None
        # Remove inferred link
        temp_links = filter_links(stac_data['links'])
        # Assign derived_from link
        for temp_link in temp_links:
            if temp_link['rel'] == 'derived_from':
                derived_from = [temp_link]
                break
        # ...
        return database.Item(
            # ...
            links=derived_from,
            # ...
            )

We would be happy to provide a PR.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant