Skip to content

Commit

Permalink
RSPY-495 - Fix SessionId spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
vprivat-ads committed Nov 12, 2024
1 parent bcf9d8a commit 7ed38b1
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 78 deletions.
2 changes: 1 addition & 1 deletion services/cadip/config/cadip_stac_mapper.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"cadip:final_block": "FinalBlock",
"cadip:block_number": "BlockNumber",
"cadip:channel": "Channel",
"cadip:session_id": "SessionID",
"cadip:session_id": "SessionId",
"created": "PublicationDate",
"eviction_datetime": "EvictionDate",
"file:size": "Size",
Expand Down
60 changes: 30 additions & 30 deletions services/cadip/config/cadip_ws_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ cadip:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -93,8 +93,8 @@ cadip:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down Expand Up @@ -147,10 +147,10 @@ ins:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -192,8 +192,8 @@ ins:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down Expand Up @@ -246,10 +246,10 @@ mps:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -291,8 +291,8 @@ mps:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down Expand Up @@ -345,10 +345,10 @@ mti:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -390,8 +390,8 @@ mti:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down Expand Up @@ -444,10 +444,10 @@ nsg:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -489,8 +489,8 @@ nsg:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down Expand Up @@ -543,10 +543,10 @@ sgs:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -588,8 +588,8 @@ sgs:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down
60 changes: 30 additions & 30 deletions services/cadip/config/cadip_ws_config_token_module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ cadip:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -83,8 +83,8 @@ cadip:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down Expand Up @@ -126,10 +126,10 @@ ins:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -171,8 +171,8 @@ ins:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down Expand Up @@ -214,10 +214,10 @@ mps:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -259,8 +259,8 @@ mps:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down Expand Up @@ -302,10 +302,10 @@ mti:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -347,8 +347,8 @@ mti:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down Expand Up @@ -390,10 +390,10 @@ nsg:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -435,8 +435,8 @@ nsg:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down Expand Up @@ -478,10 +478,10 @@ sgs:
- '$.Name'
SessionIds:
- null
- "$.SessionID"
SessionID:
- "$.SessionId"
SessionId:
- null
- "$.SessionID"
- "$.SessionId"
Channel:
- null
- '$.Channel'
Expand Down Expand Up @@ -523,8 +523,8 @@ sgs:
wrapper: '{}'
operations:
and:
- 'SessionID in ({SessionIds})'
- 'SessionID eq {SessionID}'
- 'SessionId in ({SessionIds})'
- 'SessionId eq {SessionId}'
- 'PublicationDate gt {startTimeFromAscendingNode#to_iso_utc_datetime}'
- 'PublicationDate lt {completionTimeFromAscendingNode#to_iso_utc_datetime}'

Expand Down
6 changes: 3 additions & 3 deletions services/cadip/rs_server_cadip/cadip_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ def from_session_expand_to_assets_serializer(
for session in feature_collection.features:
# Iterate over products and map them to assets
for product in input_session:
if product.properties["SessionID"] == session.id:
if product.properties["SessionId"] == session.id:
# Create Asset
asset: Asset = map_dag_file_to_asset(mapper, product, product.properties["href"])
# Add Asset to Item.
session.assets.update({asset.title or "": asset})
# Remove processed products from input_session
input_session = [product for product in input_session if product.properties["SessionID"] != session.id]
input_session = [product for product in input_session if product.properties["SessionId"] != session.id]

return feature_collection

Expand Down Expand Up @@ -188,7 +188,7 @@ def link_assets_to_session(session_data, assets_dict, mapper):
"""Function used to allocate assets to propper session item based on session id property."""
# Validity check to be later added.
for feature in session_data.features:
matching_assets = [asset_item for asset_item in assets_dict if feature.id == asset_item["SessionID"]]
matching_assets = [asset_item for asset_item in assets_dict if feature.id == asset_item["SessionId"]]
for asset_item in matching_assets:
asset_dict = {
map_key: asset_item[map_value] for map_key, map_value in mapper.items() if map_value in asset_item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,16 @@ def _specific_search(self, between: TimeRange, **kwargs) -> Union[SearchResult,

session_id = kwargs.pop("id", None)
if session_id:
# If request contains session id, map it to eodag parameter accordingly (SessionID for single, Ids for list)
# If request contains session id, map it to eodag parameter accordingly (SessionId for single, Ids for list)
if isinstance(session_id, list):
mapped_search_args["SessionIds"] = ", ".join(f"'{s}'" for s in session_id)
elif isinstance(session_id, str):
mapped_search_args["SessionID"] = "'" + session_id + "'"
mapped_search_args["SessionId"] = "'" + session_id + "'"

if sessions_search:
# If request is for session search, handle platform - if any provided.
platform = kwargs.pop("platform", None)

# Very annoying, for files odata is **SessionID**, for sessions is **SessionId**
if "SessionID" in mapped_search_args:
mapped_search_args["SessionId"] = mapped_search_args.pop("SessionID")
if platform:
if isinstance(platform, list):
mapped_search_args["platforms"] = ", ".join(f"'{p}'" for p in platform)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def build(id_: str, name: str, at_date: str, session_id: str):
"Name": name,
"PublicationDate": at_date,
"Size": "size_test_value",
"SessionID": session_id,
"SessionId": session_id,
"Retransfer": False,
"FinalBlock": True,
"EvictionDate": "eviction_date_test_value",
Expand Down
4 changes: 2 additions & 2 deletions tests/resources/endpoints/cadip_file_pickup_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"Id": "e4d17d2f-29eb-4c18-bc1f-bf2769a3a16d",
"Name": "DCS_01_S1A_20200105072204051312_ch1_DSDB_00000.raw",
"SessionID": "S1A_20200105072204051312",
"SessionId": "S1A_20200105072204051312",
"Channel": 1,
"BlockNumber": 1,
"FinalBlock": false,
Expand All @@ -15,7 +15,7 @@
{
"Id": "cd24aa8b-2719-4a1e-b4a7-f7c9df6de300",
"Name": "DCS_01_S1A_20200105072204051312_ch1_DSDB_00001.raw",
"SessionID": "S1A_20200105072204051312",
"SessionId": "S1A_20200105072204051312",
"Channel": 1,
"BlockNumber": 1,
"FinalBlock": false,
Expand Down
Loading

0 comments on commit 7ed38b1

Please sign in to comment.