Skip to content

Commit 04dd148

Browse files
committed
Remove New
1 parent 2fa6e53 commit 04dd148

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

delta_backend/src/delta.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ def handler(event, context):
6868
supplier_system = new_image["SupplierSystem"]["S"]
6969
if supplier_system not in ("DPSFULL", "DPSREDUCED"):
7070
operation = new_image["Operation"]["S"]
71-
action_flag = "NEW" if operation == "Create" else operation
71+
# TODO check NEW is correct
72+
# action_flag = "NEW" if operation == "CREATE" else operation
73+
action_flag = operation
7274
resource_json = json.loads(new_image["Resource"]["S"])
7375
FHIRConverter = Converter(json.dumps(resource_json))
7476
flat_json = FHIRConverter.runConversion(resource_json) # Get the flat JSON

delta_backend/tests/test_convert_to_flat_json.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,16 @@ def assert_dynamodb_record(self, operation_flag, items, expected_values, expecte
122122
self.assertGreater(len(filtered_items), 0, f"No matching item found for {operation_flag}")
123123

124124
imms_data = filtered_items[0]["Imms"]
125-
self.assertIsInstance(imms_data, str)
125+
self.assertIsInstance(imms_data, dict)
126126
self.assertGreater(len(imms_data), 0)
127127

128128
# Check Imms JSON structure matches exactly
129-
self.assertEqual(imms_data, str(expected_imms), "Imms data does not match expected JSON structure")
129+
# self.assertEqual(imms_data, expected_imms, "Imms data does not match expected JSON structure")
130+
for key, expected_value in expected_imms.items():
131+
actual = imms_data.get(key)
132+
print(f"Key: {key}, Actual: {actual}, Expected: {expected_value}")
133+
self.assertEqual(actual, expected_value, f"{key} mismatch")
134+
130135

131136
for key, expected_value in expected_values.items():
132137
self.assertIn(key, filtered_items[0], f"{key} is missing")
@@ -166,8 +171,8 @@ def test_fhir_converter_json_error_scenario(self):
166171
def test_handler_imms_convert_to_flat_json(self):
167172
"""Test that the Imms field contains the correct flat JSON data for CREATE, UPDATE, and DELETE operations."""
168173
expected_action_flags = [
169-
# {"Operation": "CREATE", "EXPECTED_ACTION_FLAG": "NEW"},
170-
# {"Operation": "UPDATE", "EXPECTED_ACTION_FLAG": "UPDATE"},
174+
{"Operation": "CREATE", "EXPECTED_ACTION_FLAG": "CREATE"},
175+
{"Operation": "UPDATE", "EXPECTED_ACTION_FLAG": "UPDATE"},
171176
{"Operation": "DELETE", "EXPECTED_ACTION_FLAG": "DELETE"},
172177
]
173178

0 commit comments

Comments
 (0)