diff --git a/recordprocessor/src/batch_processing.py b/recordprocessor/src/batch_processing.py index c481b3ee..13063f0c 100644 --- a/recordprocessor/src/batch_processing.py +++ b/recordprocessor/src/batch_processing.py @@ -1,7 +1,7 @@ """Functions for processing the file on a row-by-row basis""" import json -from io import StringIO +# from io import StringIO import os import time import logging @@ -12,7 +12,7 @@ from get_operation_permissions import get_operation_permissions from process_row import process_row from mappings import Vaccine -from update_ack_file import update_ack_file +# from update_ack_file import update_ack_file from send_to_kinesis import send_to_kinesis @@ -61,8 +61,8 @@ def process_csv_to_fhir(incoming_message_body: dict) -> None: make_and_upload_ack_file( file_id, file_key, True, True, created_at_formatted_string ) - accumulated_ack_file_content = StringIO() - accumulated_ack_file_content.write("|".join(Constants.ack_headers) + "\n") + # accumulated_ack_file_content = StringIO() + # accumulated_ack_file_content.write("|".join(Constants.ack_headers) + "\n") row_count = 0 # Initialize a counter for rows for row in csv_reader: @@ -81,22 +81,22 @@ def process_csv_to_fhir(incoming_message_body: dict) -> None: } # Send to kinesis. Add diagnostics if send fails. - message_delivered = send_to_kinesis(supplier, outgoing_message_body) - if ( - diagnostics := details_from_processing.get("diagnostics") - ) is None and message_delivered is False: - diagnostics = "Unsupported file type received as an attachment" + send_to_kinesis(supplier, outgoing_message_body) + # if ( + # diagnostics := details_from_processing.get("diagnostics") + # ) is None and message_delivered is False: + # diagnostics = "Unsupported file type received as an attachment" # Update the ack file - accumulated_ack_file_content = update_ack_file( - file_key, - bucket_name, - accumulated_ack_file_content, - row_id, - message_delivered, - diagnostics, - outgoing_message_body.get("imms_id"), - ) + # accumulated_ack_file_content = update_ack_file( + # file_key, + # bucket_name, + # accumulated_ack_file_content, + # row_id, + # message_delivered, + # diagnostics, + # outgoing_message_body.get("imms_id"), + # ) logger.info("Total rows processed: %s", row_count) diff --git a/recordprocessor/tests/test_lambda_e2e.py b/recordprocessor/tests/test_lambda_e2e.py index 50cdba1c..8e61b963 100644 --- a/recordprocessor/tests/test_lambda_e2e.py +++ b/recordprocessor/tests/test_lambda_e2e.py @@ -122,7 +122,7 @@ def make_assertions(self, test_cases): - "{TEST_FILE_ID}#{index+1}|fatal-error" is found in the ack file """ - ack_file_content = self.get_ack_file_content() + # ack_file_content = self.get_ack_file_content() kinesis_records = kinesis_client.get_records(ShardIterator=self.get_shard_iterator(), Limit=10)["Records"] previous_approximate_arrival_time_stamp = yesterday # Initialise with a time prior to the running of the test @@ -152,10 +152,10 @@ def make_assertions(self, test_cases): self.assertIn(key_to_ignore, kinesis_data) kinesis_data.pop(key_to_ignore) self.assertEqual(kinesis_data, expected_kinesis_data) - self.assertIn(f"{TEST_FILE_ID}#{index+1}|OK", ack_file_content) + # self.assertIn(f"{TEST_FILE_ID}#{index+1}|OK", ack_file_content) else: self.assertEqual(kinesis_data, expected_kinesis_data) - self.assertIn(f"{TEST_FILE_ID}#{index+1}|Fatal", ack_file_content) + # self.assertIn(f"{TEST_FILE_ID}#{index+1}|Fatal", ack_file_content) def test_e2e_success(self): """ @@ -304,7 +304,7 @@ def test_e2e_kinesis_failed(self): main(TEST_EVENT_DUMPED) - self.assertIn("Fatal", self.get_ack_file_content()) + # self.assertIn("Fatal", self.get_ack_file_content()) if __name__ == "__main__": diff --git a/recordprocessor/tests/test_processing_lambda.py b/recordprocessor/tests/test_processing_lambda.py index 7b887088..fcc37143 100644 --- a/recordprocessor/tests/test_processing_lambda.py +++ b/recordprocessor/tests/test_processing_lambda.py @@ -187,7 +187,7 @@ def test_process_csv_to_fhir(self, mock_send_to_kinesis): with patch("batch_processing.get_operation_permissions", return_value={"CREATE", "UPDATE", "DELETE"}): process_csv_to_fhir(TEST_EVENT) - self.assert_value_in_ack_file("Success") + # self.assert_value_in_ack_file("Success") mock_send_to_kinesis.assert_called() @patch("batch_processing.send_to_kinesis") @@ -196,7 +196,7 @@ def test_process_csv_to_fhir_(self, mock_send_to_kinesis): process_csv_to_fhir(TEST_EVENT_PERMISSION) - self.assert_value_in_ack_file("Success") + # self.assert_value_in_ack_file("Success") mock_send_to_kinesis.assert_called() @patch("batch_processing.send_to_kinesis") @@ -206,7 +206,7 @@ def test_process_csv_to_fhir_positive_string_provided(self, mock_send_to_kinesis with patch("batch_processing.get_operation_permissions", return_value={"CREATE", "UPDATE", "DELETE"}): process_csv_to_fhir(TEST_EVENT) - self.assert_value_in_ack_file("Success") + # self.assert_value_in_ack_file("Success") mock_send_to_kinesis.assert_called() @patch("batch_processing.send_to_kinesis") @@ -216,7 +216,7 @@ def test_process_csv_to_fhir_only_mandatory(self, mock_send_to_kinesis): with patch("batch_processing.get_operation_permissions", return_value={"CREATE", "UPDATE", "DELETE"}): process_csv_to_fhir(TEST_EVENT) - self.assert_value_in_ack_file("Success") + # self.assert_value_in_ack_file("Success") mock_send_to_kinesis.assert_called() @patch("batch_processing.send_to_kinesis") @@ -226,7 +226,7 @@ def test_process_csv_to_fhir_positive_string_not_provided(self, mock_send_to_kin with patch("batch_processing.get_operation_permissions", return_value={"CREATE", "UPDATE", "DELETE"}): process_csv_to_fhir(TEST_EVENT) - self.assert_value_in_ack_file("Success") + # self.assert_value_in_ack_file("Success") mock_send_to_kinesis.assert_called() @patch("batch_processing.send_to_kinesis") @@ -239,7 +239,7 @@ def test_process_csv_to_fhir_paramter_missing(self, mock_send_to_kinesis): ): process_csv_to_fhir(TEST_EVENT) - self.assert_value_in_ack_file("Fatal") + # self.assert_value_in_ack_file("Fatal") mock_send_to_kinesis.assert_called() @patch("batch_processing.send_to_kinesis") @@ -340,7 +340,7 @@ def test_process_csv_to_fhir_successful(self, mock_send_to_kinesis): mock_csv_reader_instance.__iter__.return_value = iter(TestValues.mock_update_request) process_csv_to_fhir(TEST_EVENT) - self.assert_value_in_ack_file("Success") + # self.assert_value_in_ack_file("Success") mock_send_to_kinesis.assert_called() @patch("batch_processing.send_to_kinesis") @@ -352,7 +352,7 @@ def test_process_csv_to_fhir_incorrect_permissions(self, mock_send_to_kinesis): mock_csv_reader_instance.__iter__.return_value = iter(TestValues.mock_update_request) process_csv_to_fhir(TEST_EVENT) - self.assert_value_in_ack_file("No permissions for requested operation") + # self.assert_value_in_ack_file("No permissions for requested operation") mock_send_to_kinesis.assert_called() def test_get_environment(self):