|
12 | 12 | # Converter |
13 | 13 | class Converter: |
14 | 14 |
|
15 | | - def __init__(self, fhir_data, summarise=False, report_unexpected_exception=True): |
| 15 | + def __init__(self, fhir_data, action_flag = "UPDATE", summarise=False, report_unexpected_exception=True): |
16 | 16 | self.converted = {} |
17 | 17 | self.error_records = [] |
| 18 | + self.action_flag = action_flag |
18 | 19 | self.fhir_data = fhir_data |
19 | 20 | self.summarise = summarise |
20 | 21 | self.report_unexpected_exception = report_unexpected_exception |
@@ -59,11 +60,13 @@ def _convertData(self, expression): |
59 | 60 | ### TODO: Remove this after refactoring all fields to be extracted with the Extractor |
60 | 61 | values = self.data_parser.get_key_value(fhir_field, flat_field, expr_type, expr_rule) |
61 | 62 | ### |
62 | | - |
63 | | - for val in values: |
64 | | - converted = self.conversion_checker.convertData(expr_type, expr_rule, fhir_field, val) |
65 | | - if converted is not None: |
66 | | - self.converted[flat_field] = converted |
| 63 | + if flat_field == "ACTION_FLAG": |
| 64 | + self.converted[flat_field] = self.action_flag |
| 65 | + else: |
| 66 | + for val in values: |
| 67 | + converted = self.conversion_checker.convertData(expr_type, expr_rule, fhir_field, val) |
| 68 | + if converted is not None: |
| 69 | + self.converted[flat_field] = converted |
67 | 70 |
|
68 | 71 | except Exception as e: |
69 | 72 | return self._log_error(f"Conversion error [{e.__class__.__name__}]: {e}", code=exception_messages.PARSING_ERROR) |
|
0 commit comments