|
15 | 15 | get_last_rc_ri_by_case_id, |
16 | 16 | get_rs_messages_by_case_id, |
17 | 17 | ) |
18 | | -from converter.utils import get_field_value, set_value, delete_paths |
| 18 | +from converter.utils import get_field_value, set_value, delete_paths, switch_field_name |
19 | 19 | import logging |
20 | 20 |
|
21 | 21 | logger = logging.getLogger(__name__) |
@@ -70,6 +70,13 @@ def _build_rs_ri_from_cisu(cls, edxl_json: Dict[str, Any]) -> Dict[str, Any]: |
70 | 70 | # RS-RI does not carry GPS position — remove it if present |
71 | 71 | delete_paths(resource, [ResourcesInfoCISUConstants.POSITION_KEY]) |
72 | 72 |
|
| 73 | + # Map operationId to missionId |
| 74 | + switch_field_name( |
| 75 | + resource, |
| 76 | + ResourcesInfoCISUConstants.OPERATION_ID_PATH, |
| 77 | + ResourcesInfoCISUConstants.MISSION_ID_PATH, |
| 78 | + ) |
| 79 | + |
73 | 80 | return cls.format_rs_output_json(output_json, output_use_case_json) |
74 | 81 |
|
75 | 82 | @classmethod |
@@ -317,13 +324,22 @@ def _convert_resources_to_cisu( |
317 | 324 | cls._translate_to_cisu_vehicle_type(resource) |
318 | 325 | cls._keep_last_state(resource) |
319 | 326 | cls._remove_patient_id(resource) |
| 327 | + cls._replace_operation_id_by_mission_id(resource) |
320 | 328 |
|
321 | 329 | converted_resources.append(resource) |
322 | 330 | except ConversionError: |
323 | 331 | continue |
324 | 332 |
|
325 | 333 | return converted_resources |
326 | 334 |
|
| 335 | + @classmethod |
| 336 | + def _replace_operation_id_by_mission_id(cls, resource): |
| 337 | + switch_field_name( |
| 338 | + resource, |
| 339 | + ResourcesInfoCISUConstants.MISSION_ID_PATH, |
| 340 | + ResourcesInfoCISUConstants.OPERATION_ID_PATH, |
| 341 | + ) |
| 342 | + |
327 | 343 | @classmethod |
328 | 344 | def _remove_patient_id(cls, resource): |
329 | 345 | delete_paths(resource, [ResourcesInfoCISUConstants.PATIENT_ID_KEY]) |
|
0 commit comments