diff --git a/lambdas/services/bulk_upload_metadata_service.py b/lambdas/services/bulk_upload_metadata_service.py index a4c55b72b..4a31120a1 100644 --- a/lambdas/services/bulk_upload_metadata_service.py +++ b/lambdas/services/bulk_upload_metadata_service.py @@ -74,7 +74,9 @@ def csv_to_staging_metadata(csv_file_path: str) -> list[StagingMetadata]: logger.info("Parsing bulk upload metadata") patients = {} - with open(csv_file_path, mode="r") as csv_file_handler: + with open( + csv_file_path, mode="r", encoding="utf-8", errors="replace" + ) as csv_file_handler: csv_reader: Iterable[dict] = csv.DictReader(csv_file_handler) for row in csv_reader: file_metadata = MetadataFile.model_validate(row) diff --git a/lambdas/tests/unit/utils/test_lloyd_george_validator.py b/lambdas/tests/unit/utils/test_lloyd_george_validator.py index f6ab44300..9019ae3b0 100644 --- a/lambdas/tests/unit/utils/test_lloyd_george_validator.py +++ b/lambdas/tests/unit/utils/test_lloyd_george_validator.py @@ -331,7 +331,7 @@ def test_validate_name_with_wrong_first_name(mocker, mock_pds_patient): validate_patient_name_using_full_name_history( lg_file_patient_name, mock_pds_patient ) - assert mock_validate_name.call_count == 2 + assert mock_validate_name.call_count == 3 def test_validate_name_with_wrong_family_name(mocker, mock_pds_patient): @@ -344,7 +344,7 @@ def test_validate_name_with_wrong_family_name(mocker, mock_pds_patient): validate_patient_name_using_full_name_history( lg_file_patient_name, mock_pds_patient ) - assert mock_validate_name.call_count == 2 + assert mock_validate_name.call_count == 3 def test_validate_name_with_historical_name(mocker, mock_pds_patient): diff --git a/lambdas/utils/lloyd_george_validator.py b/lambdas/utils/lloyd_george_validator.py index 805696173..d44ff154c 100644 --- a/lambdas/utils/lloyd_george_validator.py +++ b/lambdas/utils/lloyd_george_validator.py @@ -190,8 +190,6 @@ def validate_patient_name_using_full_name_history( ) for name in pds_patient_details.name: - if name.use == "usual": - continue historic_first_name_in_pds: str = name.given[0] historic_family_name_in_pds = name.family if validate_patient_name(