Skip to content

Commit

Permalink
refactor: ignored properties
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunato committed May 31, 2024
1 parent af0f929 commit 2a33765
Showing 1 changed file with 31 additions and 32 deletions.
63 changes: 31 additions & 32 deletions eodag/rest/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,36 @@

STAC_CATALOGS_PREFIX = "catalogs"

# fields not to put in item properties
COLLECTION_PROPERTIES = [
"abstract",
"instrument",
"platform",
"platformSerialIdentifier",
"processingLevel",
"sensorType",
"md5",
"license",
"title",
"missionStartDate",
"missionEndDate",
"keywords",
"stacCollection",
]
IGNORED_ITEM_PROPERTIES = [
"_id",
"id",
"keyword",
"quicklook",
"thumbnail",
"downloadLink",
"orderLink",
"_dc_qs",
"qs",
"defaultGeometry",
"_date",
]


class StacCommon:
"""Stac common object
Expand Down Expand Up @@ -250,43 +280,12 @@ def __get_item_list(
k, item_model["properties"][k]
)

collection_props = [
"abstract",
"instrument",
"platform",
"platformSerialIdentifier",
"processingLevel",
"sensorType",
"md5",
"license",
"title",
"missionStartDate",
"missionEndDate",
"keywords",
"stacCollection",
]
item_props = [
p.right.fields[0]
for p in item_model["properties"].values()
if isinstance(p, Child)
]
ignored_props = (
collection_props
+ item_props
+ [
"_id",
"id",
"keyword",
"quicklook",
"thumbnail",
"downloadLink",
"orderLink",
"_dc_qs",
"qs",
"defaultGeometry",
"_date",
]
)
ignored_props = COLLECTION_PROPERTIES + item_props + IGNORED_ITEM_PROPERTIES

item_list: List[Dict[str, Any]] = []
for product in search_results:
Expand Down

0 comments on commit 2a33765

Please sign in to comment.