From 619a93faf6e366865b414c2397cd70c6fc9d2cdc Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Tue, 19 Aug 2025 11:32:37 +0200 Subject: [PATCH 01/11] feat(converter): add new cisu nomenclature MRMS csv file --- .../cisu/mrms_cisu_updated_nomenclature.csv | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 converter/converter/cisu/mrms_cisu_updated_nomenclature.csv diff --git a/converter/converter/cisu/mrms_cisu_updated_nomenclature.csv b/converter/converter/cisu/mrms_cisu_updated_nomenclature.csv new file mode 100644 index 0000000000..17616387ff --- /dev/null +++ b/converter/converter/cisu/mrms_cisu_updated_nomenclature.csv @@ -0,0 +1,202 @@ +CodeCisuMR0;CodeCisuMR1;CodeCisu V1.3 +M20.00;[Null];M01.00 +M22.00;M22.11;M01.01 +M22.00;[Null];M01.02 +M22.00;M22.21;M01.02 +M50.00;M50.35;M01.02 +M60.00;M60.03;M01.02 +M22.00;M22.01;M01.03 +M31.00;M31.01;M01.03 +M31.00;M31.02;M01.03 +M31.00;M31.03;M01.03 +M31.00;M31.13;M01.03 +M50.00;M50.33;M01.03 +M50.00;M50.53;M01.03 +M41.00;[Null];M02.00 +M41.00;M41.41;M02.00 +M41.00;M41.51;M02.00 +M41.00;M41.61;M02.00 +M45.00;[Null];M02.00 +M24.00;M24.01;M02.02 +M46.00;M46.21;M02.03 +M46.00;M46.22;M02.03 +M46.00;M46.29;M02.03 +M46.00;M46.02;M02.04 +M46.00;M46.03;M02.04 +M46.00;M46.12;M02.04 +M46.00;M46.13;M02.04 +M46.00;M46.09;M02.05 +M46.00;M46.19;M02.05 +M24.00;M24.91;M02.06 +M24.00;M24.92;M02.06 +M41.00;M41.21;M02.06 +M41.00;M41.29;M02.06 +M41.00;M41.39;M02.06 +M41.00;M41.49;M02.06 +M41.00;M41.59;M02.06 +M41.00;M41.69;M02.06 +M45.00;M45.33;M02.06 +M24.00;[Null];M02.07 +M24.00;M24.11;M02.07 +M41.00;M41.22;M02.07 +M41.00;M41.31;M02.07 +M41.00;M41.42;M02.07 +M41.00;M41.52;M02.07 +M41.00;M41.53;M02.07 +M41.00;M41.54;M02.07 +M41.00;M41.55;M02.07 +M41.00;M41.62;M02.07 +M41.00;M41.64;M02.07 +M41.00;M41.65;M02.07 +M41.00;M41.66;M02.07 +M45.00;M45.02;M02.07 +M45.00;M45.03;M02.07 +M45.00;M45.05;M02.07 +M45.00;M45.06;M02.07 +M45.00;M45.07;M02.07 +M45.00;M45.31;M02.07 +M45.00;M45.32;M02.07 +M46.00;[Null];M02.07 +M46.00;M46.01;M02.07 +M46.00;M46.11;M02.07 +M41.00;M41.11;M02.08 +M41.00;M41.32;M02.08 +M45.00;M45.01;M02.08 +M45.00;M45.08;M02.08 +M45.00;M45.09;M02.08 +M80.00;M80.01;M03.01 +M80.00;M80.02;M03.01 +M80.00;M80.03;M03.01 +M80.00;M80.04;M03.01 +M80.00;M80.05;M03.01 +M80.00;M80.06;M03.01 +M80.00;M80.07;M03.01 +M80.00;M80.08;M03.01 +M32.00;M32.95;M03.02 +M60.00;M60.05;M03.02 +M80.00;[Null];M03.02 +M80.00;M80.11;M03.02 +M80.00;M80.12;M03.02 +M80.00;M80.13;M03.02 +M80.00;M80.14;M03.02 +M80.00;M80.15;M03.02 +M80.00;M80.19;M03.02 +M60.00;M60.31;M03.06 +M60.00;M60.32;M03.06 +M60.00;M60.33;M03.06 +M60.00;M60.34;M03.06 +M60.00;M60.35;M03.06 +M60.00;M60.36;M03.06 +M60.00;M60.37;M03.06 +M60.00;M60.38;M03.06 +M60.00;M60.39;M03.06 +M60.00;M60.40;M03.06 +M60.00;M60.41;M03.06 +M60.00;M60.49;M03.06 +M32.00;[Null];M03.07 +M32.00;M32.91;M03.07 +M32.00;M32.99;M03.07 +M32.00;M32.01;M03.08 +M32.00;M32.02;M03.08 +M32.00;M32.03;M03.08 +M32.00;M32.04;M03.08 +M32.00;M32.05;M03.08 +M32.00;M32.51;M03.09 +M32.00;M32.57;M03.09 +M32.00;M32.31;M03.10 +M32.00;M32.32;M03.10 +M32.00;M32.34;M03.10 +M32.00;M32.35;M03.10 +M32.00;M32.39;M03.10 +M32.00;M32.52;M03.10 +M32.00;M32.54;M03.10 +M32.00;M32.55;M03.10 +M32.00;M32.92;M03.11 +M60.00;M60.01;M03.11 +M60.00;M60.08;M03.11 +M31.00;[Null];M03.12 +M31.00;M31.11;M03.12 +M31.00;M31.12;M03.12 +M31.00;M31.19;M03.12 +M31.00;M31.91;M03.12 +M31.00;M31.92;M03.12 +M31.00;M31.93;M03.12 +M31.00;M31.94;M03.12 +M31.00;M31.99;M03.12 +M30.00;[Null];M03.13 +M30.00;M30.61;M03.13 +M30.00;M30.91;M03.13 +M30.00;M30.92;M03.13 +M30.00;M30.93;M03.13 +M30.00;M30.95;M03.13 +M30.00;M30.96;M03.13 +M60.00;M60.94;M03.14 +M90.00;M90.41;M03.14 +M90.00;M90.71;M03.14 +M90.00;M90.11;M03.15 +M90.00;M90.12;M03.15 +M90.00;M90.13;M03.15 +M90.00;M90.14;M03.15 +M90.00;M90.16;M03.15 +M90.00;M90.17;M03.15 +M90.00;M90.19;M03.15 +M90.00;M90.61;M03.16 +M90.00;M90.63;M03.17 +M24.00;M24.02;M03.18 +M24.00;M24.29;M03.18 +M24.00;M24.21;M03.19 +M24.00;M24.25;M03.19 +M24.00;M24.26;M03.19 +M24.00;M24.28;M03.19 +M60.00;M60.21;M03.20 +M60.00;M60.26;M03.20 +M90.00;M90.51;M03.21 +M90.00;M90.53;M03.21 +M90.00;M90.54;M03.21 +M90.00;M90.55;M03.21 +M90.00;M90.59;M03.21 +M32.00;M32.11;M03.23 +M32.00;M32.21;M03.23 +M32.00;M32.22;M03.23 +M32.00;M32.25;M03.23 +M32.00;M32.24;M03.23 +M50.00;M50.22;M03.23 +M50.00;M50.32;M03.23 +M50.00;M50.52;M03.23 +M24.00;M24.27;M03.24 +M90.00;M90.52;M03.24 +M60.00;[Null];M03.26 +M60.00;M60.51;M03.26 +M60.00;M60.53;M03.26 +M60.00;M60.59;M03.26 +M60.00;M60.91;M03.26 +M60.00;M60.96;M03.26 +M60.00;M60.92;M03.27 +M90.00;M90.01;M03.28 +M32.00;M32.36;M03.29 +M60.00;M60.93;M03.30 +M50.00;[Null];M04.00 +M50.00;M50.21;M04.00 +M50.00;M50.29;M04.00 +M50.00;M50.31;M04.00 +M50.00;M50.39;M04.00 +M50.00;M50.54;M04.00 +M50.00;M50.51;M04.02 +M50.00;M50.25;M04.03 +M90.00;M90.64;M04.04 +M50.00;M50.11;M04.05 +M50.00;M50.12;M04.05 +M50.00;M50.15;M04.05 +M50.00;M50.16;M04.05 +M90.00;M90.65;M05.01 +M90.00;M90.62;M05.02 +M98.00;[Null];M06.01 +M98.00;M98.01;M06.01 +M98.00;M98.11;M06.01 +M98.00;M98.21;M06.01 +M98.00;M98.31;M06.01 +M90.00;M90.31;M06.02 +M41.00;M41.01;M06.03 +M30.00;M30.97;M06.04 +M90.00;[Null];M06.04 +M90.00;M90.21;M06.05 From 957e57e388427de4c5fcda0d9899e3086681c124 Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Tue, 19 Aug 2025 11:53:04 +0200 Subject: [PATCH 02/11] feat(converter): update health motive code using csv files --- converter/converter/cisu/cisu_converter.py | 9 ++++- converter/converter/cisu/constants.py | 6 +++ converter/converter/cisu/utils.py | 43 ++++++++++++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 converter/converter/cisu/constants.py diff --git a/converter/converter/cisu/cisu_converter.py b/converter/converter/cisu/cisu_converter.py index 463a7e3f40..ad562f42f8 100644 --- a/converter/converter/cisu/cisu_converter.py +++ b/converter/converter/cisu/cisu_converter.py @@ -6,11 +6,10 @@ from yaml import dump -from .utils import add_to_initial_alert_notes +from .utils import add_to_initial_alert_notes, update_health_motive_code from ..utils import delete_paths, get_field_value, get_recipient, get_sender, is_field_completed, translate_key_words class CISUConverterV3: - """Handles CISU format conversions""" CISU_PATHS_TO_DELETE = [ "qualification.victims", @@ -144,6 +143,9 @@ def add_object_to_medical_notes(json_data: Dict[str, Any], note_text: str, sende # - Updates output_use_case_json['owner'] = get_recipient(input_json) + # /!\ it must be done before copying qualification + update_health_motive_code(output_use_case_json, True) + set_default_location_freetext(output_use_case_json) add_location_detail(output_use_case_json) @@ -240,6 +242,9 @@ def add_default_external_info_type(json_data: Dict[str,Any]): if not is_field_completed(output_usecase_json,'$.qualification.whatsHappen'): output_usecase_json['qualification']['whatsHappen'] = cls.DEFAULT_WHATS_HAPPEN + # /!\ it must be done before copying qualification + update_health_motive_code(output_usecase_json, False) + add_default_external_info_type(output_usecase_json) # Deletions - /!\ it must be done before copying qualification and location fields diff --git a/converter/converter/cisu/constants.py b/converter/converter/cisu/constants.py new file mode 100644 index 0000000000..df9e13f8ee --- /dev/null +++ b/converter/converter/cisu/constants.py @@ -0,0 +1,6 @@ +class Constants: + MRSM_CISU_UPDATED_NOMENCLATURE_FILE = './mrms_cisu_updated_nomenclature.csv' + MR0_LABEL = "CodeCisuMR0" + MR1_LABEL = "CodeCisuMR1" + OLD_MR_LABEL = "CodeCisu V1.3" + CSV_DELIMITER = ';' diff --git a/converter/converter/cisu/utils.py b/converter/converter/cisu/utils.py index 774ea08cd5..ae87b4c028 100644 --- a/converter/converter/cisu/utils.py +++ b/converter/converter/cisu/utils.py @@ -1,6 +1,10 @@ from typing import Any, Dict, List +import csv +import os from yaml import dump + +from converter.cisu.constants import Constants from ..utils import concatenate_values, get_field_value, is_field_completed def add_object_to_initial_alert_notes(json_data: Dict[str, Any], note_text: str): @@ -22,3 +26,42 @@ def add_field_to_initial_alert_notes(data: Dict[str, Any], path_and_label: Dict[ def add_to_initial_alert_notes(data: Dict[str, Any], paths: List[Dict[str, str]]): for path in paths: add_field_to_initial_alert_notes(data, path) + +def find_in_mrms_cisu_nomenclature(search_value: str, search_columns: list, return_column: str) -> str: + file_path = os.path.join(os.path.dirname(__file__), Constants.MRSM_CISU_UPDATED_NOMENCLATURE_FILE) + with open(file_path, newline='', encoding='utf-8') as csvfile: + reader = csv.DictReader(csvfile, delimiter=Constants.CSV_DELIMITER) + for row in reader: + for col in search_columns: + if row.get(col, '').strip() == search_value: + return row.get(return_column) + return None + +def get_deprecated_code_cisu_from_health_motive(health_motive_code: str) -> str: + return find_in_mrms_cisu_nomenclature( + health_motive_code, + [Constants.MR0_LABEL, Constants.MR1_LABEL], + Constants.OLD_MR_LABEL + ) + +def get_code_cisu_mr0_from_health_motive(health_motive_code: str) -> str: + return find_in_mrms_cisu_nomenclature( + health_motive_code, + [Constants.OLD_MR_LABEL], + Constants.MR0_LABEL + ) + +def update_health_motive_code(json_data: Dict[str, Any], isCodeDeprecated: bool): + health_motive_code = get_field_value(json_data, '$.qualification.healthMotive.code') + + if health_motive_code is not None: + if isCodeDeprecated: + updated_health_motive_code = get_deprecated_code_cisu_from_health_motive(health_motive_code) + else: + updated_health_motive_code = get_code_cisu_mr0_from_health_motive(health_motive_code) + + if updated_health_motive_code is not None: + json_data['qualification']['healthMotive'] = { + 'code': updated_health_motive_code, + 'label': get_field_value(json_data, '$.qualification.healthMotive.label') + } From e08fe144d8b466482861cf4781cba5bced8322dd Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Tue, 19 Aug 2025 11:58:37 +0200 Subject: [PATCH 03/11] feat(converter): update example files to match new nomenclature --- .../fixtures/RC-EDA/RC-EDA_exhaustive_fill.json | 4 ++-- .../fixtures/RC-EDA/RC-EDA_exhaustive_fill_bis.json | 4 ++-- .../RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json | 2 +- .../tests/snapshots/snap_test_cisu_converter.py | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json b/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json index 4841c0a03f..4fcd512cc2 100644 --- a/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json +++ b/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json @@ -10,7 +10,7 @@ "label": "Obstétrique" }, "healthMotive": { - "code": "M03.02", + "code": "M41.01", "label": "Autre problème obstétrique non hémorragique" }, "victims": { @@ -158,7 +158,7 @@ "label": "Obstétrique" }, "healthMotive": { - "code": "M03.02", + "code": "M41.01", "label": "Autre problème obstétrique non hémorragique" }, "victims": { diff --git a/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill_bis.json b/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill_bis.json index 60aa767cde..ea9110fdcf 100644 --- a/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill_bis.json +++ b/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill_bis.json @@ -10,7 +10,7 @@ "label": "Obstétrique" }, "healthMotive": { - "code": "M03.02", + "code": "M90.00", "label": "Autre problème obstétrique non hémorragique" }, "victims": { @@ -158,7 +158,7 @@ "label": "Obstétrique" }, "healthMotive": { - "code": "M03.02", + "code": "M90.00", "label": "Autre problème obstétrique non hémorragique" }, "victims": { diff --git a/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json b/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json index 577f44d3e1..a51e70b94d 100644 --- a/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json +++ b/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json @@ -12,7 +12,7 @@ "label": "Domicile ; Lieu d'habitation collectif ou foyer d'hébergement ; escaliers" }, "healthMotive": { - "code": "M02.07", + "code": "M03.01", "label": "Traumatisme sérieux, plaie intermédiaire" }, "details": { diff --git a/converter/tests/snapshots/snap_test_cisu_converter.py b/converter/tests/snapshots/snap_test_cisu_converter.py index 0335f8d06c..a80dbaf9e3 100644 --- a/converter/tests/snapshots/snap_test_cisu_converter.py +++ b/converter/tests/snapshots/snap_test_cisu_converter.py @@ -50,7 +50,7 @@ "label": "Obst\\u00e9trique" }, "healthMotive": { - "code": "M03.02", + "code": "M03.14", "label": "Autre probl\\u00e8me obst\\u00e9trique non h\\u00e9morragique" }, "locationKind": { @@ -216,7 +216,7 @@ "label": "Obst\\u00e9trique" }, "healthMotive": { - "code": "M03.02", + "code": "M06.03", "label": "Autre probl\\u00e8me obst\\u00e9trique non h\\u00e9morragique" }, "locationKind": { @@ -439,7 +439,7 @@ "label": "Domicile ; Lieu d\'habitation collectif ou foyer d\'h\\u00e9bergement ; escaliers" }, "healthMotive": { - "code": "M02.07", + "code": "M24.00", "label": "Traumatisme s\\u00e9rieux, plaie interm\\u00e9diaire" }, "riskThreat": [ @@ -536,7 +536,7 @@ "label": "Domicile ; Lieu d\'habitation collectif ou foyer d\'h\\u00e9bergement ; escaliers" }, "healthMotive": { - "code": "M02.07", + "code": "M24.00", "label": "Traumatisme s\\u00e9rieux, plaie interm\\u00e9diaire" }, "riskThreat": [ @@ -655,7 +655,7 @@ "label": "Domicile ; Lieu d\'habitation collectif ou foyer d\'h\\u00e9bergement ; escaliers" }, "healthMotive": { - "code": "M02.07", + "code": "M80.00", "label": "Traumatisme s\\u00e9rieux, plaie interm\\u00e9diaire" }, "riskThreat": [ @@ -764,7 +764,7 @@ "label": "Domicile ; Lieu d\'habitation collectif ou foyer d\'h\\u00e9bergement ; escaliers" }, "healthMotive": { - "code": "M02.07", + "code": "M80.00", "label": "Traumatisme s\\u00e9rieux, plaie interm\\u00e9diaire" }, "riskThreat": [ From 0d8a7d966cb046ad961866f8f3fb75bda896673e Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Tue, 26 Aug 2025 15:40:38 +0200 Subject: [PATCH 04/11] feat: use constants for version tags --- converter/converter/constants.py | 4 ++++ .../cisu_conversion_strategy.py | 2 +- .../versions/base_message_converter.py | 21 +++++++++++-------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/converter/converter/constants.py b/converter/converter/constants.py index 133b8f2b75..6ee76ceff2 100644 --- a/converter/converter/constants.py +++ b/converter/converter/constants.py @@ -3,6 +3,10 @@ class Constants: V2_GITHUB_TAG="release/2.x-maintenance" V3_GITHUB_TAG="3.0.0" + V3_VERSION="v3" + V2_VERSION="v2" + V1_VERSION="v1" + EDXL_HEALTH_TO_FIRE_ENVELOPE_PATH="tests/edxl_envelope_health_to_fire.json" EDXL_FIRE_TO_HEALTH_ENVELOPE_PATH="tests/edxl_envelope_fire_to_health.json" EDXL_HEALTH_TO_HEALTH_ENVELOPE_PATH="tests/edxl_envelope_health_to_health.json" diff --git a/converter/converter/conversion_strategy/cisu_conversion_strategy.py b/converter/converter/conversion_strategy/cisu_conversion_strategy.py index 3adc494e2d..93c25a3da9 100644 --- a/converter/converter/conversion_strategy/cisu_conversion_strategy.py +++ b/converter/converter/conversion_strategy/cisu_conversion_strategy.py @@ -8,7 +8,7 @@ def cisu_conversion_strategy(edxl_json, source_version, target_version): TO_CISU = "to_CISU" FROM_CISU = "from_CISU" - MAINTAINED_CISU_VERSION = "v3" + MAINTAINED_CISU_VERSION = Constants.V3_VERSION # Compute direction based on sender / recipient sender = get_sender(edxl_json) diff --git a/converter/converter/versions/base_message_converter.py b/converter/converter/versions/base_message_converter.py index 29fa3a4583..55269e06fe 100644 --- a/converter/converter/versions/base_message_converter.py +++ b/converter/converter/versions/base_message_converter.py @@ -1,4 +1,7 @@ -version_order_list = ["v1", "v2", "v3"] +from converter.constants import Constants + + +version_order_list = [Constants.V1_VERSION, Constants.V2_VERSION, Constants.V3_VERSION] class BaseMessageConverter: def __init__(self): @@ -54,37 +57,37 @@ def convert(cls, source_version, target_version, edxl_json): @classmethod def upgrade(cls, source_version, source_version_index, edxl_json): - if source_version == "v1": + if source_version == Constants.V1_VERSION: return cls.convert_v1_to_v2(edxl_json) - elif source_version == "v2": + elif source_version == Constants.V2_VERSION: return cls.convert_v2_to_v3(edxl_json) else: cls.raise_conversion_impossible_error(source_version, version_order_list[source_version_index + 1]) @classmethod def downgrade(cls, source_version, source_version_index, edxl_json): - if source_version == "v2": + if source_version == Constants.V2_VERSION: return cls.convert_v2_to_v1(edxl_json) - elif source_version == "v3": + elif source_version == Constants.V3_VERSION: return cls.convert_v3_to_v2(edxl_json) else: cls.raise_conversion_impossible_error(source_version, version_order_list[source_version_index - 1]) @classmethod def convert_v1_to_v2(cls, edxl_json): - cls.raise_conversion_not_implemented_error("v1", "v2") + cls.raise_conversion_not_implemented_error(Constants.V1_VERSION, Constants.V2_VERSION) @classmethod def convert_v2_to_v1(cls, edxl_json): - cls.raise_conversion_not_implemented_error("v2", "v1") + cls.raise_conversion_not_implemented_error(Constants.V2_VERSION, Constants.V1_VERSION) @classmethod def convert_v2_to_v3(cls, edxl_json): - cls.raise_conversion_not_implemented_error("v2", "v3") + cls.raise_conversion_not_implemented_error(Constants.V2_VERSION, Constants.V3_VERSION) @classmethod def convert_v3_to_v2(cls, edxl_json): - cls.raise_conversion_not_implemented_error("v3", "v2") + cls.raise_conversion_not_implemented_error(Constants.V3_VERSION, Constants.V2_VERSION) @classmethod def raise_conversion_not_implemented_error(cls, source_version, target_version): From cd821605fafc389f0978e40dc2e43a51f96607a5 Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Tue, 26 Aug 2025 15:51:41 +0200 Subject: [PATCH 05/11] feat: do not update code if samu is in v3 (code is validated by regex and not enum) --- converter/converter/cisu/cisu_converter.py | 11 ++++++++-- .../cisu_conversion_strategy.py | 4 ++-- converter/tests/test_cisu_converter.py | 22 +++++++++---------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/converter/converter/cisu/cisu_converter.py b/converter/converter/cisu/cisu_converter.py index ad562f42f8..a2b934f7d0 100644 --- a/converter/converter/cisu/cisu_converter.py +++ b/converter/converter/cisu/cisu_converter.py @@ -6,10 +6,16 @@ from yaml import dump +from converter.constants import Constants + from .utils import add_to_initial_alert_notes, update_health_motive_code from ..utils import delete_paths, get_field_value, get_recipient, get_sender, is_field_completed, translate_key_words class CISUConverterV3: + # Todo: revert change when all editors use the new CISU nomenclature or are in V3 or above + target_version="" + def __init__(self, target_version: str): + self.target_version = target_version CISU_PATHS_TO_DELETE = [ "qualification.victims", @@ -143,8 +149,9 @@ def add_object_to_medical_notes(json_data: Dict[str, Any], note_text: str, sende # - Updates output_use_case_json['owner'] = get_recipient(input_json) - # /!\ it must be done before copying qualification - update_health_motive_code(output_use_case_json, True) + if cls.target_version != Constants.V3_VERSION: + # /!\ it must be done before copying qualification + update_health_motive_code(output_use_case_json, True) set_default_location_freetext(output_use_case_json) add_location_detail(output_use_case_json) diff --git a/converter/converter/conversion_strategy/cisu_conversion_strategy.py b/converter/converter/conversion_strategy/cisu_conversion_strategy.py index 93c25a3da9..ab14f2779e 100644 --- a/converter/converter/conversion_strategy/cisu_conversion_strategy.py +++ b/converter/converter/conversion_strategy/cisu_conversion_strategy.py @@ -25,12 +25,12 @@ def cisu_conversion_strategy(edxl_json, source_version, target_version): raise ValueError(f"Unknown target version {target_version}. Must be: {MAINTAINED_CISU_VERSION}") rs_json_message = health_conversion_strategy(edxl_json, source_version, MAINTAINED_CISU_VERSION) - return CISUConverterV3.to_cisu(rs_json_message) + return CISUConverterV3(target_version).to_cisu(rs_json_message) elif direction == FROM_CISU: if source_version != MAINTAINED_CISU_VERSION: raise ValueError(f"Unknown source version {source_version}. Must be: {MAINTAINED_CISU_VERSION}") - rc_json_message = CISUConverterV3.from_cisu(edxl_json) + rc_json_message = CISUConverterV3(target_version).from_cisu(edxl_json) return health_conversion_strategy(rc_json_message, MAINTAINED_CISU_VERSION, target_version) else: raise ValueError('Invalid direction parameter') diff --git a/converter/tests/test_cisu_converter.py b/converter/tests/test_cisu_converter.py index 68a04f7881..aa275b0a3a 100644 --- a/converter/tests/test_cisu_converter.py +++ b/converter/tests/test_cisu_converter.py @@ -22,7 +22,7 @@ def validate_health_format(result): TestHelper.conversion_tests_runner( sample_dir=Constants.RC_EDA_TAG, envelope_file=Constants.EDXL_FIRE_TO_HEALTH_ENVELOPE_PATH, - converter_method=CISUConverterV3.from_cisu, + converter_method=CISUConverterV3(Constants.V1_VERSION).from_cisu, target_schema=RS_EDA_SCHEMA, additional_validation=validate_health_format ) @@ -32,7 +32,7 @@ def test_to_cisu_conversion_local(): TestHelper.conversion_tests_runner( sample_dir=Constants.RS_EDA_TAG, envelope_file=Constants.EDXL_HEALTH_TO_FIRE_ENVELOPE_PATH, - converter_method=CISUConverterV3.to_cisu, + converter_method=CISUConverterV3(Constants.V1_VERSION).to_cisu, target_schema=RC_EDA_SCHEMA ) @@ -44,7 +44,7 @@ def validate_health_format(result): TestHelper.conversion_tests_runner( sample_dir=Constants.RC_EDA_TAG, envelope_file=Constants.EDXL_FIRE_TO_HEALTH_ENVELOPE_PATH, - converter_method=CISUConverterV3.from_cisu, + converter_method=CISUConverterV3(Constants.V3_VERSION).from_cisu, target_schema=RS_EDA_SCHEMA, additional_validation=validate_health_format, online_tag="main" # ToDo: migrate to "v3" once tag is available @@ -55,7 +55,7 @@ def test_to_cisu_conversion_v3(): TestHelper.conversion_tests_runner( sample_dir=Constants.RS_EDA_TAG, envelope_file=Constants.EDXL_HEALTH_TO_FIRE_ENVELOPE_PATH, - converter_method=CISUConverterV3.to_cisu, + converter_method=CISUConverterV3(Constants.V3_VERSION).to_cisu, target_schema=RC_EDA_SCHEMA, online_tag="main" # ToDo: migrate to "v3" once tag is available ) @@ -76,7 +76,7 @@ def test_snapshot_RS_EDA_exhaustive_message(self, mock_choices, mock_now): mock_choices.choices.return_value = "f5de" message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_health_to_fire_path, self.fixtures_folder_path + "RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json") - converter = CISUConverterV3() + converter = CISUConverterV3(Constants.V1_VERSION) output_data = converter.to_cisu(message) self.assertMatchSnapshot(json.dumps(output_data, indent=2)) @@ -86,7 +86,7 @@ def test_snapshot_RC_EDA_exhaustive_message(self, mock_choices): mock_choices.choices.side_effect = ["f5de7hj", "a3b2YH8", "c9d8jk9","he9i0kz"] message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_fire_to_health_path, self.fixtures_folder_path + "RC-EDA/RC-EDA_exhaustive_fill.json") - converter = CISUConverterV3() + converter = CISUConverterV3(Constants.V1_VERSION) output_data = converter.from_cisu(message) self.assertMatchSnapshot(json.dumps(output_data, indent=2)) @@ -100,7 +100,7 @@ def test_snapshot_RS_EDA_required_field_message(self,mock_choices, mock_now): mock_choices.choices.return_value = "f5de" message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_health_to_fire_path, self.fixtures_folder_path + "RS-EDA/cisu_case/RS-EDA_required_fields.json") - converter = CISUConverterV3() + converter = CISUConverterV3(Constants.V1_VERSION) output_data = converter.to_cisu(message) self.assertMatchSnapshot(json.dumps(output_data, indent=2)) @@ -110,7 +110,7 @@ def test_snapshot_RC_EDA_required_field_message(self, mock_choices): mock_choices.choices.side_effect = ["f5de7hj", "a3b2YH8", "c9d8jk9","he9i0kz"] message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_fire_to_health_path, self.fixtures_folder_path + "RC-EDA/RC-EDA_required_fields.json") - converter = CISUConverterV3() + converter = CISUConverterV3(Constants.V1_VERSION) output_data = converter.from_cisu(message) @@ -125,7 +125,7 @@ def test_snapshot_RS_EDA_exhaustive_bis_message(self,mock_choices, mock_now): mock_choices.choices.return_value = "f5de" message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_health_to_fire_path, self.fixtures_folder_path + "RS-EDA/cisu_case/RS-EDA_exhaustive_fill_bis.json") - converter = CISUConverterV3() + converter = CISUConverterV3(Constants.V1_VERSION) output_data = converter.to_cisu(message) self.assertMatchSnapshot(json.dumps(output_data, indent=2)) @@ -135,7 +135,7 @@ def test_snapshot_RC_EDA_exhaustive_bis_message(self, mock_choices): mock_choices.choices.side_effect = ["f5de7hj", "a3b2YH8", "c9d8jk9","he9i0kz"] message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_fire_to_health_path, self.fixtures_folder_path + "RC-EDA/RC-EDA_exhaustive_fill_bis.json") - converter = CISUConverterV3() + converter = CISUConverterV3(Constants.V1_VERSION) output_data = converter.from_cisu(message) @@ -144,7 +144,7 @@ def test_snapshot_RC_EDA_exhaustive_bis_message(self, mock_choices): class TestVictimsCount(TestCase): def setUp(self): self.fixtures_folder_path = "tests/fixtures/" - self.converter = CISUConverterV3() + self.converter = CISUConverterV3(Constants.V1_VERSION) def test_count_victims_1(self): From e200987c90165130165cdaea8b0682e18cb6e057 Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Tue, 26 Aug 2025 16:41:26 +0200 Subject: [PATCH 06/11] feat: make util more generic --- converter/converter/cisu/utils.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/converter/converter/cisu/utils.py b/converter/converter/cisu/utils.py index ae87b4c028..165da04663 100644 --- a/converter/converter/cisu/utils.py +++ b/converter/converter/cisu/utils.py @@ -27,8 +27,8 @@ def add_to_initial_alert_notes(data: Dict[str, Any], paths: List[Dict[str, str]] for path in paths: add_field_to_initial_alert_notes(data, path) -def find_in_mrms_cisu_nomenclature(search_value: str, search_columns: list, return_column: str) -> str: - file_path = os.path.join(os.path.dirname(__file__), Constants.MRSM_CISU_UPDATED_NOMENCLATURE_FILE) +def find_in_cisu_nomenclature(search_value: str, search_columns: list, return_column: str, filename: str) -> str: + file_path = os.path.join(os.path.dirname(__file__), filename) with open(file_path, newline='', encoding='utf-8') as csvfile: reader = csv.DictReader(csvfile, delimiter=Constants.CSV_DELIMITER) for row in reader: @@ -38,17 +38,19 @@ def find_in_mrms_cisu_nomenclature(search_value: str, search_columns: list, retu return None def get_deprecated_code_cisu_from_health_motive(health_motive_code: str) -> str: - return find_in_mrms_cisu_nomenclature( + return find_in_cisu_nomenclature( health_motive_code, [Constants.MR0_LABEL, Constants.MR1_LABEL], - Constants.OLD_MR_LABEL + Constants.OLD_MR_LABEL, + Constants.MRSM_CISU_UPDATED_NOMENCLATURE_FILE ) def get_code_cisu_mr0_from_health_motive(health_motive_code: str) -> str: - return find_in_mrms_cisu_nomenclature( + return find_in_cisu_nomenclature( health_motive_code, [Constants.OLD_MR_LABEL], - Constants.MR0_LABEL + Constants.MR0_LABEL, + Constants.MRSM_CISU_UPDATED_NOMENCLATURE_FILE ) def update_health_motive_code(json_data: Dict[str, Any], isCodeDeprecated: bool): From d14a4b2daa364283209a1f77c4ec12212736e231 Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Mon, 1 Sep 2025 11:22:39 +0200 Subject: [PATCH 07/11] feat: add location type mapping --- .../location_kind_deprecated_nomenclature.csv | 103 ++++++++++++++++++ .../location_kind_updated_nomenclature.csv | 57 ++++++++++ 2 files changed, 160 insertions(+) create mode 100644 converter/converter/cisu/location_kind_deprecated_nomenclature.csv create mode 100644 converter/converter/cisu/location_kind_updated_nomenclature.csv diff --git a/converter/converter/cisu/location_kind_deprecated_nomenclature.csv b/converter/converter/cisu/location_kind_deprecated_nomenclature.csv new file mode 100644 index 0000000000..1b737b88a7 --- /dev/null +++ b/converter/converter/cisu/location_kind_deprecated_nomenclature.csv @@ -0,0 +1,103 @@ +CodeCisu V1.3;CodeCisu V2.0 +L01.01.00;L01.01.05 +L01.02.00;L01.02.12 +L01.02.12;L01.02.13 +L01.02.00;L01.02.14 +L01.03.00;L01.03.04 +L01.03.00;L01.03.05 +L01.03.00;L01.03.06 +L02.01.00;L02.01.01 +L02.01.00;L02.01.02 +L02.01.00;L02.01.03 +L02.02.05;L02.02.04 +L02.02.00;L02.02.05 +L02.03.00;L02.03.03 +L02.03.00;L02.03.04 +L02.04.00;L02.04.01 +L02.04.00;L02.04.02 +L02.06.00;L02.06.07 +L02.06.00;L02.06.08 +L02.07.00;L02.07.02 +L02.07.02;L02.07.03 +L02.07.00;L02.07.04 +L02.07.00;L02.07.05 +L02.07.00;L02.07.06 +L02.08.00;L02.08.00 +L02.08.00;L02.08.01 +L02.08.00;L02.08.02 +L02.08.00;L02.09.00 +L02.08.00;L02.09.01 +L02.08.00;L02.09.02 +L02.08.00;L02.09.03 +L03.02.00;L03.02.01 +L03.02.00;L03.02.02 +L04.06.00;L04.06.06 +L04.07.00;L04.07.04 +L04.09.00;L04.09.03 +L04.11.00;L04.11.05 +L04.13.00;L04.13.05 +L05.01.01;L05.01.01 +L05.01.00;L05.01.02 +L05.01.00;L05.01.03 +L05.01.03;L05.02.00 +L05.02.00;L05.03.00 +L05.02.01;L05.03.01 +L05.02.02;L05.03.02 +L05.02.03;L05.03.03 +L05.02.04;L05.03.04 +L05.01.04;L05.03.05 +L05.03.00;L05.04.00 +L05.03.01;L05.04.01 +L05.03.02;L05.04.02 +L05.03.00;L05.04.03 +L05.04.02;L05.04.04 +L05.04.01;L05.04.05 +L05.04.00;L05.05.00 +L05.04.01;L05.05.01 +L05.04.02;L05.05.02 +L05.04.04;L05.05.03 +L05.04.05;L05.05.04 +L05.04.06;L05.05.05 +L05.04.00;L05.05.06 +L05.05.00;L05.06.00 +L05.06.00;L05.07.00 +L05.07.00;L05.08.00 +L06.01.00;L06.01.08 +L06.01.00;L06.01.09 +L06.01.08;L06.01.10 +L07.00.00;L06.02.00 +L07.00.00;L06.03.00 +L07.00.00;L06.03.01 +L07.00.00;L06.03.02 +L07.00.00;L06.03.03 +L07.00.00;L06.04.00 +L06.02.00;L06.05.00 +L06.02.00;L06.05.01 +L06.02.00;L06.05.02 +L06.02.00;L06.05.03 +L06.02.00;L06.05.04 +L06.02.00;L06.05.05 +L06.02.00;L06.05.06 +L06.02.00;L06.05.07 +L06.02.00;L06.05.08 +L06.02.00;L06.05.09 +L06.03.00;L06.06.00 +L06.03.01;L06.06.01 +L06.03.02;L06.06.02 +L06.03.03;L06.06.03 +L06.03.04;L06.06.04 +L06.03.05;L06.06.05 +L06.04.00;L06.07.00 +L06.05.00;L06.08.00 +L06.05.01;L06.08.01 +L06.05.02;L06.08.02 +L06.06.00;L06.09.00 +L06.06.01;L06.09.01 +L06.06.02;L06.09.02 +L06.06.03;L06.09.03 +L02.06.07;L06.09.04 +L06.06.04;L06.09.05 +L06.07.00;L06.10.00 +L06.07.01;L06.10.01 +L06.07.02;L06.10.02 +L07.00.00;L07.00.00 diff --git a/converter/converter/cisu/location_kind_updated_nomenclature.csv b/converter/converter/cisu/location_kind_updated_nomenclature.csv new file mode 100644 index 0000000000..09a5ce3e3c --- /dev/null +++ b/converter/converter/cisu/location_kind_updated_nomenclature.csv @@ -0,0 +1,57 @@ +CodeCisu V1.3;CodeCisu V2.0 +L01.02.12;L01.02.13 +L02.02.04;L02.02.00 +L02.02.05;L02.02.04 +L02.03.03;L02.03.00 +L02.06.07;L06.09.04 +L02.06.08;L02.06.00 +L02.07.02;L02.07.03 +L02.08.00;L02.09.00 +L03.04.00;L03.00.00 +L03.05.00;L03.04.00 +L05.01.01;L05.01.01 +L05.01.02;L05.01.01 +L05.01.03;L05.02.00 +L05.01.04;L05.03.05 +L05.02.00;L05.03.00 +L05.02.01;L05.03.01 +L05.02.02;L05.03.02 +L05.02.03;L05.03.03 +L05.02.04;L05.03.04 +L05.03.00;L05.04.00 +L05.03.01;L05.04.01 +L05.03.02;L05.04.02 +L05.04.00;L05.05.00 +L05.04.01;L05.05.01 +L05.04.02;L05.05.02 +L05.04.03;L05.05.00 +L05.04.04;L05.05.03 +L05.04.05;L05.05.04 +L05.04.06;L05.05.05 +L05.05.00;L05.06.00 +L05.06.00;L05.07.00 +L05.07.00;L05.08.00 +L06.01.08;L06.01.10 +L06.02.00;L06.05.00 +L06.03.00;L06.06.00 +L06.03.01;L06.06.01 +L06.03.02;L06.06.02 +L06.03.03;L06.06.03 +L06.03.04;L06.06.04 +L06.03.05;L06.06.05 +L06.04.00;L06.07.00 +L06.05.00;L06.08.00 +L06.05.01;L06.08.01 +L06.05.02;L06.08.02 +L06.06.00;L06.09.00 +L06.06.01;L06.09.01 +L06.06.02;L06.09.02 +L06.06.03;L06.09.03 +L06.06.04;L06.09.05 +L06.07.00;L06.10.00 +L06.07.01;L06.10.01 +L06.07.02;L06.10.02 +L07.00.00;L07.00.00 +L07.01.00;L07.00.00 +L07.01.01;L07.00.00 +L07.02.00;L07.00.00 From 32e1adfe22204a2b81e9eb16e2ef5640956cc609 Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Mon, 1 Sep 2025 11:24:27 +0200 Subject: [PATCH 08/11] feat: update type location codes in converter --- converter/converter/cisu/cisu_converter.py | 11 +++++--- converter/converter/cisu/constants.py | 8 +++++- converter/converter/cisu/utils.py | 31 ++++++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/converter/converter/cisu/cisu_converter.py b/converter/converter/cisu/cisu_converter.py index a2b934f7d0..235ce4a4fd 100644 --- a/converter/converter/cisu/cisu_converter.py +++ b/converter/converter/cisu/cisu_converter.py @@ -8,7 +8,7 @@ from converter.constants import Constants -from .utils import add_to_initial_alert_notes, update_health_motive_code +from .utils import add_to_initial_alert_notes, update_health_motive_code, update_location_kind_code from ..utils import delete_paths, get_field_value, get_recipient, get_sender, is_field_completed, translate_key_words class CISUConverterV3: @@ -150,8 +150,11 @@ def add_object_to_medical_notes(json_data: Dict[str, Any], note_text: str, sende output_use_case_json['owner'] = get_recipient(input_json) if cls.target_version != Constants.V3_VERSION: + is_code_deprecated = True # /!\ it must be done before copying qualification - update_health_motive_code(output_use_case_json, True) + update_health_motive_code(output_use_case_json, is_code_deprecated) + update_location_kind_code(output_use_case_json, is_code_deprecated) + set_default_location_freetext(output_use_case_json) add_location_detail(output_use_case_json) @@ -250,7 +253,9 @@ def add_default_external_info_type(json_data: Dict[str,Any]): output_usecase_json['qualification']['whatsHappen'] = cls.DEFAULT_WHATS_HAPPEN # /!\ it must be done before copying qualification - update_health_motive_code(output_usecase_json, False) + is_code_deprecated = False + update_health_motive_code(output_usecase_json, is_code_deprecated) + update_location_kind_code(output_usecase_json, is_code_deprecated) add_default_external_info_type(output_usecase_json) diff --git a/converter/converter/cisu/constants.py b/converter/converter/cisu/constants.py index df9e13f8ee..aa142e3f99 100644 --- a/converter/converter/cisu/constants.py +++ b/converter/converter/cisu/constants.py @@ -1,6 +1,12 @@ class Constants: + CSV_DELIMITER = ';' + MRSM_CISU_UPDATED_NOMENCLATURE_FILE = './mrms_cisu_updated_nomenclature.csv' MR0_LABEL = "CodeCisuMR0" MR1_LABEL = "CodeCisuMR1" OLD_MR_LABEL = "CodeCisu V1.3" - CSV_DELIMITER = ';' + + LOCATION_KIND_CISU_UPDATED_NOMENCLATURE_FILE = './location_kind_updated_nomenclature.csv' + LOCATION_KIND_CISU_DEPRECATED_NOMENCLATURE_FILE = './location_kind_deprecated_nomenclature.csv' + OLD_LOCATION_KIND_LABEL = "CodeCisu V1.3" + NEW_LOCATION_KIND_LABEL = "CodeCisu V2.0" diff --git a/converter/converter/cisu/utils.py b/converter/converter/cisu/utils.py index 165da04663..4d8c1d2498 100644 --- a/converter/converter/cisu/utils.py +++ b/converter/converter/cisu/utils.py @@ -67,3 +67,34 @@ def update_health_motive_code(json_data: Dict[str, Any], isCodeDeprecated: bool) 'code': updated_health_motive_code, 'label': get_field_value(json_data, '$.qualification.healthMotive.label') } + +def get_deprecated_code_cisu_from_location_type(location_type_code: str) -> str: + return find_in_cisu_nomenclature( + location_type_code, + [Constants.NEW_LOCATION_KIND_LABEL], + Constants.OLD_LOCATION_KIND_LABEL, + Constants.LOCATION_KIND_CISU_DEPRECATED_NOMENCLATURE_FILE + ) + +def get_code_new_cisu_from_location_type(location_type_code: str) -> str: + return find_in_cisu_nomenclature( + location_type_code, + [Constants.OLD_LOCATION_KIND_LABEL], + Constants.NEW_LOCATION_KIND_LABEL, + Constants.LOCATION_KIND_CISU_UPDATED_NOMENCLATURE_FILE + ) + +def update_location_kind_code(json_data: Dict[str, Any], isCodeDeprecated: bool): + location_kind_code = get_field_value(json_data, '$.qualification.locationKind.code') + + if location_kind_code is not None: + if isCodeDeprecated: + updated_location_kind_code = get_deprecated_code_cisu_from_location_type(location_kind_code) + else: + updated_location_kind_code = get_code_new_cisu_from_location_type(location_kind_code) + + if updated_location_kind_code is not None: + json_data['qualification']['locationKind'] = { + 'code': updated_location_kind_code, + 'label': get_field_value(json_data, '$.qualification.locationKind.label') + } From 71e8da370d1ca060577dc05124c5bc4ce89d5ea0 Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Mon, 1 Sep 2025 11:25:23 +0200 Subject: [PATCH 09/11] test: change values in fixture to test update --- converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json | 2 +- .../fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json | 2 +- converter/tests/snapshots/snap_test_cisu_converter.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json b/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json index 4fcd512cc2..591803a6e7 100644 --- a/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json +++ b/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json @@ -19,7 +19,7 @@ "count": "1" }, "locationKind": { - "code": "L04.02.00", + "code": "L06.02.00", "label": "Centre commercial / magasin" }, "riskThreat": [ diff --git a/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json b/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json index a51e70b94d..3092e42fab 100644 --- a/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json +++ b/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json @@ -8,7 +8,7 @@ "label": "Atteinte aux personnes ; Traumatisme / Accident ; Accident domestique" }, "locationKind": { - "code": "L01.02.10", + "code": "L01.02.12", "label": "Domicile ; Lieu d'habitation collectif ou foyer d'hébergement ; escaliers" }, "healthMotive": { diff --git a/converter/tests/snapshots/snap_test_cisu_converter.py b/converter/tests/snapshots/snap_test_cisu_converter.py index a80dbaf9e3..61f5b825df 100644 --- a/converter/tests/snapshots/snap_test_cisu_converter.py +++ b/converter/tests/snapshots/snap_test_cisu_converter.py @@ -220,7 +220,7 @@ "label": "Autre probl\\u00e8me obst\\u00e9trique non h\\u00e9morragique" }, "locationKind": { - "code": "L04.02.00", + "code": "L07.00.00", "label": "Centre commercial / magasin" }, "riskThreat": [ @@ -651,7 +651,7 @@ "label": "Atteinte aux personnes ; Traumatisme / Accident ; Accident domestique" }, "locationKind": { - "code": "L01.02.10", + "code": "L01.02.13", "label": "Domicile ; Lieu d\'habitation collectif ou foyer d\'h\\u00e9bergement ; escaliers" }, "healthMotive": { @@ -760,7 +760,7 @@ "label": "Atteinte aux personnes ; Traumatisme / Accident ; Accident domestique" }, "locationKind": { - "code": "L01.02.10", + "code": "L01.02.13", "label": "Domicile ; Lieu d\'habitation collectif ou foyer d\'h\\u00e9bergement ; escaliers" }, "healthMotive": { From f424346f036d27c0f2cf174b0875b0f86217018e Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Wed, 10 Sep 2025 17:33:31 +0200 Subject: [PATCH 10/11] Revert "Merge pull request #294 from ansforge/feat/update-type-location" This reverts commit f1395df53ab376efcf4c23fd981ff34373daaa0f, reversing changes made to a5820f707dbcd915d8c19c6f33df5a936e442da6. --- converter/converter/cisu/cisu_converter.py | 11 +- converter/converter/cisu/constants.py | 8 +- .../location_kind_deprecated_nomenclature.csv | 103 ------------------ .../location_kind_updated_nomenclature.csv | 57 ---------- converter/converter/cisu/utils.py | 31 ------ .../RC-EDA/RC-EDA_exhaustive_fill.json | 2 +- .../cisu_case/RS-EDA_exhaustive_fill.json | 2 +- .../snapshots/snap_test_cisu_converter.py | 6 +- 8 files changed, 9 insertions(+), 211 deletions(-) delete mode 100644 converter/converter/cisu/location_kind_deprecated_nomenclature.csv delete mode 100644 converter/converter/cisu/location_kind_updated_nomenclature.csv diff --git a/converter/converter/cisu/cisu_converter.py b/converter/converter/cisu/cisu_converter.py index 235ce4a4fd..a2b934f7d0 100644 --- a/converter/converter/cisu/cisu_converter.py +++ b/converter/converter/cisu/cisu_converter.py @@ -8,7 +8,7 @@ from converter.constants import Constants -from .utils import add_to_initial_alert_notes, update_health_motive_code, update_location_kind_code +from .utils import add_to_initial_alert_notes, update_health_motive_code from ..utils import delete_paths, get_field_value, get_recipient, get_sender, is_field_completed, translate_key_words class CISUConverterV3: @@ -150,11 +150,8 @@ def add_object_to_medical_notes(json_data: Dict[str, Any], note_text: str, sende output_use_case_json['owner'] = get_recipient(input_json) if cls.target_version != Constants.V3_VERSION: - is_code_deprecated = True # /!\ it must be done before copying qualification - update_health_motive_code(output_use_case_json, is_code_deprecated) - update_location_kind_code(output_use_case_json, is_code_deprecated) - + update_health_motive_code(output_use_case_json, True) set_default_location_freetext(output_use_case_json) add_location_detail(output_use_case_json) @@ -253,9 +250,7 @@ def add_default_external_info_type(json_data: Dict[str,Any]): output_usecase_json['qualification']['whatsHappen'] = cls.DEFAULT_WHATS_HAPPEN # /!\ it must be done before copying qualification - is_code_deprecated = False - update_health_motive_code(output_usecase_json, is_code_deprecated) - update_location_kind_code(output_usecase_json, is_code_deprecated) + update_health_motive_code(output_usecase_json, False) add_default_external_info_type(output_usecase_json) diff --git a/converter/converter/cisu/constants.py b/converter/converter/cisu/constants.py index aa142e3f99..df9e13f8ee 100644 --- a/converter/converter/cisu/constants.py +++ b/converter/converter/cisu/constants.py @@ -1,12 +1,6 @@ class Constants: - CSV_DELIMITER = ';' - MRSM_CISU_UPDATED_NOMENCLATURE_FILE = './mrms_cisu_updated_nomenclature.csv' MR0_LABEL = "CodeCisuMR0" MR1_LABEL = "CodeCisuMR1" OLD_MR_LABEL = "CodeCisu V1.3" - - LOCATION_KIND_CISU_UPDATED_NOMENCLATURE_FILE = './location_kind_updated_nomenclature.csv' - LOCATION_KIND_CISU_DEPRECATED_NOMENCLATURE_FILE = './location_kind_deprecated_nomenclature.csv' - OLD_LOCATION_KIND_LABEL = "CodeCisu V1.3" - NEW_LOCATION_KIND_LABEL = "CodeCisu V2.0" + CSV_DELIMITER = ';' diff --git a/converter/converter/cisu/location_kind_deprecated_nomenclature.csv b/converter/converter/cisu/location_kind_deprecated_nomenclature.csv deleted file mode 100644 index 1b737b88a7..0000000000 --- a/converter/converter/cisu/location_kind_deprecated_nomenclature.csv +++ /dev/null @@ -1,103 +0,0 @@ -CodeCisu V1.3;CodeCisu V2.0 -L01.01.00;L01.01.05 -L01.02.00;L01.02.12 -L01.02.12;L01.02.13 -L01.02.00;L01.02.14 -L01.03.00;L01.03.04 -L01.03.00;L01.03.05 -L01.03.00;L01.03.06 -L02.01.00;L02.01.01 -L02.01.00;L02.01.02 -L02.01.00;L02.01.03 -L02.02.05;L02.02.04 -L02.02.00;L02.02.05 -L02.03.00;L02.03.03 -L02.03.00;L02.03.04 -L02.04.00;L02.04.01 -L02.04.00;L02.04.02 -L02.06.00;L02.06.07 -L02.06.00;L02.06.08 -L02.07.00;L02.07.02 -L02.07.02;L02.07.03 -L02.07.00;L02.07.04 -L02.07.00;L02.07.05 -L02.07.00;L02.07.06 -L02.08.00;L02.08.00 -L02.08.00;L02.08.01 -L02.08.00;L02.08.02 -L02.08.00;L02.09.00 -L02.08.00;L02.09.01 -L02.08.00;L02.09.02 -L02.08.00;L02.09.03 -L03.02.00;L03.02.01 -L03.02.00;L03.02.02 -L04.06.00;L04.06.06 -L04.07.00;L04.07.04 -L04.09.00;L04.09.03 -L04.11.00;L04.11.05 -L04.13.00;L04.13.05 -L05.01.01;L05.01.01 -L05.01.00;L05.01.02 -L05.01.00;L05.01.03 -L05.01.03;L05.02.00 -L05.02.00;L05.03.00 -L05.02.01;L05.03.01 -L05.02.02;L05.03.02 -L05.02.03;L05.03.03 -L05.02.04;L05.03.04 -L05.01.04;L05.03.05 -L05.03.00;L05.04.00 -L05.03.01;L05.04.01 -L05.03.02;L05.04.02 -L05.03.00;L05.04.03 -L05.04.02;L05.04.04 -L05.04.01;L05.04.05 -L05.04.00;L05.05.00 -L05.04.01;L05.05.01 -L05.04.02;L05.05.02 -L05.04.04;L05.05.03 -L05.04.05;L05.05.04 -L05.04.06;L05.05.05 -L05.04.00;L05.05.06 -L05.05.00;L05.06.00 -L05.06.00;L05.07.00 -L05.07.00;L05.08.00 -L06.01.00;L06.01.08 -L06.01.00;L06.01.09 -L06.01.08;L06.01.10 -L07.00.00;L06.02.00 -L07.00.00;L06.03.00 -L07.00.00;L06.03.01 -L07.00.00;L06.03.02 -L07.00.00;L06.03.03 -L07.00.00;L06.04.00 -L06.02.00;L06.05.00 -L06.02.00;L06.05.01 -L06.02.00;L06.05.02 -L06.02.00;L06.05.03 -L06.02.00;L06.05.04 -L06.02.00;L06.05.05 -L06.02.00;L06.05.06 -L06.02.00;L06.05.07 -L06.02.00;L06.05.08 -L06.02.00;L06.05.09 -L06.03.00;L06.06.00 -L06.03.01;L06.06.01 -L06.03.02;L06.06.02 -L06.03.03;L06.06.03 -L06.03.04;L06.06.04 -L06.03.05;L06.06.05 -L06.04.00;L06.07.00 -L06.05.00;L06.08.00 -L06.05.01;L06.08.01 -L06.05.02;L06.08.02 -L06.06.00;L06.09.00 -L06.06.01;L06.09.01 -L06.06.02;L06.09.02 -L06.06.03;L06.09.03 -L02.06.07;L06.09.04 -L06.06.04;L06.09.05 -L06.07.00;L06.10.00 -L06.07.01;L06.10.01 -L06.07.02;L06.10.02 -L07.00.00;L07.00.00 diff --git a/converter/converter/cisu/location_kind_updated_nomenclature.csv b/converter/converter/cisu/location_kind_updated_nomenclature.csv deleted file mode 100644 index 09a5ce3e3c..0000000000 --- a/converter/converter/cisu/location_kind_updated_nomenclature.csv +++ /dev/null @@ -1,57 +0,0 @@ -CodeCisu V1.3;CodeCisu V2.0 -L01.02.12;L01.02.13 -L02.02.04;L02.02.00 -L02.02.05;L02.02.04 -L02.03.03;L02.03.00 -L02.06.07;L06.09.04 -L02.06.08;L02.06.00 -L02.07.02;L02.07.03 -L02.08.00;L02.09.00 -L03.04.00;L03.00.00 -L03.05.00;L03.04.00 -L05.01.01;L05.01.01 -L05.01.02;L05.01.01 -L05.01.03;L05.02.00 -L05.01.04;L05.03.05 -L05.02.00;L05.03.00 -L05.02.01;L05.03.01 -L05.02.02;L05.03.02 -L05.02.03;L05.03.03 -L05.02.04;L05.03.04 -L05.03.00;L05.04.00 -L05.03.01;L05.04.01 -L05.03.02;L05.04.02 -L05.04.00;L05.05.00 -L05.04.01;L05.05.01 -L05.04.02;L05.05.02 -L05.04.03;L05.05.00 -L05.04.04;L05.05.03 -L05.04.05;L05.05.04 -L05.04.06;L05.05.05 -L05.05.00;L05.06.00 -L05.06.00;L05.07.00 -L05.07.00;L05.08.00 -L06.01.08;L06.01.10 -L06.02.00;L06.05.00 -L06.03.00;L06.06.00 -L06.03.01;L06.06.01 -L06.03.02;L06.06.02 -L06.03.03;L06.06.03 -L06.03.04;L06.06.04 -L06.03.05;L06.06.05 -L06.04.00;L06.07.00 -L06.05.00;L06.08.00 -L06.05.01;L06.08.01 -L06.05.02;L06.08.02 -L06.06.00;L06.09.00 -L06.06.01;L06.09.01 -L06.06.02;L06.09.02 -L06.06.03;L06.09.03 -L06.06.04;L06.09.05 -L06.07.00;L06.10.00 -L06.07.01;L06.10.01 -L06.07.02;L06.10.02 -L07.00.00;L07.00.00 -L07.01.00;L07.00.00 -L07.01.01;L07.00.00 -L07.02.00;L07.00.00 diff --git a/converter/converter/cisu/utils.py b/converter/converter/cisu/utils.py index 4d8c1d2498..165da04663 100644 --- a/converter/converter/cisu/utils.py +++ b/converter/converter/cisu/utils.py @@ -67,34 +67,3 @@ def update_health_motive_code(json_data: Dict[str, Any], isCodeDeprecated: bool) 'code': updated_health_motive_code, 'label': get_field_value(json_data, '$.qualification.healthMotive.label') } - -def get_deprecated_code_cisu_from_location_type(location_type_code: str) -> str: - return find_in_cisu_nomenclature( - location_type_code, - [Constants.NEW_LOCATION_KIND_LABEL], - Constants.OLD_LOCATION_KIND_LABEL, - Constants.LOCATION_KIND_CISU_DEPRECATED_NOMENCLATURE_FILE - ) - -def get_code_new_cisu_from_location_type(location_type_code: str) -> str: - return find_in_cisu_nomenclature( - location_type_code, - [Constants.OLD_LOCATION_KIND_LABEL], - Constants.NEW_LOCATION_KIND_LABEL, - Constants.LOCATION_KIND_CISU_UPDATED_NOMENCLATURE_FILE - ) - -def update_location_kind_code(json_data: Dict[str, Any], isCodeDeprecated: bool): - location_kind_code = get_field_value(json_data, '$.qualification.locationKind.code') - - if location_kind_code is not None: - if isCodeDeprecated: - updated_location_kind_code = get_deprecated_code_cisu_from_location_type(location_kind_code) - else: - updated_location_kind_code = get_code_new_cisu_from_location_type(location_kind_code) - - if updated_location_kind_code is not None: - json_data['qualification']['locationKind'] = { - 'code': updated_location_kind_code, - 'label': get_field_value(json_data, '$.qualification.locationKind.label') - } diff --git a/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json b/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json index 591803a6e7..4fcd512cc2 100644 --- a/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json +++ b/converter/tests/fixtures/RC-EDA/RC-EDA_exhaustive_fill.json @@ -19,7 +19,7 @@ "count": "1" }, "locationKind": { - "code": "L06.02.00", + "code": "L04.02.00", "label": "Centre commercial / magasin" }, "riskThreat": [ diff --git a/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json b/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json index 3092e42fab..a51e70b94d 100644 --- a/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json +++ b/converter/tests/fixtures/RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json @@ -8,7 +8,7 @@ "label": "Atteinte aux personnes ; Traumatisme / Accident ; Accident domestique" }, "locationKind": { - "code": "L01.02.12", + "code": "L01.02.10", "label": "Domicile ; Lieu d'habitation collectif ou foyer d'hébergement ; escaliers" }, "healthMotive": { diff --git a/converter/tests/snapshots/snap_test_cisu_converter.py b/converter/tests/snapshots/snap_test_cisu_converter.py index 61f5b825df..a80dbaf9e3 100644 --- a/converter/tests/snapshots/snap_test_cisu_converter.py +++ b/converter/tests/snapshots/snap_test_cisu_converter.py @@ -220,7 +220,7 @@ "label": "Autre probl\\u00e8me obst\\u00e9trique non h\\u00e9morragique" }, "locationKind": { - "code": "L07.00.00", + "code": "L04.02.00", "label": "Centre commercial / magasin" }, "riskThreat": [ @@ -651,7 +651,7 @@ "label": "Atteinte aux personnes ; Traumatisme / Accident ; Accident domestique" }, "locationKind": { - "code": "L01.02.13", + "code": "L01.02.10", "label": "Domicile ; Lieu d\'habitation collectif ou foyer d\'h\\u00e9bergement ; escaliers" }, "healthMotive": { @@ -760,7 +760,7 @@ "label": "Atteinte aux personnes ; Traumatisme / Accident ; Accident domestique" }, "locationKind": { - "code": "L01.02.13", + "code": "L01.02.10", "label": "Domicile ; Lieu d\'habitation collectif ou foyer d\'h\\u00e9bergement ; escaliers" }, "healthMotive": { From e02ca8214d6d0bd9c3ce40b03d5c0f5582097f08 Mon Sep 17 00:00:00 2001 From: muffoltz <99671294+muffoltz@users.noreply.github.com> Date: Mon, 15 Sep 2025 16:36:22 +0200 Subject: [PATCH 11/11] feat(converter): fix issue with target_version wrongly initialised --- converter/converter/cisu/cisu_converter.py | 6 ++-- .../cisu_conversion_strategy.py | 2 +- converter/tests/test_cisu_converter.py | 29 +++++++------------ 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/converter/converter/cisu/cisu_converter.py b/converter/converter/cisu/cisu_converter.py index a2b934f7d0..ba63ec54d0 100644 --- a/converter/converter/cisu/cisu_converter.py +++ b/converter/converter/cisu/cisu_converter.py @@ -13,7 +13,6 @@ class CISUConverterV3: # Todo: revert change when all editors use the new CISU nomenclature or are in V3 or above - target_version="" def __init__(self, target_version: str): self.target_version = target_version @@ -67,7 +66,7 @@ def __init__(self, target_version: str): DEFAULT_WHATS_HAPPEN = {"code": "C11.06.00", "label":"Autre nature de fait"} @classmethod - def from_cisu(cls, input_json: Dict[str, Any]) -> Dict[str, Any]: + def from_cisu(cls, input_json: Dict[str, Any], target_version: str) -> Dict[str, Any]: """ Convert from CISU to Health format @@ -148,8 +147,7 @@ def add_object_to_medical_notes(json_data: Dict[str, Any], note_text: str, sende # - Updates output_use_case_json['owner'] = get_recipient(input_json) - - if cls.target_version != Constants.V3_VERSION: + if target_version != Constants.V3_VERSION: # /!\ it must be done before copying qualification update_health_motive_code(output_use_case_json, True) diff --git a/converter/converter/conversion_strategy/cisu_conversion_strategy.py b/converter/converter/conversion_strategy/cisu_conversion_strategy.py index ab14f2779e..12ae7684a0 100644 --- a/converter/converter/conversion_strategy/cisu_conversion_strategy.py +++ b/converter/converter/conversion_strategy/cisu_conversion_strategy.py @@ -30,7 +30,7 @@ def cisu_conversion_strategy(edxl_json, source_version, target_version): if source_version != MAINTAINED_CISU_VERSION: raise ValueError(f"Unknown source version {source_version}. Must be: {MAINTAINED_CISU_VERSION}") - rc_json_message = CISUConverterV3(target_version).from_cisu(edxl_json) + rc_json_message = CISUConverterV3.from_cisu(edxl_json, target_version) return health_conversion_strategy(rc_json_message, MAINTAINED_CISU_VERSION, target_version) else: raise ValueError('Invalid direction parameter') diff --git a/converter/tests/test_cisu_converter.py b/converter/tests/test_cisu_converter.py index aa275b0a3a..8e90b972f8 100644 --- a/converter/tests/test_cisu_converter.py +++ b/converter/tests/test_cisu_converter.py @@ -22,7 +22,7 @@ def validate_health_format(result): TestHelper.conversion_tests_runner( sample_dir=Constants.RC_EDA_TAG, envelope_file=Constants.EDXL_FIRE_TO_HEALTH_ENVELOPE_PATH, - converter_method=CISUConverterV3(Constants.V1_VERSION).from_cisu, + converter_method=lambda edxl_json: CISUConverterV3.from_cisu(edxl_json, Constants.V1_VERSION), target_schema=RS_EDA_SCHEMA, additional_validation=validate_health_format ) @@ -32,7 +32,7 @@ def test_to_cisu_conversion_local(): TestHelper.conversion_tests_runner( sample_dir=Constants.RS_EDA_TAG, envelope_file=Constants.EDXL_HEALTH_TO_FIRE_ENVELOPE_PATH, - converter_method=CISUConverterV3(Constants.V1_VERSION).to_cisu, + converter_method=CISUConverterV3.to_cisu, target_schema=RC_EDA_SCHEMA ) @@ -44,7 +44,7 @@ def validate_health_format(result): TestHelper.conversion_tests_runner( sample_dir=Constants.RC_EDA_TAG, envelope_file=Constants.EDXL_FIRE_TO_HEALTH_ENVELOPE_PATH, - converter_method=CISUConverterV3(Constants.V3_VERSION).from_cisu, + converter_method=lambda edxl_json: CISUConverterV3.from_cisu(edxl_json, Constants.V3_VERSION), target_schema=RS_EDA_SCHEMA, additional_validation=validate_health_format, online_tag="main" # ToDo: migrate to "v3" once tag is available @@ -55,7 +55,7 @@ def test_to_cisu_conversion_v3(): TestHelper.conversion_tests_runner( sample_dir=Constants.RS_EDA_TAG, envelope_file=Constants.EDXL_HEALTH_TO_FIRE_ENVELOPE_PATH, - converter_method=CISUConverterV3(Constants.V3_VERSION).to_cisu, + converter_method=CISUConverterV3.to_cisu, target_schema=RC_EDA_SCHEMA, online_tag="main" # ToDo: migrate to "v3" once tag is available ) @@ -76,9 +76,8 @@ def test_snapshot_RS_EDA_exhaustive_message(self, mock_choices, mock_now): mock_choices.choices.return_value = "f5de" message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_health_to_fire_path, self.fixtures_folder_path + "RS-EDA/cisu_case/RS-EDA_exhaustive_fill.json") - converter = CISUConverterV3(Constants.V1_VERSION) - output_data = converter.to_cisu(message) + output_data = CISUConverterV3.to_cisu(message) self.assertMatchSnapshot(json.dumps(output_data, indent=2)) @patch('converter.cisu.cisu_converter.random') @@ -86,9 +85,8 @@ def test_snapshot_RC_EDA_exhaustive_message(self, mock_choices): mock_choices.choices.side_effect = ["f5de7hj", "a3b2YH8", "c9d8jk9","he9i0kz"] message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_fire_to_health_path, self.fixtures_folder_path + "RC-EDA/RC-EDA_exhaustive_fill.json") - converter = CISUConverterV3(Constants.V1_VERSION) - output_data = converter.from_cisu(message) + output_data = CISUConverterV3.from_cisu(message, Constants.V1_VERSION) self.assertMatchSnapshot(json.dumps(output_data, indent=2)) @patch("converter.cisu.cisu_converter.datetime") @@ -100,9 +98,8 @@ def test_snapshot_RS_EDA_required_field_message(self,mock_choices, mock_now): mock_choices.choices.return_value = "f5de" message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_health_to_fire_path, self.fixtures_folder_path + "RS-EDA/cisu_case/RS-EDA_required_fields.json") - converter = CISUConverterV3(Constants.V1_VERSION) - output_data = converter.to_cisu(message) + output_data = CISUConverterV3.to_cisu(message) self.assertMatchSnapshot(json.dumps(output_data, indent=2)) @patch('converter.cisu.cisu_converter.random') @@ -110,9 +107,8 @@ def test_snapshot_RC_EDA_required_field_message(self, mock_choices): mock_choices.choices.side_effect = ["f5de7hj", "a3b2YH8", "c9d8jk9","he9i0kz"] message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_fire_to_health_path, self.fixtures_folder_path + "RC-EDA/RC-EDA_required_fields.json") - converter = CISUConverterV3(Constants.V1_VERSION) - output_data = converter.from_cisu(message) + output_data = CISUConverterV3.from_cisu(message, Constants.V1_VERSION) self.assertMatchSnapshot(json.dumps(output_data, indent=2)) @@ -125,9 +121,8 @@ def test_snapshot_RS_EDA_exhaustive_bis_message(self,mock_choices, mock_now): mock_choices.choices.return_value = "f5de" message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_health_to_fire_path, self.fixtures_folder_path + "RS-EDA/cisu_case/RS-EDA_exhaustive_fill_bis.json") - converter = CISUConverterV3(Constants.V1_VERSION) - output_data = converter.to_cisu(message) + output_data = CISUConverterV3.to_cisu(message) self.assertMatchSnapshot(json.dumps(output_data, indent=2)) @patch('converter.cisu.cisu_converter.random') @@ -135,16 +130,14 @@ def test_snapshot_RC_EDA_exhaustive_bis_message(self, mock_choices): mock_choices.choices.side_effect = ["f5de7hj", "a3b2YH8", "c9d8jk9","he9i0kz"] message = TestHelper.create_edxl_json_from_sample(self.edxl_envelope_fire_to_health_path, self.fixtures_folder_path + "RC-EDA/RC-EDA_exhaustive_fill_bis.json") - converter = CISUConverterV3(Constants.V1_VERSION) - - output_data = converter.from_cisu(message) + output_data = CISUConverterV3.from_cisu(message, Constants.V1_VERSION) self.assertMatchSnapshot(json.dumps(output_data, indent=2)) class TestVictimsCount(TestCase): def setUp(self): self.fixtures_folder_path = "tests/fixtures/" - self.converter = CISUConverterV3(Constants.V1_VERSION) + self.converter = CISUConverterV3 def test_count_victims_1(self):