Skip to content

Commit e3b1a6e

Browse files
author
Alin BUTU
committed
review corrections
1 parent 3cd4b11 commit e3b1a6e

File tree

3 files changed

+44
-21
lines changed

3 files changed

+44
-21
lines changed

services/common/rs_server_common/utils/utils.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,25 @@ def map_auxip_prip_mission(platform: str, constellation: str) -> tuple[str | Non
196196
return platform_short_name, platform_serial_identifier
197197

198198

199+
def reverse_adgs_prip_map_mission(
200+
platform: str | None,
201+
constellation: str | None,
202+
) -> tuple[str | None, str | None]:
203+
"""Function used to re-map platform and constellation based on satellite value."""
204+
if not (constellation or platform):
205+
return None, None
206+
207+
if constellation:
208+
constellation = constellation.lower() # type: ignore
209+
210+
for satellite in map_stac_platform()["satellites"]:
211+
for key, info in satellite.items():
212+
# Check for matching serialid and constellation
213+
if info.get("serialid") == platform and info.get("constellation").lower() == constellation:
214+
return key, info.get("constellation")
215+
return None, None
216+
217+
199218
def odata_to_stac(
200219
feature_template: dict,
201220
odata_dict: dict,

services/prip/rs_server_prip/api/prip_search.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,30 @@ async def get_prip_collection_items(
205205
Args:
206206
collection_id (str): PRIP collection ID. Must be a valid collection identifier
207207
(e.g., 'ins_s1').
208+
bbox (BBoxType, optional): Bounding box filter as four or six numbers
209+
[west, south, east, north] or [west, south, minz, east, north, maxz].
210+
Defaults to None. If provided, items intersecting the bbox are returned.
208211
212+
datetime (DateTimeType, optional): Temporal filter. Either a single RFC 3339
213+
timestamp/interval (e.g., "2024-01-01T00:00:00Z") or a closed/open interval
214+
(e.g., "2024-01-01T00:00:00Z/2024-01-31T23:59:59Z", "../2024-01-01T00:00:00Z").
215+
Defaults to None.
216+
217+
filter_ (FilterType, optional): CQL2 filter expression (text or JSON depending
218+
on `filter_lang`). Defaults to None.
219+
220+
filter_lang (FilterLangType, optional): CQL2 language for `filter_`. One of
221+
"cql2-text" or "cql2-json". Defaults to "cql2-text".
222+
223+
sortby (SortByType, optional): Sort specification. Single field or list of fields
224+
with optional direction, e.g., {"field": "published", "direction": "desc"}.
225+
Defaults to None (implementation default ordering).
226+
227+
limit (LimitType, optional): Page size (maximum number of items to return).
228+
Defaults to None (service default / configured max).
229+
230+
page (PageType, optional): 1-based page index.
231+
Defaults to None (first page).
209232
Returns:
210233
list[dict]: A FeatureCollection of items belonging to the specified collection, or an
211234
error message if the collection is not found.

services/prip/rs_server_prip/prip_utils.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import stac_pydantic
3131
import yaml
3232
from fastapi import HTTPException, status
33-
from rs_server_common.utils.utils import map_stac_platform
33+
from rs_server_common.utils.utils import reverse_adgs_prip_map_mission
3434

3535
PRIP_CONFIG = Path(osp.realpath(osp.dirname(__file__))).parent / "config"
3636
search_yaml = PRIP_CONFIG / "prip_search_config.yaml"
@@ -120,29 +120,10 @@ def serialize_prip_asset(feature_collection: stac_pydantic.ItemCollection, produ
120120
return feature_collection
121121

122122

123-
def prip_reverse_map_mission(
124-
platform: str | None,
125-
constellation: str | None,
126-
) -> tuple[str | None, str | None]:
127-
"""Function used to re-map platform and constellation based on satellite value."""
128-
if not (constellation or platform):
129-
return None, None
130-
131-
if constellation:
132-
constellation = constellation.lower() # type: ignore
133-
134-
for satellite in map_stac_platform()["satellites"]:
135-
for key, info in satellite.items():
136-
# Check for matching serialid and constellation
137-
if info.get("serialid") == platform and info.get("constellation").lower() == constellation:
138-
return key, info.get("constellation")
139-
return None, None
140-
141-
142123
def prepare_collection(collection: stac_pydantic.ItemCollection) -> stac_pydantic.ItemCollection:
143124
"""Used to create a more complex mapping on platform/constallation from odata to stac."""
144125
for feature in collection.features:
145-
feature.properties.platform, feature.properties.constellation = prip_reverse_map_mission(
126+
feature.properties.platform, feature.properties.constellation = reverse_adgs_prip_map_mission(
146127
feature.properties.platform,
147128
feature.properties.constellation,
148129
)

0 commit comments

Comments
 (0)