Skip to content

item level derived_from link #49

@NorahBrown

Description

@NorahBrown

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions