Skip to content

Commit

Permalink
[PRMP-1376] refactor error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
NogaNHS committed Jan 21, 2025
1 parent 8c30e11 commit 2bb3801
Showing 1 changed file with 17 additions and 26 deletions.
43 changes: 17 additions & 26 deletions lambdas/services/bulk_upload_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,33 +143,24 @@ def handle_sqs_message(self, message: dict):
accepted_reason = self.concatenate_acceptance_reason(
accepted_reason, "Patient matched on historical name"
)
if name_validation_score == ValidationScore.PARTIAL_MATCH and is_dob_valid:
accepted_reason = self.concatenate_acceptance_reason(
accepted_reason, "Patient matched on partial match 2/3"
)
elif (
name_validation_score == ValidationScore.MIXED_FULL_MATCH
and is_dob_valid
):
accepted_reason = self.concatenate_acceptance_reason(
accepted_reason, "Patient matched on mixed match 3/3"
)
elif name_validation_score == ValidationScore.FULL_MATCH and is_dob_valid:
accepted_reason = self.concatenate_acceptance_reason(
accepted_reason, "Patient matched on full match 3/3"
)
elif (
name_validation_score == ValidationScore.MIXED_FULL_MATCH
and not is_dob_valid
):
accepted_reason = self.concatenate_acceptance_reason(
accepted_reason, "Patient matched on mixed match 2/3"
)
elif (
name_validation_score == ValidationScore.FULL_MATCH and not is_dob_valid
):
validation_messages = {
ValidationScore.PARTIAL_MATCH: {
True: "Patient matched on partial match 2/3",
False: "",
},
ValidationScore.MIXED_FULL_MATCH: {
True: "Patient matched on mixed match 3/3",
False: "Patient matched on mixed match 2/3",
},
ValidationScore.FULL_MATCH: {
True: "Patient matched on full match 3/3",
False: "Patient matched on full match 2/3",
},
}
if name_validation_score in validation_messages:
message = validation_messages[name_validation_score][is_dob_valid]
accepted_reason = self.concatenate_acceptance_reason(
accepted_reason, "Patient matched on full match 2/3"
accepted_reason, message
)
if not allowed_to_ingest_ods_code(patient_ods_code):
raise LGInvalidFilesException("Patient not registered at your practice")
Expand Down

0 comments on commit 2bb3801

Please sign in to comment.