Skip to content

Commit

Permalink
RSPY-492 - Allow to search by Retransfer
Browse files Browse the repository at this point in the history
  • Loading branch information
vprivat-ads committed Oct 29, 2024
1 parent cbf930a commit 9c7859b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions services/adgs/rs_server_adgs/api/adgs_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ async def process_search(self, collection: dict, odata_params: dict) -> stac_pyd
self.request,
odata_params.get("productType"),
odata_params.get("PublicationDate"),
odata_params.get("Retransfer"),
odata_params.get("top", None),
attr_platform_short_name=odata_params.get("platformShortName"),
attr_serial_identif=odata_params.get("platformSerialIdentifier"),
Expand Down
6 changes: 6 additions & 0 deletions services/cadip/config/cadip_ws_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ cadip_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down Expand Up @@ -874,6 +875,7 @@ ins_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down Expand Up @@ -1020,6 +1022,7 @@ mps_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down Expand Up @@ -1166,6 +1169,7 @@ mti_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down Expand Up @@ -1312,6 +1316,7 @@ nsg_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down Expand Up @@ -1458,6 +1463,7 @@ sgs_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down
6 changes: 6 additions & 0 deletions services/cadip/config/cadip_ws_config_token_module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ cadip_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down Expand Up @@ -798,6 +799,7 @@ ins_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down Expand Up @@ -933,6 +935,7 @@ mps_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down Expand Up @@ -1068,6 +1071,7 @@ mti_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down Expand Up @@ -1203,6 +1207,7 @@ nsg_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down Expand Up @@ -1338,6 +1343,7 @@ sgs_session:
- "Satellite in ({platforms})"
- "PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}"
- "PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}"
- "Retransfer eq {Retransfer}"

pagination:
max_items_per_page: 1000
Expand Down
3 changes: 3 additions & 0 deletions services/cadip/rs_server_cadip/api/cadip_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ async def process_search(self, collection: dict, odata_params: dict) -> stac_pyd
odata_params.get("SessionId", []),
odata_params.get("Satellite", []),
odata_params.get("PublicationDate"),
odata_params.get("Retransfer"),
odata_params.get("top"),
)

Expand Down Expand Up @@ -340,6 +341,7 @@ def process_session_search( # type: ignore # pylint: disable=too-many-argument
Union[str, None],
WrapValidator(lambda interval, info, handler: validate_inputs_format(interval, raise_errors=True)),
],
retransfer: Union[bool, None],
limit: Annotated[
Union[int, None],
Query(gt=0, le=10000, default=1000, description="Pagination Limit"),
Expand Down Expand Up @@ -374,6 +376,7 @@ def process_session_search( # type: ignore # pylint: disable=too-many-argument
TimeRange(*time_interval),
id=session_id, # pylint: disable=redefined-builtin
platform=platform,
retransfer=retransfer,
sessions_search=True,
items_per_page=limit,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ def _specific_search(self, between: TimeRange, **kwargs) -> Union[SearchResult,
elif isinstance(platform, str):
mapped_search_args["platform"] = "'" + platform + "'"

# TODO: check if it is the right way of doing this, looks very cumbersome to do it for every field
retransfer = kwargs.pop("retransfer", None)
if retransfer is not None:
mapped_search_args["Retransfer"] = str(retransfer).lower()

if between:
# Since now both for files and sessions, time interval is optional, map it if provided.
mapped_search_args.update(
Expand Down

0 comments on commit 9c7859b

Please sign in to comment.