diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Multi File Upload 1of3-9730786976].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Multi File Upload 1of3-9730786976].json similarity index 92% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Multi File Upload 1of3-9730786976].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Multi File Upload 1of3-9730786976].json index 653f6e2275..8ab7dc8c00 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Multi File Upload 1of3-9730786976].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Multi File Upload 1of3-9730786976].json @@ -1,8 +1,9 @@ { - "_description": "General-Accepted-Multi File Upload 1of3", + "_description": "General-Accept-Multi File Upload 1of3", "bulk_upload_report": { "NhsNumber": "9730786976", "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "UploadStatus": "complete", "UploaderOdsCode": "M85143" }, diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Multi File Upload 2of3-9730786976].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Multi File Upload 2of3-9730786976].json similarity index 92% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Multi File Upload 2of3-9730786976].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Multi File Upload 2of3-9730786976].json index 6ae839f66e..60d0a05323 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Multi File Upload 2of3-9730786976].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Multi File Upload 2of3-9730786976].json @@ -1,8 +1,9 @@ { - "_description": "General-Accepted-Multi File Upload 2of3", + "_description": "General-Accept-Multi File Upload 2of3", "bulk_upload_report": { "NhsNumber": "9730786976", "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "UploadStatus": "complete", "UploaderOdsCode": "M85143" }, diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Multi File Upload 3of3-9730786976].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Multi File Upload 3of3-9730786976].json similarity index 92% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Multi File Upload 3of3-9730786976].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Multi File Upload 3of3-9730786976].json index a5afd9d9c1..be6f071eca 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Multi File Upload 3of3-9730786976].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Multi File Upload 3of3-9730786976].json @@ -1,8 +1,9 @@ { - "_description": "General-Accepted-Multi File Upload 3of3", + "_description": "General-Accept-Multi File Upload 3of3", "bulk_upload_report": { "NhsNumber": "9730786976", "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "UploadStatus": "complete", "UploaderOdsCode": "M85143" }, diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Hyphenated Nhs Number-9730154406].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Hyphenated Nhs Number-9730154406].json similarity index 81% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Hyphenated Nhs Number-9730154406].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Hyphenated Nhs Number-9730154406].json index e36d2dc558..d5a6a6ccc7 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Hyphenated Nhs Number-9730154406].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Hyphenated Nhs Number-9730154406].json @@ -1,8 +1,9 @@ { - "_description": "General-Accepted-Pre-processor Hyphenated Nhs Number", + "_description": "General-Accept-Processed-Hyphenated Nhs Number", "bulk_upload_report": { "NhsNumber": "9730154406", "PdsOdsCode": "H81109", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "UploadStatus": "complete", "UploaderOdsCode": "H81109" }, diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor LloydGeorge Name Edit-9730786925].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-LloydGeorge Name Edit-9730786925].json similarity index 81% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor LloydGeorge Name Edit-9730786925].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-LloydGeorge Name Edit-9730786925].json index 61e2feb0a4..ca2613f091 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor LloydGeorge Name Edit-9730786925].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-LloydGeorge Name Edit-9730786925].json @@ -1,8 +1,9 @@ { - "_description": "General-Accepted-Pre-processor LloydGeorge Name Edit", + "_description": "General-Accept-Processed-LloydGeorge Name Edit", "bulk_upload_report": { "NhsNumber": "9730786925", "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "UploadStatus": "complete", "UploaderOdsCode": "M85143" }, diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Mixed Spacing in Page-9730154775].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Mixed Spacing in Page-9730154775].json similarity index 81% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Mixed Spacing in Page-9730154775].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Mixed Spacing in Page-9730154775].json index addcf354d5..eb6f51d481 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Mixed Spacing in Page-9730154775].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Mixed Spacing in Page-9730154775].json @@ -1,8 +1,9 @@ { - "_description": "General-Accepted-Pre-processor Mixed Spacing in Page", + "_description": "General-Accept-Processed-Mixed Spacing in Page", "bulk_upload_report": { "NhsNumber": "9730154775", "PdsOdsCode": "H81109", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "UploadStatus": "complete", "UploaderOdsCode": "H81109" }, diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Mixed brackets-9730154090].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Mixed brackets-9730154090].json similarity index 81% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Mixed brackets-9730154090].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Mixed brackets-9730154090].json index 89892fb46b..3f2ed5c5f1 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Mixed brackets-9730154090].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Mixed brackets-9730154090].json @@ -1,8 +1,9 @@ { - "_description": "General-Accepted-Pre-processor Mixed brackets", + "_description": "General-Accept-Processed-Mixed brackets", "bulk_upload_report": { "NhsNumber": "9730154090", "PdsOdsCode": "H81109", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "UploadStatus": "complete", "UploaderOdsCode": "H81109" }, diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Spacing Nhs Number-9730154724].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Spacing Nhs Number-9730154724].json similarity index 81% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Spacing Nhs Number-9730154724].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Spacing Nhs Number-9730154724].json index 2f4b0b95d9..9a7706c5e0 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Pre-processor Spacing Nhs Number-9730154724].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Processed-Spacing Nhs Number-9730154724].json @@ -1,8 +1,9 @@ { - "_description": "General-Accepted-Pre-processor Spacing Nhs Number", + "_description": "General-Accept-Processed-Spacing Nhs Number", "bulk_upload_report": { "NhsNumber": "9730154724", "PdsOdsCode": "H81109", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "UploadStatus": "complete", "UploaderOdsCode": "H81109" }, diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Single File Upload-9730787026].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Single File Upload-9730787026].json similarity index 82% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Single File Upload-9730787026].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Single File Upload-9730787026].json index 1d35079351..e8d3bfef17 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accepted-Single File Upload-9730787026].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_general_accepted_ingestions[General-Accept-Single File Upload-9730787026].json @@ -1,8 +1,9 @@ { - "_description": "General-Accepted-Single File Upload", + "_description": "General-Accept-Single File Upload", "bulk_upload_report": { "NhsNumber": "9730787026", "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "UploadStatus": "complete", "UploaderOdsCode": "M85143" }, diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_remap_and_fixed[9730787492-Remap and Fixed].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_remap_and_fixed[9730787492-Remap and Fixed].json index 51f9e24030..a7e2b5836c 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_remap_and_fixed[9730787492-Remap and Fixed].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_remap_and_fixed[9730787492-Remap and Fixed].json @@ -4,6 +4,7 @@ "FilePath": "accept-remap-and-fixed/test/9730787492/1of1_Lloyd_George_Record_[Bob SPEAR]_[9730787492]_[05-08-1968].pdf", "NhsNumber": "9730787492", "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 1 given name", "StoredFileName": "test/9730787492/1of1_Lloyd_George_Record_[Bob SPEAR]_[9730787492]_[05-08-1968].pdf", "UploadStatus": "complete", "UploaderOdsCode": "M85143" diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accepted-1of1 in filename-9730153817].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accept-Processed-9730153817].json similarity index 87% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accepted-1of1 in filename-9730153817].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accept-Processed-9730153817].json index d2f1386d77..0e5b0dd731 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accepted-1of1 in filename-9730153817].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accept-Processed-9730153817].json @@ -1,9 +1,10 @@ { - "_description": "USB-Accepted-1of1 in filename", + "_description": "USB-Accept-Processed", "bulk_upload_report": { "FilePath": "accept-usb/9730153817 Haley Glenda RUDKIN 07-Aug-2023/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9730153817.pdf", "NhsNumber": "9730153817", "PdsOdsCode": "H81109", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "StoredFileName": "9730153817 Haley Glenda RUDKIN 07-Aug-2023/1of1_Lloyd_George_Record_[Haley Glenda RUDKIN]_[9730153817]_[07-08-2023].pdf", "UploadStatus": "complete", "UploaderOdsCode": "M85143" diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accepted-sent straight to queue (skips validation if already valid)-9730153760].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accept-Unprocessed-9730153760].json similarity index 87% rename from lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accepted-sent straight to queue (skips validation if already valid)-9730153760].json rename to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accept-Unprocessed-9730153760].json index b17550672a..a96cd36367 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accepted-sent straight to queue (skips validation if already valid)-9730153760].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_accept_bulk_upload/test_usb_accepted_ingestions[USB-Accept-Unprocessed-9730153760].json @@ -1,9 +1,10 @@ { - "_description": "USB-Accepted-sent straight to queue (skips validation if already valid)", + "_description": "USB-Accept-Unprocessed", "bulk_upload_report": { "FilePath": "accept-usb/9730153760/1of1_Lloyd_George_Record_[Ruby Sandra MANTON]_[9730153760]_[08-01-2003].pdf", "NhsNumber": "9730153760", "PdsOdsCode": "H81109", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "StoredFileName": "9730153760/1of1_Lloyd_George_Record_[Ruby Sandra MANTON]_[9730153760]_[08-01-2003].pdf", "UploadStatus": "complete", "UploaderOdsCode": "M85143" diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-12-General-Reject-Patient Name Mismatch-9730787417].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-12-General-Reject-Patient Name Mismatch-9730787417].json new file mode 100644 index 0000000000..ef62a6a97c --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-12-General-Reject-Patient Name Mismatch-9730787417].json @@ -0,0 +1,35 @@ +{ + "_description": "BULK-12-General-Reject-Patient Name Mismatch", + "bulk_upload_report": { + "FilePath": "reject/test/9730787417/1of1_Lloyd_George_Record_[Notmename Andrew KINNOY]_[9730787417]_[25-12-1999].pdf", + "NhsNumber": "9730787417", + "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 2/3, matched on 1 family_name and 1 given name", + "StoredFileName": "test/9730787417/1of1_Lloyd_George_Record_[Notmename Andrew KINNOY]_[9730787417]_[25-12-1999].pdf", + "UploadStatus": "complete", + "UploaderOdsCode": "M85143" + }, + "metadata": { + "Author": "M85143", + "ContentType": "application/pdf", + "Created": "2026-01-29T10:48:27.285035Z", + "CurrentGpOds": "M85143", + "Custodian": "M85143", + "DocStatus": "final", + "DocumentScanCreation": "2023-01-01", + "DocumentSnomedCodeType": "16521000000101", + "FileLocation": "s3://roga7-lloyd-george-store/9730787417/af702692-a9a0-4d66-8c8c-d02e07bdddd8", + "FileName": "1of1_Lloyd_George_Record_[Notmename Andrew KINNOY]_[9730787417]_[25-12-1999].pdf", + "FileSize": "Decimal('173760')", + "ID": "af702692-a9a0-4d66-8c8c-d02e07bdddd8", + "NhsNumber": "9730787417", + "S3FileKey": "9730787417/af702692-a9a0-4d66-8c8c-d02e07bdddd8", + "S3VersionID": "Xq_UY5JKvtXWEe57ozsEHjXReUzT8.6E", + "Status": "current", + "Uploaded": true, + "Version": "1", + "VirusScannerResult": "Clean" + }, + "review": null, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-13-General-Reject-Missing or Infected File-9730787573].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-13-General-Reject-Missing or Infected File-9730787573].json new file mode 100644 index 0000000000..55bdb7431f --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-13-General-Reject-Missing or Infected File-9730787573].json @@ -0,0 +1,28 @@ +{ + "_description": "BULK-13-General-Reject-Missing or Infected File", + "bulk_upload_report": { + "FilePath": "reject/test/9730787573/1of1_Lloyd_George_Record_[Alan Oscar KERNS]_[9730787573]_[27-08-1971].pdf", + "NhsNumber": "9730787573", + "PdsOdsCode": "M85143", + "Reason": "One or more of the files is not accessible from staging bucket", + "StoredFileName": "test/9730787573/1of1_Lloyd_George_Record_[Alan Oscar KERNS]_[9730787573]_[27-08-1971].pdf", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": { + "Author": "M85143", + "Custodian": "M85143", + "DocumentSnomedCodeType": "16521000000101", + "Files": [ + { + "FileName": "1OF1_Lloyd_George_Record_[Alan Oscar KERNS]_[9730787573]_[27-08-1971].pdf" + } + ], + "NhsNumber": "9730787573", + "ReviewReason": "Unsuccessful upload", + "ReviewStatus": "PENDING_REVIEW", + "Version": "Decimal('1')" + }, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-14-General-Reject-Corrupted File-9730787298].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-14-General-Reject-Corrupted File-9730787298].json new file mode 100644 index 0000000000..11e6071dcc --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-14-General-Reject-Corrupted File-9730787298].json @@ -0,0 +1,15 @@ +{ + "_description": "BULK-14-General-Reject-Corrupted File", + "bulk_upload_report": { + "FilePath": "reject/test/9730787298/1of1_Lloyd_George_Record_[Hazel DOYLE]_[9730787298]_[08-02-2020].pdf", + "NhsNumber": "9730787298", + "PdsOdsCode": "M85143", + "Reason": "One or more of the files were corrupt", + "StoredFileName": "test/9730787298/1of1_Lloyd_George_Record_[Hazel DOYLE]_[9730787298]_[08-02-2020].pdf", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": null, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-3-General-Reject-Missing Files-9730787328].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-3-General-Reject-Missing Files-9730787328].json new file mode 100644 index 0000000000..934d418811 --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-3-General-Reject-Missing Files-9730787328].json @@ -0,0 +1,35 @@ +{ + "_description": "BULK-3-General-Reject-Missing Files", + "bulk_upload_report": { + "FilePath": "reject/test/9730787328/1of1_Lloyd_George_Record_[Agnes Gaynor MULLEN]_[9730787328]_[30-03-2017].pdf", + "NhsNumber": "9730787328", + "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", + "StoredFileName": "test/9730787328/1of1_Lloyd_George_Record_[Agnes Gaynor MULLEN]_[9730787328]_[30-03-2017].pdf", + "UploadStatus": "complete", + "UploaderOdsCode": "M85143" + }, + "metadata": { + "Author": "M85143", + "ContentType": "application/pdf", + "Created": "2026-01-29T10:48:25.403008Z", + "CurrentGpOds": "M85143", + "Custodian": "M85143", + "DocStatus": "final", + "DocumentScanCreation": "2023-01-01", + "DocumentSnomedCodeType": "16521000000101", + "FileLocation": "s3://roga7-lloyd-george-store/9730787328/cf1c6bdb-badc-4031-9d9e-b09cda66b957", + "FileName": "1of1_Lloyd_George_Record_[Agnes Gaynor MULLEN]_[9730787328]_[30-03-2017].pdf", + "FileSize": "Decimal('173760')", + "ID": "cf1c6bdb-badc-4031-9d9e-b09cda66b957", + "NhsNumber": "9730787328", + "S3FileKey": "9730787328/cf1c6bdb-badc-4031-9d9e-b09cda66b957", + "S3VersionID": "4vUekEq_fsJm_YXBLv.bqLcfjiB.mKqm", + "Status": "current", + "Uploaded": true, + "Version": "1", + "VirusScannerResult": "Clean" + }, + "review": null, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-4-General-Reject-More Files than total-9730787735].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-4-General-Reject-More Files than total-9730787735].json new file mode 100644 index 0000000000..59b4052e31 --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-4-General-Reject-More Files than total-9730787735].json @@ -0,0 +1,31 @@ +{ + "_description": "BULK-4-General-Reject-More Files than total", + "bulk_upload_report": { + "FilePath": "reject/test/9730787735/1_of1_LLOYD_George_Record_[Gemma Jeanne HIRD]_[9730787735]_[02-08-1994].pdf", + "NhsNumber": "9730787735", + "PdsOdsCode": "M85143", + "Reason": "There are more files than the total number in file name", + "StoredFileName": "test/9730787735/1of1_Lloyd_George_Record_[Gemma Jeanne HIRD]_[9730787735]_[02-08-1994].pdf", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": { + "Author": "M85143", + "Custodian": "M85143", + "DocumentSnomedCodeType": "16521000000101", + "Files": [ + { + "FileName": "1of1_Lloyd_George_Record_[Gemma Jeanne HIRD]_[9730787735]_[02-08-1994].pdf" + }, + { + "FileName": "1of1_Lloyd_George_Record_[Gemma Jeanne HIRD]_[9730787735]_[02-08-1994].pdf" + } + ], + "NhsNumber": "9730787735", + "ReviewReason": "Unsuccessful upload", + "ReviewStatus": "PENDING_REVIEW", + "Version": "Decimal('1')" + }, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-4-General-Reject-More Files thant total-9730787735].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-4-General-Reject-More Files thant total-9730787735].json new file mode 100644 index 0000000000..05091da1a3 --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-4-General-Reject-More Files thant total-9730787735].json @@ -0,0 +1,31 @@ +{ + "_description": "BULK-4-General-Reject-More Files thant total", + "bulk_upload_report": { + "FilePath": "reject/test/9730787735/1_of1_LLOYD_George_Record_[Gemma Jeanne HIRD]_[9730787735]_[02-08-1994].pdf", + "NhsNumber": "9730787735", + "PdsOdsCode": "M85143", + "Reason": "There are more files than the total number in file name", + "StoredFileName": "test/9730787735/1of1_Lloyd_George_Record_[Gemma Jeanne HIRD]_[9730787735]_[02-08-1994].pdf", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": { + "Author": "M85143", + "Custodian": "M85143", + "DocumentSnomedCodeType": "16521000000101", + "Files": [ + { + "FileName": "1of1_Lloyd_George_Record_[Gemma Jeanne HIRD]_[9730787735]_[02-08-1994].pdf" + }, + { + "FileName": "1of1_Lloyd_George_Record_[Gemma Jeanne HIRD]_[9730787735]_[02-08-1994].pdf" + } + ], + "NhsNumber": "9730787735", + "ReviewReason": "Unsuccessful upload", + "ReviewStatus": "PENDING_REVIEW", + "Version": "Decimal('1')" + }, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-6-General-Reject-NHS Number metadata mismatch-9730787352].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-6-General-Reject-NHS Number metadata mismatch-9730787352].json new file mode 100644 index 0000000000..e0160fceab --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-6-General-Reject-NHS Number metadata mismatch-9730787352].json @@ -0,0 +1,35 @@ +{ + "_description": "BULK-6-General-Reject-NHS Number metadata mismatch", + "bulk_upload_report": { + "FilePath": "reject/test/9730787352/1of1_Lloyd_George_Record_[Clara Kylie HOOD]_[9730787352]_[02-12-2010].pdf", + "NhsNumber": "9730787352", + "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", + "StoredFileName": "test/9730787352/1of1_Lloyd_George_Record_[Clara Kylie HOOD]_[9730787352]_[02-12-2010].pdf", + "UploadStatus": "complete", + "UploaderOdsCode": "M85143" + }, + "metadata": { + "Author": "M85143", + "ContentType": "application/pdf", + "Created": "2026-01-29T10:48:26.220099Z", + "CurrentGpOds": "M85143", + "Custodian": "M85143", + "DocStatus": "final", + "DocumentScanCreation": "2023-01-01", + "DocumentSnomedCodeType": "16521000000101", + "FileLocation": "s3://roga7-lloyd-george-store/9730787352/fe422204-018c-4ced-ae01-a0c96db8b8dc", + "FileName": "1of1_Lloyd_George_Record_[Clara Kylie HOOD]_[9730787352]_[02-12-2010].pdf", + "FileSize": "Decimal('173760')", + "ID": "fe422204-018c-4ced-ae01-a0c96db8b8dc", + "NhsNumber": "9730787352", + "S3FileKey": "9730787352/fe422204-018c-4ced-ae01-a0c96db8b8dc", + "S3VersionID": "_X6pR9iM6NjB3dVTb.La6LX2VBA_JVsK", + "Status": "current", + "Uploaded": true, + "Version": "1", + "VirusScannerResult": "Clean" + }, + "review": null, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-7-General-Reject-Missing Files-97307871820].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-7-General-Reject-Missing Files-97307871820].json new file mode 100644 index 0000000000..e20d17c0ac --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-7-General-Reject-Missing Files-97307871820].json @@ -0,0 +1,31 @@ +{ + "_description": "BULK-7-General-Reject-Missing Files", + "bulk_upload_report": { + "FilePath": "reject/test/9730787182/2of2_Lloyd_George_Record_[Jimmy Oliver LOWERY]_[9730787182]_[15-02-2013].pdf", + "NhsNumber": "9730787182", + "PdsOdsCode": "M85143", + "Reason": "One or more of the files has the same filename", + "StoredFileName": "test/9730787182/2of2_Lloyd_George_Record_[Jimmy Oliver LOWERY]_[9730787182]_[15-02-2013].pdf", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": { + "Author": "M85143", + "Custodian": "M85143", + "DocumentSnomedCodeType": "16521000000101", + "Files": [ + { + "FileName": "2of2_Lloyd_George_Record_[Jimmy Oliver LOWERY]_[9730787182]_[15-02-2013].pdf" + }, + { + "FileName": "2of2_Lloyd_George_Record_[Jimmy Oliver LOWERY]_[9730787182]_[15-02-2013].pdf" + } + ], + "NhsNumber": "9730787182", + "ReviewReason": "Unsuccessful upload", + "ReviewStatus": "PENDING_REVIEW", + "Version": "Decimal('1')" + }, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-7-General-Reject-Missing Files-97307871821].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-7-General-Reject-Missing Files-97307871821].json new file mode 100644 index 0000000000..e20d17c0ac --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-7-General-Reject-Missing Files-97307871821].json @@ -0,0 +1,31 @@ +{ + "_description": "BULK-7-General-Reject-Missing Files", + "bulk_upload_report": { + "FilePath": "reject/test/9730787182/2of2_Lloyd_George_Record_[Jimmy Oliver LOWERY]_[9730787182]_[15-02-2013].pdf", + "NhsNumber": "9730787182", + "PdsOdsCode": "M85143", + "Reason": "One or more of the files has the same filename", + "StoredFileName": "test/9730787182/2of2_Lloyd_George_Record_[Jimmy Oliver LOWERY]_[9730787182]_[15-02-2013].pdf", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": { + "Author": "M85143", + "Custodian": "M85143", + "DocumentSnomedCodeType": "16521000000101", + "Files": [ + { + "FileName": "2of2_Lloyd_George_Record_[Jimmy Oliver LOWERY]_[9730787182]_[15-02-2013].pdf" + }, + { + "FileName": "2of2_Lloyd_George_Record_[Jimmy Oliver LOWERY]_[9730787182]_[15-02-2013].pdf" + } + ], + "NhsNumber": "9730787182", + "ReviewReason": "Unsuccessful upload", + "ReviewStatus": "PENDING_REVIEW", + "Version": "Decimal('1')" + }, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-9-General-Reject-Could not find patient in PDS-9476281359].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-9-General-Reject-Could not find patient in PDS-9476281359].json new file mode 100644 index 0000000000..fe1a03b140 --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[BULK-9-General-Reject-Could not find patient in PDS-9476281359].json @@ -0,0 +1,15 @@ +{ + "_description": "BULK-9-General-Reject-Could not find patient in PDS", + "bulk_upload_report": { + "FilePath": "reject/test/9730787271/1of1_Lloyd_George_Record_[Kate SUMMER]_[9476281359]_[27-08-2019].pdf", + "NhsNumber": "9476281359", + "PdsOdsCode": "", + "Reason": "Could not find the given patient on PDS", + "StoredFileName": "test/9730787271/1of1_Lloyd_George_Record_[Kate SUMMER]_[9476281359]_[27-08-2019].pdf", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": null, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Corrupted-9730788022].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Corrupted-9730788022].json deleted file mode 100644 index 2ed762485b..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Corrupted-9730788022].json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "_description": "General-Rejected-Corrupted", - "bulk_upload_report": { - "FilePath": "reject/test/9730788022/1of1_Lloyd_George_Record_[Cath YOUDS]_[9730788022]_[05-05-1965].pdf", - "NhsNumber": "9730788022", - "PdsOdsCode": "M85143", - "Reason": "One or more of the files were corrupt", - "StoredFileName": "test/9730788022/1of1_Lloyd_George_Record_[Cath YOUDS]_[9730788022]_[05-05-1965].pdf", - "UploadStatus": "failed", - "UploaderOdsCode": "M85143" - }, - "metadata": null, - "unstitched": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Infected-9730788529].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Infected-9730788529].json deleted file mode 100644 index e670fbdd16..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Infected-9730788529].json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "_description": "General-Rejected-Infected", - "bulk_upload_report": { - "FilePath": "reject/1of1_Lloyd_George_Record_[Moses Ivan WELLS]_[9730788529]_[20-03-1994].pdf", - "NhsNumber": "9730788529", - "PdsOdsCode": "M85143", - "Reason": "One or more of the files failed virus scanner check", - "StoredFileName": "1of1_Lloyd_George_Record_[Moses Ivan WELLS]_[9730788529]_[20-03-1994].pdf", - "UploadStatus": "failed", - "UploaderOdsCode": "M85143" - }, - "metadata": null, - "unstitched": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Invalid NHS number-9000000061].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Invalid NHS number-9000000061].json deleted file mode 100644 index 433a06b45a..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Invalid NHS number-9000000061].json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "_description": "General-Rejected-Invalid NHS number", - "bulk_upload_report": { - "FilePath": "01 of 02_Lloyd_George_Record_Jane Stevens_900_000_0001_11.10.2010.pdf", - "NhsNumber": "9000000061", - "PdsOdsCode": "", - "Reason": "Invalid NHS number", - "StoredFileName": "01 of 02_Lloyd_George_Record_Jane Stevens_900_000_0001_11.10.2010.pdf", - "UploadStatus": "failed", - "UploaderOdsCode": "H81109" - }, - "metadata": null, - "unstitched": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Invalid date format-9000000051].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Invalid date format-9000000051].json deleted file mode 100644 index f7d8bb5b75..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Invalid date format-9000000051].json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "_description": "General-Rejected-Invalid date format", - "bulk_upload_report": { - "FilePath": "01 of 02_Lloyd_George_Record_Jaimie Stevens_9000000001_300.4.2010.pdf", - "NhsNumber": "9000000051", - "PdsOdsCode": "", - "Reason": "Could not find a valid date in the filename", - "StoredFileName": "01 of 02_Lloyd_George_Record_Jaimie Stevens_9000000001_300.4.2010.pdf", - "UploadStatus": "failed", - "UploaderOdsCode": "H81109" - }, - "metadata": null, - "unstitched": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Missing 'lloyd george record'-9500000001].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Missing 'lloyd george record'-9500000001].json deleted file mode 100644 index 1acd57e096..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Missing 'lloyd george record'-9500000001].json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "_description": "General-Rejected-Missing 'lloyd george record'", - "bulk_upload_report": { - "FilePath": "1093/01 of 02_Phineas Stevens_9000000001_22.10.2010.pdf", - "NhsNumber": "9500000001", - "PdsOdsCode": "", - "Reason": "Invalid Lloyd_George_Record separator", - "StoredFileName": "1093/01 of 02_Phineas Stevens_9000000001_22.10.2010.pdf", - "UploadStatus": "failed", - "UploaderOdsCode": "H81109" - }, - "metadata": null, - "unstitched": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Nhs Not in PDS-9596333437].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Nhs Not in PDS-9596333437].json deleted file mode 100644 index 5c4a2bca5b..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-Nhs Not in PDS-9596333437].json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "_description": "General-Rejected-Nhs Not in PDS", - "bulk_upload_report": { - "FilePath": "reject/1of1_Lloyd_George_Record_[Josh Lucien PLATT]_[9596333437]_[23-10-1979].pdf", - "NhsNumber": "9596333437", - "PdsOdsCode": "", - "Reason": "Could not find the given patient on PDS", - "StoredFileName": "1of1_Lloyd_George_Record_[Josh Lucien PLATT]_[9596333437]_[23-10-1979].pdf", - "UploadStatus": "failed", - "UploaderOdsCode": "M85143" - }, - "metadata": null, - "unstitched": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-incorrect NHS number or date format - Invalid Format-9000000201].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-incorrect NHS number or date format - Invalid Format-9000000201].json deleted file mode 100644 index e83b4e7a8e..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-incorrect NHS number or date format - Invalid Format-9000000201].json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "_description": "General-Rejected-incorrect NHS number or date format - Invalid Format", - "bulk_upload_report": { - "FilePath": "01 of 02_Lloyd_George_Record_Andrew Stevens_9000000001_12.10.21.pdf", - "NhsNumber": "9000000201", - "PdsOdsCode": "", - "Reason": "Incorrect NHS number or date format", - "StoredFileName": "01 of 02_Lloyd_George_Record_Andrew Stevens_9000000001_12.10.21.pdf", - "UploadStatus": "failed", - "UploaderOdsCode": "H81109" - }, - "metadata": null, - "unstitched": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-incorrect NHS number or date format-9000000071].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-incorrect NHS number or date format-9000000071].json deleted file mode 100644 index 58af9fc7dc..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-incorrect NHS number or date format-9000000071].json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "_description": "General-Rejected-incorrect NHS number or date format", - "bulk_upload_report": { - "FilePath": "01 of 02_Lloyd_George_Record_Patricia Stevens_9000000001_2_11.10.2010.pdf", - "NhsNumber": "9000000071", - "PdsOdsCode": "", - "Reason": "Incorrect NHS number or date format", - "StoredFileName": "01 of 02_Lloyd_George_Record_Patricia Stevens_9000000001_2_11.10.2010.pdf", - "UploadStatus": "failed", - "UploaderOdsCode": "H81109" - }, - "metadata": null, - "unstitched": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-incorrect document path format-9000000081].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-incorrect document path format-9000000081].json deleted file mode 100644 index 3ed24ec7d2..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-incorrect document path format-9000000081].json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "_description": "General-Rejected-incorrect document path format", - "bulk_upload_report": { - "FilePath": "103/01 02_Lloyd_George_Record_Charles Stevens_9000000001_22.10.2010.pdf", - "NhsNumber": "9000000081", - "PdsOdsCode": "", - "Reason": "Incorrect document path format", - "StoredFileName": "103/01 02_Lloyd_George_Record_Charles Stevens_9000000001_22.10.2010.pdf", - "UploadStatus": "failed", - "UploaderOdsCode": "H81109" - }, - "metadata": null, - "unstitched": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-invalid date format - Invalid Month-9000000101].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-invalid date format - Invalid Month-9000000101].json deleted file mode 100644 index c41270c68e..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[General-Rejected-invalid date format - Invalid Month-9000000101].json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "_description": "General-Rejected-invalid date format - Invalid Month", - "bulk_upload_report": { - "FilePath": "01 of 02_Lloyd_George_Record_Steph Stevens_9000000001_12.25.2010.pdf", - "NhsNumber": "9000000101", - "PdsOdsCode": "", - "Reason": "Invalid date format", - "StoredFileName": "01 of 02_Lloyd_George_Record_Steph Stevens_9000000001_12.25.2010.pdf", - "UploadStatus": "failed", - "UploaderOdsCode": "H81109" - }, - "metadata": null, - "unstitched": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-10-General-Reject-Invalid File Extension-9730787611].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-10-General-Reject-Invalid File Extension-9730787611].json new file mode 100644 index 0000000000..1c79e76ed1 --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-10-General-Reject-Invalid File Extension-9730787611].json @@ -0,0 +1,28 @@ +{ + "_description": "PP-10-General-Reject-Invalid File Extension", + "bulk_upload_report": { + "FilePath": "reject/test/9730787611/1of1_Lloyd_George_Record_[Gary Jack INSKIP]_[9730787611]_[04-09-1960]", + "NhsNumber": "9730787611", + "PdsOdsCode": "", + "Reason": "Invalid file extension", + "StoredFileName": "test/9730787611/1of1_Lloyd_George_Record_[Gary Jack INSKIP]_[9730787611]_[04-09-1960]", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": { + "Author": "M85143", + "Custodian": "M85143", + "DocumentSnomedCodeType": "16521000000101", + "Files": [ + { + "FileName": "1of1_Lloyd_George_Record_[Gary Jack INSKIP]_[9730787611]_[04-09-1960]" + } + ], + "NhsNumber": "9730787611", + "ReviewReason": "Unsuccessful upload", + "ReviewStatus": "PENDING_REVIEW", + "Version": "Decimal('1')" + }, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-2-General-Reject-Incorrect Path Format-9730787573].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-2-General-Reject-Incorrect Path Format-9730787573].json new file mode 100644 index 0000000000..a7371813ac --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-2-General-Reject-Incorrect Path Format-9730787573].json @@ -0,0 +1,28 @@ +{ + "_description": "PP-2-General-Reject-Incorrect Path Format", + "bulk_upload_report": { + "FilePath": "reject/test/9730787573/1of1_Lloyd_George_Record_[Alan Oscar KERNS]_[9730787573]_[27-08-1971].pdf", + "NhsNumber": "9730787573", + "PdsOdsCode": "M85143", + "Reason": "One or more of the files is not accessible from staging bucket", + "StoredFileName": "test/9730787573/1of1_Lloyd_George_Record_[Alan Oscar KERNS]_[9730787573]_[27-08-1971].pdf", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": { + "Author": "M85143", + "Custodian": "M85143", + "DocumentSnomedCodeType": "16521000000101", + "Files": [ + { + "FileName": "1OF1_Lloyd_George_Record_[Alan Oscar KERNS]_[9730787573]_[27-08-1971].pdf" + } + ], + "NhsNumber": "9730787573", + "ReviewReason": "Unsuccessful upload", + "ReviewStatus": "PENDING_REVIEW", + "Version": "Decimal('1')" + }, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-4-General-Reject-Not a Lloyd George Record-9730787751].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-4-General-Reject-Not a Lloyd George Record-9730787751].json new file mode 100644 index 0000000000..5aa3cff43e --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-4-General-Reject-Not a Lloyd George Record-9730787751].json @@ -0,0 +1,28 @@ +{ + "_description": "PP-4-General-Reject-Not a Lloyd George Record", + "bulk_upload_report": { + "FilePath": "reject/test/9730787751/1of1_Floyd_George_Record_[Rachel STILL]_[9730787751]_[01-01-2002].pdf", + "NhsNumber": "9730787751", + "PdsOdsCode": "", + "Reason": "Invalid Lloyd_George_Record separator", + "StoredFileName": "test/9730787751/1of1_Floyd_George_Record_[Rachel STILL]_[9730787751]_[01-01-2002].pdf", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": { + "Author": "M85143", + "Custodian": "M85143", + "DocumentSnomedCodeType": "16521000000101", + "Files": [ + { + "FileName": "1of1_Floyd_George_Record_[Rachel STILL]_[9730787751]_[01-01-2002].pdf" + } + ], + "NhsNumber": "9730787751", + "ReviewReason": "Unsuccessful upload", + "ReviewStatus": "PENDING_REVIEW", + "Version": "Decimal('1')" + }, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-6-General-Reject-Incorrect NHS Number or Date-9730786968].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-6-General-Reject-Incorrect NHS Number or Date-9730786968].json new file mode 100644 index 0000000000..43851dab96 --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-6-General-Reject-Incorrect NHS Number or Date-9730786968].json @@ -0,0 +1,28 @@ +{ + "_description": "PP-6-General-Reject-Incorrect NHS Number or Date", + "bulk_upload_report": { + "FilePath": "reject/test/9730786968/1of1_Lloyd_George_Record_[Anita EUSTON]_[119730786968]_[12-01-2003].pdf", + "NhsNumber": "9730786968", + "PdsOdsCode": "", + "Reason": "Incorrect NHS number or date format", + "StoredFileName": "test/9730786968/1of1_Lloyd_George_Record_[Anita EUSTON]_[119730786968]_[12-01-2003].pdf", + "UploadStatus": "failed", + "UploaderOdsCode": "M85143" + }, + "metadata": null, + "review": { + "Author": "M85143", + "Custodian": "M85143", + "DocumentSnomedCodeType": "16521000000101", + "Files": [ + { + "FileName": "1of1_Lloyd_George_Record_[Anita EUSTON]_[119730786968]_[12-01-2003].pdf" + } + ], + "NhsNumber": "9730786968", + "ReviewReason": "Unsuccessful upload", + "ReviewStatus": "PENDING_REVIEW", + "Version": "Decimal('1')" + }, + "unstitched": null +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-7-General-Reject-Invalid NHS Number-9730786976].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-7-General-Reject-Invalid NHS Number-9730786976].json new file mode 100644 index 0000000000..3a6942dbbe --- /dev/null +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_general_reject_ingestions[PP-7-General-Reject-Invalid NHS Number-9730786976].json @@ -0,0 +1,68 @@ +{ + "_description": "PP-7-General-Reject-Invalid NHS Number", + "bulk_upload_report": { + "FilePath": "accept/9730786976/3of3_Lloyd_George_Record_[Lena Rena LAWLER]_[9730786976]_[24-07-1924].pdf", + "NhsNumber": "9730786976", + "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", + "StoredFileName": "9730786976/3of3_Lloyd_George_Record_[Lena Rena LAWLER]_[9730786976]_[24-07-1924].pdf", + "UploadStatus": "complete", + "UploaderOdsCode": "M85143" + }, + "metadata": { + "Author": "M85143", + "ContentType": "application/pdf", + "Created": "2026-01-29T10:48:22.815553Z", + "CurrentGpOds": "M85143", + "Custodian": "M85143", + "DocStatus": "final", + "DocumentScanCreation": "2023-01-01", + "DocumentSnomedCodeType": "16521000000101", + "FileLocation": "s3://roga7-lloyd-george-store/9730786976/5e7be779-95b5-4a98-99fa-b46cdde0e13b", + "FileName": "1of1_Lloyd_George_Record_[Lena Rena LAWLER]_[9730786976]_[24-07-1924].pdf", + "FileSize": "Decimal('578652')", + "ID": "5e7be779-95b5-4a98-99fa-b46cdde0e13b", + "NhsNumber": "9730786976", + "S3FileKey": "9730786976/5e7be779-95b5-4a98-99fa-b46cdde0e13b", + "S3VersionID": "Pe8g7sZDkNep3Ge.JoogC5qpKMw0ZO7k", + "Status": "current", + "Uploaded": true, + "Version": "1", + "VirusScannerResult": "Clean" + }, + "review": { + "Author": "M85143", + "Custodian": "M85143", + "DocumentSnomedCodeType": "16521000000101", + "Files": [ + { + "FileName": "1of1_Lloyd_George_Record_[Lena Rena LAWLER]_[19730786976]_[24-07-192].pdf" + } + ], + "NhsNumber": "9730786976", + "ReviewReason": "Unsuccessful upload", + "ReviewStatus": "PENDING_REVIEW", + "Version": "Decimal('1')" + }, + "unstitched": { + "Author": "M85143", + "ContentType": "application/pdf", + "Created": "2026-01-29T10:48:23.054751Z", + "Custodian": "M85143", + "DocStatus": "final", + "DocumentScanCreation": "2023-01-01", + "DocumentSnomedCodeType": "16521000000101", + "FileLocation": "s3://roga7-lloyd-george-store/9730786976/7465a59e-b9b2-4595-b7aa-2c187a430935", + "FileName": "3of3_Lloyd_George_Record_[Lena Rena LAWLER]_[9730786976]_[24-07-1924].pdf", + "FileSize": "Decimal('173760')", + "ID": "7465a59e-b9b2-4595-b7aa-2c187a430935", + "LastUpdated": "Decimal('1769683703')", + "NhsNumber": "9730786976", + "S3FileKey": "9730786976/7465a59e-b9b2-4595-b7aa-2c187a430935", + "S3VersionID": "neH9zrPyHM8D2Nfz17RWIp0.sBJxcr4g", + "Status": "current", + "Uploaded": true, + "Version": "1", + "VirusScannerResult": "Clean" + } +} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_remap_and_fixed[123456789-Prevent Fixed on File and NhsNumber].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_remap_and_fixed[123456789-Prevent Fixed on File and NhsNumber].json deleted file mode 100644 index 14efd8624a..0000000000 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_remap_and_fixed[123456789-Prevent Fixed on File and NhsNumber].json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "_description": "Prevent Fixed on File and NhsNumber", - "bulk_upload_report": null, - "metadata": null -} diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename-9000000005].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename-9000000005].json index f1c07fc1b8..5bbbfa443d 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename-9000000005].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename-9000000005].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-Could not find a valid date in the filename?", "bulk_upload_report": { - "FilePath": "9730153819 07-Aug-2020/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000005.pdf", + "FilePath": "reject-usb/9730153819 07-Aug-2020/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000005.pdf", "NhsNumber": "9000000005", "PdsOdsCode": "", "Reason": "Could not find a valid date in the filename", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000045].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000045].json index acf9d8c7fd..b37ce37046 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000045].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000045].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-Could not find a valid date in the filename.", "bulk_upload_report": { - "FilePath": "1232323232 12-Aug-1999 Catherine Higgins/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000045.pdf", + "FilePath": "reject-usb/1232323232 12-Aug-1999 Catherine Higgins/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000045.pdf", "NhsNumber": "9000000045", "PdsOdsCode": "", "Reason": "Could not find a valid date in the filename", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000055].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000055].json index 810a01e05a..1c76bbdb37 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000055].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000055].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-Could not find a valid date in the filename.", "bulk_upload_report": { - "FilePath": "1253617284 Adam Thomas 07-Nov-99/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000055.pdf", + "FilePath": "reject-usb/1253617284 Adam Thomas 07-Nov-99/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000055.pdf", "NhsNumber": "9000000055", "PdsOdsCode": "", "Reason": "Could not find a valid date in the filename", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000099].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000099].json index 22a1aa9e50..78e9242815 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000099].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Could not find a valid date in the filename.-9000000099].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-Could not find a valid date in the filename.", "bulk_upload_report": { - "FilePath": "2516273843 Fiona Smith/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000099.pdf", + "FilePath": "reject-usb/2516273843 Fiona Smith/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000099.pdf", "NhsNumber": "9000000099", "PdsOdsCode": "", "Reason": "Could not find a valid date in the filename", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-File extension .tiff is not supported-9000000001].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-File extension .tiff is not supported-9000000001].json index 488cb3ce98..e178571a3f 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-File extension .tiff is not supported-9000000001].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-File extension .tiff is not supported-9000000001].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-File extension .tiff is not supported", "bulk_upload_report": { - "FilePath": "9730153752 Dawn FLING 19-Sep-2011/fgdgdf2f4e4dtd_B_1_Lloyd_George_tiff_NOS_9730153752.tiff", + "FilePath": "reject-usb/9730153752 Dawn FLING 19-Sep-2011/fgdgdf2f4e4dtd_B_1_Lloyd_George_tiff_NOS_9730153752.tiff", "NhsNumber": "9000000001", "PdsOdsCode": "", "Reason": "File extension .tiff is not supported", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid NHS number-9000000088].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid NHS number-9000000088].json index 054cfca319..e41695d2ae 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid NHS number-9000000088].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid NHS number-9000000088].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-Invalid NHS number", "bulk_upload_report": { - "FilePath": "Stewart Smith 07-Sep-1998/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000088.pdf", + "FilePath": "reject-usb/Stewart Smith 07-Sep-1998/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000088.pdf", "NhsNumber": "9000000088", "PdsOdsCode": "", "Reason": "Invalid NHS number", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid date format-9000000044].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid date format-9000000044].json index b222e2e9b7..ae2e9f1304 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid date format-9000000044].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid date format-9000000044].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-Invalid date format", "bulk_upload_report": { - "FilePath": "1234567895 Lillian Percy 07-24-1999/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000044.pdf", + "FilePath": "reject-usb/1234567895 Lillian Percy 07-24-1999/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000044.pdf", "NhsNumber": "9000000044", "PdsOdsCode": "", "Reason": "Invalid date format", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid patient name-9000000008].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid patient name-9000000008].json index 92c42a7ad4..3ea04c8f7b 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid patient name-9000000008].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid patient name-9000000008].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-Invalid patient name", "bulk_upload_report": { - "FilePath": "9730153 Louisa Gables 07-Nov-1999/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000008.pdf", + "FilePath": "reject-usb/9730153 Louisa Gables 07-Nov-1999/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000008.pdf", "NhsNumber": "9000000008", "PdsOdsCode": "", "Reason": "Invalid NHS number", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid patient name-9000000067].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid patient name-9000000067].json index db4a5090cc..506d9a637d 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid patient name-9000000067].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Invalid patient name-9000000067].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-Invalid patient name", "bulk_upload_report": { - "FilePath": "12-Aug-1944 Catherine Higgins 1992323232/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000067.pdf", + "FilePath": "reject-usb/12-Aug-1944 Catherine Higgins 1992323232/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000067.pdf", "NhsNumber": "9000000067", "PdsOdsCode": "", "Reason": "Invalid patient name", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Multi-part documents are not supported-9000000003].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Multi-part documents are not supported-9000000003].json index 1144e566c8..64469cba1a 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Multi-part documents are not supported-9000000003].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-Multi-part documents are not supported-9000000003].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-Multi-part documents are not supported", "bulk_upload_report": { - "FilePath": "9730153973 Sue Lara TEMPLE 25-Jul-2010/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of7_9730153973.pdf", + "FilePath": "reject-usb/9730153973 Sue Lara TEMPLE 25-Jul-2010/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of7_9730153973.pdf", "NhsNumber": "9000000003", "PdsOdsCode": "", "Reason": "Multi-part documents are not supported", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-no space between name and dob-9000000066].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-no space between name and dob-9000000066].json index 712e30071a..bc913b02bf 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-no space between name and dob-9000000066].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_reject_bulk_upload/test_usb_reject_ingestions[USB-Rejected-no space between name and dob-9000000066].json @@ -1,7 +1,7 @@ { "_description": "USB-Rejected-no space between name and dob", "bulk_upload_report": { - "FilePath": "9725362748 Geraldine Ellis07-Sep-1999/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000066.pdf", + "FilePath": "reject-usb/9725362748 Geraldine Ellis07-Sep-1999/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9000000066.pdf", "NhsNumber": "9000000066", "PdsOdsCode": "", "Reason": "Could not find a valid date in the filename", diff --git a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_scod_bulk_upload/test_scod_ingestions[SCOD-Accept-9730787158].json b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_scod_bulk_upload/test_scod_ingestions[SCOD-Accept-9730787158].json index 91964f69f4..5cd689be58 100644 --- a/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_scod_bulk_upload/test_scod_ingestions[SCOD-Accept-9730787158].json +++ b/lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_scod_bulk_upload/test_scod_ingestions[SCOD-Accept-9730787158].json @@ -4,6 +4,7 @@ "FilePath": "expedite/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787158]_[03-01-2016].pdf", "NhsNumber": "9730787158", "PdsOdsCode": "M85143", + "Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name", "StoredFileName": "expedite/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787158]_[03-01-2016].pdf", "UploadStatus": "complete", "UploaderOdsCode": "expedite" diff --git a/lambdas/tests/e2e/bulk_upload/check/test_reject_bulk_upload.py b/lambdas/tests/e2e/bulk_upload/check/test_reject_bulk_upload.py index b22df54da6..6ae4cfe900 100644 --- a/lambdas/tests/e2e/bulk_upload/check/test_reject_bulk_upload.py +++ b/lambdas/tests/e2e/bulk_upload/check/test_reject_bulk_upload.py @@ -32,9 +32,9 @@ def bulk_upload_table_records(): "lloyd_george_records": lloyd_george_data_helper.scan_lloyd_george_table(), "bulk_upload_report_records": lloyd_george_data_helper.scan_bulk_upload_report_table(), "unstitched_records": lloyd_george_data_helper.scan_unstitch_table(), + "review_records": lloyd_george_data_helper.scan_review_table() } - @pytest.mark.parametrize( "description, nhs_number", general_reject_test_cases, @@ -52,6 +52,7 @@ def test_general_reject_ingestions( nhs_number, bulk_upload_table_records["bulk_upload_report_records"] ), "unstitched": get_entry_from_table_by_nhs_number(nhs_number, bulk_upload_table_records["unstitched_records"]), + "review": get_entry_from_table_by_nhs_number(nhs_number, bulk_upload_table_records["review_records"]) } assert records_by_num == snapshot_json( exclude=paths( @@ -59,9 +60,15 @@ def test_general_reject_ingestions( "bulk_upload_report.Date", "bulk_upload_report.ID", "bulk_upload_report.Timestamp", + "review.ID", + "review.UploadDate", + "review.Files.0.FileLocation", + "review.Files.1.FileLocation" ) ) - + if records_by_num["review"]["NhsNumber"] != "0000000000": + for file in records_by_num["review"]["Files"]: + assert lloyd_george_data_helper.check_review_record_exists_in_s3_with_version(file["FileLocation"]) @pytest.mark.parametrize( "description, nhs_number", @@ -89,6 +96,9 @@ def test_usb_reject_ingestions( "bulk_upload_report.Timestamp", ) ) + if records_by_num["review"]["NhsNumber"] != "0000000000": + for file in records_by_num["review"]["Files"]: + assert lloyd_george_data_helper.check_review_record_exists_in_s3_with_version(file["FileLocation"]) @pytest.mark.parametrize("nhs_number,description", [("123456789", "Prevent Fixed on File and NhsNumber")]) diff --git a/lambdas/tests/e2e/bulk_upload/conftest.py b/lambdas/tests/e2e/bulk_upload/conftest.py index dc4fd296a2..4f69eec2cf 100644 --- a/lambdas/tests/e2e/bulk_upload/conftest.py +++ b/lambdas/tests/e2e/bulk_upload/conftest.py @@ -32,20 +32,25 @@ def empty_table(table_name): dynamodb = boto3.resource("dynamodb") table = dynamodb.Table(table_name) - response = table.scan(ProjectionExpression="ID") - items = response.get("Items", []) + key_attrs = [k["AttributeName"] for k in table.key_schema] + projection_expr = ", ".join(key_attrs) + + scan_kwargs = {"ProjectionExpression": projection_expr} + response = table.scan(**scan_kwargs) - # Delete initial page with table.batch_writer() as batch: - for item in items: - batch.delete_item(Key={"ID": item["ID"]}) - - # Continue if paginated - while "LastEvaluatedKey" in response: - response = table.scan(ProjectionExpression="ID", ExclusiveStartKey=response["LastEvaluatedKey"]) - items = response.get("Items", []) - with table.batch_writer() as batch: - for item in items: - batch.delete_item(Key={"ID": item["ID"]}) + while True: + for item in response.get("Items", []): + batch.delete_item( + Key={k: item[k] for k in key_attrs} + ) + + if "LastEvaluatedKey" not in response: + break + + response = table.scan( + **scan_kwargs, + ExclusiveStartKey=response["LastEvaluatedKey"] + ) print(f"Emptied table {table_name}") diff --git a/lambdas/tests/e2e/bulk_upload/data/accept-metadata-usb.csv b/lambdas/tests/e2e/bulk_upload/data/accept-metadata-usb.csv index fc5dbe3847..c052e5dac9 100644 --- a/lambdas/tests/e2e/bulk_upload/data/accept-metadata-usb.csv +++ b/lambdas/tests/e2e/bulk_upload/data/accept-metadata-usb.csv @@ -1,3 +1,3 @@ Test-Description,FILEPATH,PAGE COUNT,GP-PRACTICE-CODE,NHS-NO,SECTION,SUB-SECTION,SCAN-DATE,SCAN-ID,USER-ID,UPLOAD -USB-Accepted-sent straight to queue (skips validation if already valid),9730153760/1of1_Lloyd_George_Record_[Ruby Sandra MANTON]_[9730153760]_[08-01-2003].pdf,1,M85143,9730153760,LG,,01/01/2023,NEC,NEC,23/11/2023 -USB-Accepted-1of1 in filename,9730153817 Haley Glenda RUDKIN 07-Aug-2023/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9730153817.pdf,1,M85143,9730153817,LG,,01/01/2023,NEC,NEC,23/11/2023 +USB-Accept-Unprocessed,9730153760/1of1_Lloyd_George_Record_[Ruby Sandra MANTON]_[9730153760]_[08-01-2003].pdf,1,M85143,9730153760,LG,,01/01/2023,NEC,NEC,23/11/2023 +USB-Accept-Processed,9730153817 Haley Glenda RUDKIN 07-Aug-2023/fgdgdf2f4e4dtd_B_1_Lloyd_George_Record_NOS_1of1_9730153817.pdf,1,M85143,9730153817,LG,,01/01/2023,NEC,NEC,23/11/2023 diff --git a/lambdas/tests/e2e/bulk_upload/data/accept-metadata.csv b/lambdas/tests/e2e/bulk_upload/data/accept-metadata.csv index c75630d9ed..5e309d4daa 100644 --- a/lambdas/tests/e2e/bulk_upload/data/accept-metadata.csv +++ b/lambdas/tests/e2e/bulk_upload/data/accept-metadata.csv @@ -1,10 +1,10 @@ Test-Description,FILEPATH,PAGE COUNT,GP-PRACTICE-CODE,NHS-NO,SECTION,SUB-SECTION,SCAN-DATE,SCAN-ID,USER-ID,UPLOAD -General-Accepted-Single File Upload,9730787026/1of1_Lloyd_George_Record_[Dora Celia HAMNET]_[9730787026]_[07-07-1926].pdf,1,M85143,9730787026,LG,,01/01/2023,NEC,NEC,21/11/2025 -General-Accepted-Multi File Upload 1of3,9730786976/1of3_Lloyd_George_Record_[Lena Rena LAWLER]_[9730786976]_[24-07-1924].pdf,1,M85143,9730786976,LG,,01/01/2023,NEC,NEC,05/12/2025 -General-Accepted-Multi File Upload 2of3,9730786976/2of3_Lloyd_George_Record_[Lena Rena LAWLER]_[9730786976]_[24-07-1924].pdf,2,M85143,9730786976,LG,,01/01/2023,NEC,NEC,05/12/2025 -General-Accepted-Multi File Upload 3of3,9730786976/3of3_Lloyd_George_Record_[Lena Rena LAWLER]_[9730786976]_[24-07-1924].pdf,3,M85143,9730786976,LG,,01/01/2023,NEC,NEC,05/12/2025 -General-Accepted-Pre-processor LloydGeorge Name Edit,9730786925/1of1_Ll0yd_George_Record_[Harry Adam TWIST]_[9730786925]_[01-04-1925].pdf,1,M85143,9730786925,LG,,01/01/2023,NEC,NEC,05/12/2025 -General-Accepted-Pre-processor Mixed Spacing in Page,01of 01_Lloyd_George_Record_Andrea Gladys HOAKES_9730154775_09-01-2009.pdf,1,H81109,9730154775,LG,,01/01/2023,NEC,NEC,23/11/2023 -General-Accepted-Pre-processor Spacing Nhs Number,01 of 01_Lloyd_George_Record_GILALA NYSSA RUBENSTEIN_973 015 472 4_18-07-2020.pdf,1,H81109,9730154724,LG,,01/01/2023,NEC,NEC,23/11/2023 -General-Accepted-Pre-processor Hyphenated Nhs Number,01 of 01_Lloyd_George_Record_MEIXIANG XIAOLIAN FONG_973-0154-406_27-11-1944.pdf,1,H81109,9730154406,LG,,01/01/2023,NEC,NEC,23/11/2023 -General-Accepted-Pre-processor Mixed brackets,01 of 01_Lloyd George Record_[Tarina Sybill LEVY]_9730154090_14-09-1961.pdf,1,H81109,9730154090,LG,,01/01/2023,NEC,NEC,23/11/2023 +General-Accept-Single File Upload,9730787026/1of1_Lloyd_George_Record_[Dora Celia HAMNET]_[9730787026]_[07-07-1926].pdf,1,M85143,9730787026,LG,,01/01/2023,NEC,NEC,21/11/2025 +General-Accept-Multi File Upload 1of3,9730786976/1of3_Lloyd_George_Record_[Lena Rena LAWLER]_[9730786976]_[24-07-1924].pdf,1,M85143,9730786976,LG,,01/01/2023,NEC,NEC,05/12/2025 +General-Accept-Multi File Upload 2of3,9730786976/2of3_Lloyd_George_Record_[Lena Rena LAWLER]_[9730786976]_[24-07-1924].pdf,2,M85143,9730786976,LG,,01/01/2023,NEC,NEC,05/12/2025 +General-Accept-Multi File Upload 3of3,9730786976/3of3_Lloyd_George_Record_[Lena Rena LAWLER]_[9730786976]_[24-07-1924].pdf,3,M85143,9730786976,LG,,01/01/2023,NEC,NEC,05/12/2025 +General-Accept-Processed-LloydGeorge Name Edit,9730786925/1of1_Ll0yd_George_Record_[Harry Adam TWIST]_[9730786925]_[01-04-1925].pdf,1,M85143,9730786925,LG,,01/01/2023,NEC,NEC,05/12/2025 +General-Accept-Processed-Mixed Spacing in Page,01of 01_Lloyd_George_Record_Andrea Gladys HOAKES_9730154775_09-01-2009.pdf,1,H81109,9730154775,LG,,01/01/2023,NEC,NEC,23/11/2023 +General-Accept-Processed-Spacing Nhs Number,01 of 01_Lloyd_George_Record_GILALA NYSSA RUBENSTEIN_973 015 472 4_18-07-2020.pdf,1,H81109,9730154724,LG,,01/01/2023,NEC,NEC,23/11/2023 +General-Accept-Processed-Hyphenated Nhs Number,01 of 01_Lloyd_George_Record_MEIXIANG XIAOLIAN FONG_973-0154-406_27-11-1944.pdf,1,H81109,9730154406,LG,,01/01/2023,NEC,NEC,23/11/2023 +General-Accept-Processed-Mixed brackets,01 of 01_Lloyd George Record_[Tarina Sybill LEVY]_9730154090_14-09-1961.pdf,1,H81109,9730154090,LG,,01/01/2023,NEC,NEC,23/11/2023 diff --git a/lambdas/tests/e2e/bulk_upload/data/accept-remap-and-fixed.csv b/lambdas/tests/e2e/bulk_upload/data/accept-remap-and-fixed.csv index cf01d46758..20cc9ee9a5 100644 --- a/lambdas/tests/e2e/bulk_upload/data/accept-remap-and-fixed.csv +++ b/lambdas/tests/e2e/bulk_upload/data/accept-remap-and-fixed.csv @@ -1,2 +1,2 @@ Test-Description,file,PAGE COUNT,nhsnumber,SECTION,SUB-SECTION,SCAN-DATE,SCAN-ID,USER-ID,UPLOAD -Remap and Fixed,test/9730787492/1of1_Lloyd_George_Record_[Bob SPEAR]_[9730787492]_[05-08-1968].pdf,1,9730787492,LG,,01/01/2023,NEC,NEC,21/11/2025 +General-Accept-Remap and Fixed,test/9730787492/1of1_Lloyd_George_Record_[Bob SPEAR]_[9730787492]_[05-08-1968].pdf,1,9730787492,LG,,01/01/2023,NEC,NEC,21/11/2025 diff --git a/lambdas/tests/e2e/bulk_upload/data/reject-fixed.csv b/lambdas/tests/e2e/bulk_upload/data/reject-fixed.csv index 239b489562..1cc21551dd 100644 --- a/lambdas/tests/e2e/bulk_upload/data/reject-fixed.csv +++ b/lambdas/tests/e2e/bulk_upload/data/reject-fixed.csv @@ -1,2 +1,2 @@ Test-Description,FILEPATH,PAGE COUNT,NHS-NO,SECTION,SUB-SECTION,scandate,SCAN-ID,USER-ID,UPLOAD -Prevent Fixed on File and NhsNumber,test/9730787603/1of1_Lloyd_George_Record_[Earl Noel MCGLUE]_[9730787603]_[26-06-1963].pdf,1,M85143,9730787603,LG,,01/01/2023,NEC,NEC,21/11/2025 +General-Reject-Prevent Fixed on File and NhsNumber,test/9730787603/1of1_Lloyd_George_Record_[Earl Noel MCGLUE]_[9730787603]_[26-06-1963].pdf,1,M85143,9730787603,LG,,01/01/2023,NEC,NEC,21/11/2025 diff --git a/lambdas/tests/e2e/bulk_upload/data/reject-metadata.csv b/lambdas/tests/e2e/bulk_upload/data/reject-metadata.csv index cb919029f6..9869a2ae08 100644 --- a/lambdas/tests/e2e/bulk_upload/data/reject-metadata.csv +++ b/lambdas/tests/e2e/bulk_upload/data/reject-metadata.csv @@ -1,11 +1,16 @@ Test-Description,FILEPATH,PAGE COUNT,GP-PRACTICE-CODE,NHS-NO,SECTION,SUB-SECTION,SCAN-DATE,SCAN-ID,USER-ID,UPLOAD -General-Rejected-invalid date format - Invalid Month,01 of 02_Lloyd_George_Record_Steph Stevens_9000000001_12.25.2010.pdf,1,H81109,9000000101,LG,,01/01/2023,NEC,NEC,23/11/2023 -General-Rejected-incorrect NHS number or date format - Invalid Format,01 of 02_Lloyd_George_Record_Andrew Stevens_9000000001_12.10.21.pdf,1,H81109,9000000201,LG,,01/01/2023,NEC,NEC,23/11/2023 -General-Rejected-Invalid date format,01 of 02_Lloyd_George_Record_Jaimie Stevens_9000000001_300.4.2010.pdf,1,H81109,9000000051,LG,,01/01/2023,NEC,NEC,23/11/2023 -General-Rejected-Invalid NHS number,01 of 02_Lloyd_George_Record_Jane Stevens_900_000_0001_11.10.2010.pdf,1,H81109,9000000061,LG,,01/01/2023,NEC,NEC,23/11/2023 -General-Rejected-incorrect NHS number or date format,01 of 02_Lloyd_George_Record_Patricia Stevens_9000000001_2_11.10.2010.pdf,1,H81109,9000000071,LG,,01/01/2023,NEC,NEC,23/11/2023 -General-Rejected-incorrect document path format,103/01 02_Lloyd_George_Record_Charles Stevens_9000000001_22.10.2010.pdf,1,H81109,9000000081,LG,,01/01/2023,NEC,NEC,23/11/2023 -General-Rejected-Missing 'lloyd george record',1093/01 of 02_Phineas Stevens_9000000001_22.10.2010.pdf,1,H81109,9500000001,LG,,01/01/2023,NEC,NEC,23/11/2023 -General-Rejected-Nhs Not in PDS,1of1_Lloyd_George_Record_[Josh Lucien PLATT]_[9596333437]_[23-10-1979].pdf,1,M85143,9596333437,LG,,01/01/2023,NEC,NEC,29/10/2025 -General-Rejected-Infected,1of1_Lloyd_George_Record_[Moses Ivan WELLS]_[9730788529]_[20-03-1994].pdf,1,M85143,9730788529,LG,,01/01/2023,NEC,NEC,29/10/2025 -General-Rejected-Corrupted,test/9730788022/1of1_Lloyd_George_Record_[Cath YOUDS]_[9730788022]_[05-05-1965].pdf,1,M85143,9730788022,LG,,01/01/2023,NEC,NEC,21/11/2025 +PP-2-General-Reject-Incorrect Path Format,test/9730787573/1OF1_Lloyd_George_Record_[Alan Oscar KERNS]_[9730787573]_[27-08-1971].pdf,1,M85143,9730787573,LG,NULL,2023-01-01,NEC,NEC,NULL +PP-4-General-Reject-Not a Lloyd George Record,test/9730787751/1of1_Floyd_George_Record_[Rachel STILL]_[9730787751]_[01-01-2002].pdf,1,M85143,9730787751,LG,,01/01/2023,NEC,NEC,21/11/2025 +PP-6-General-Reject-Incorrect NHS Number or Date,test/9730786968/1of1_Lloyd_George_Record_[Anita EUSTON]_[119730786968]_[12-01-2003].pdf,1,M85143,9730786968,LG,,01/01/2023,NEC,NEC,21/11/2025 +PP-7-General-Reject-Invalid NHS Number,test/9730787646/1of1_Lloyd_George_Record_[Stan Herman HOOLEY]_[19730787646]_[08-04-11959].pdf,1,M85143,9730787646,LG,,01/01/2023,NEC,NEC,21/11/2025 +PP-10-General-Reject-Invalid File Extension,test/9730787611/1of1_Lloyd_George_Record_[Gary Jack INSKIP]_[9730787611]_[04-09-1960],1,M85143,9730787611,LG,,01/01/2023,NEC,NEC,21/11/2025 +BULK-3-General-Reject-Missing Files,test/9730787328/1of2_Lloyd_George_Record_[Agnes Gaynor MULLEN]_[9730787328]_[30-03-2017].pdf,1,M85143,9730787328,LG,,01/01/2023,NEC,NEC,21/11/2025 +BULK-4-General-Reject-More Files than total,test/9730787735/1of1_Lloyd_George_Record_[Gemma Jeanne HIRD]_[9730787735]_[02-08-1994].pdf,1,M85143,9730787735,LG,,01/01/2023,NEC,NEC,21/11/2025 +BULK-4-General-Reject-More Files thant total,test/9730787735/1_of1_LLOYD_George_Record_[Gemma Jeanne HIRD]_[9730787735]_[02-08-1994].pdf,1,M85143,9730787735,LG,,01/01/2023,NEC,NEC,21/11/2025 +BULK-6-General-Reject-NHS Number metadata mismatch,test/9730787352/1of1_Lloyd_George_Record_[Clara Kylie HOOD]_[9730787352]_[02-12-2010].pdf,1,M85143,9434765919,LG,,01/01/2023,NEC,NEC,21/11/2025 +BULK-7-General-Reject-Missing Files,test/9730787182/2of3_Lloyd_George_Record_[Jimmy Oliver LOWERY]_[9730787182]_[15-02-2013].pdf,1,M85143,9730787182,LG,,01/01/2023,NEC,NEC,21/11/2025 +BULK-7-General-Reject-Missing Files,test/9730787182/3of3_Lloyd_George_Record_[Jimmy Oliver LOWERY]_[9730787182]_[15-02-2013].pdf,1,M85143,9730787182,LG,,01/01/2023,NEC,NEC,21/11/2025 +BULK-9-General-Reject-Could not find patient in PDS,test/9730787271/1of1_Lloyd_George_Record_[Kate SUMMER]_[9476281359]_[27-08-2019].pdf,1,M85143,9476281359,LG,,01/01/2023,NEC,NEC,21/11/2025 +BULK-12-General-Reject-Patient Name Mismatch,test/9730787417/1of1_Lloyd_George_Record_[Notmename Andrew KINNOY]_[9730787417]_[25-12-1999].pdf,1,M85143,9730787417,LG,,01/01/2023,NEC,NEC,21/11/2025 +BULK-13-General-Reject-No or Infected File,test/9730787573/1of1_Lloyd_George_Record_[Alan Oscar KERNS]_[9730787573]_[27-08-1971].pdf,1,M85143,9730787573,LG,,01/01/2023,NEC,NEC,21/11/2025 +BULK-14-General-Reject-Corrupted File,test/9730787298/1of1_Lloyd_George_Record_[Hazel DOYLE]_[9730787298]_[08-02-2020].pdf,1,M85143,9730787298,LG,,01/01/2023,NEC,NEC,21/11/2025 diff --git a/lambdas/tests/e2e/bulk_upload/upload/test_initiate_bulk_upload.py b/lambdas/tests/e2e/bulk_upload/upload/test_initiate_bulk_upload.py index f6983d7d5c..479ae99a54 100644 --- a/lambdas/tests/e2e/bulk_upload/upload/test_initiate_bulk_upload.py +++ b/lambdas/tests/e2e/bulk_upload/upload/test_initiate_bulk_upload.py @@ -20,6 +20,7 @@ def cleanup_databases(): empty_table(lloyd_george_helper.bulk_upload_table) empty_table(lloyd_george_helper.unstitched_table) empty_table(lloyd_george_helper.dynamo_table) + empty_table(lloyd_george_helper.review_table) def upload_record(record: str, pdf_path: Path, prefix=None, infected=False): @@ -75,8 +76,8 @@ def run_bulk_upload_with_remappings_and_fixes(metada_filename, remappings, fixed def test_run_bulk_upload_accepted(): rows = read_metadata_csv(datadir, "accept-metadata.csv") for row in rows: - pdf_filepath = datadir / "pdf" / "valid.pdf" - upload_record(row["FILEPATH"], pdf_filepath, "accept") + pdf_filepath = datadir / "pdf" / "valid.pdf" + upload_record(row["FILEPATH"], pdf_filepath, "accept") metadata_filepath = datadir / "accept-metadata.csv" s3_key = "accept/index.csv" @@ -104,9 +105,9 @@ def test_run_bulk_upload_rejected(): rows = read_metadata_csv(datadir, "reject-metadata.csv") for row in rows: pdf_filepath = datadir / "pdf" / "valid.pdf" - if "Infected" in row["Test-Description"]: - upload_record(row["FILEPATH"], pdf_filepath, "reject", True) - elif "Corrupted" in row["Test-Description"]: + if "BULK-13" in row["Test-Description"]: + pass + elif "BULK-14" in row["Test-Description"]: upload_corrupted_record(row["FILEPATH"], pdf_filepath, "reject") else: upload_record(row["FILEPATH"], pdf_filepath, "reject") diff --git a/lambdas/tests/e2e/helpers/data_helper.py b/lambdas/tests/e2e/helpers/data_helper.py index 7d57769c75..5b0f7b474f 100644 --- a/lambdas/tests/e2e/helpers/data_helper.py +++ b/lambdas/tests/e2e/helpers/data_helper.py @@ -203,10 +203,15 @@ def __init__(self): self.bulk_upload_table_name = "BulkUploadReport" self.metadata_processor_lambda_name = "BulkUploadMetadataProcessor" self.unstitched_table_name = "UnstitchedLloydGeorgeReferenceMetadata" - self.staging_bucket = "staging-bulk-store" + self.review_table_name = "DocumentUploadReview" + self.review_bucket_name = "document-pending-review-store" + self.staging_bucket_name = "staging-bulk-store" + + self.staging_bucket = None self.bulk_upload_table = None self.unstitched_table = None self.metadata_processor_lambda = None + self.review_bucket = None self.lambda_client = boto3.client("lambda") self.s3_client = boto3.client("s3") @@ -223,7 +228,9 @@ def build_env(self, table_name, bucket_name): self.bulk_upload_table = f"{self.workspace}_{self.bulk_upload_table_name}" self.metadata_processor_lambda = f"{self.workspace}_{self.metadata_processor_lambda_name}" self.unstitched_table = f"{self.workspace}_{self.unstitched_table_name}" - self.staging_bucket = f"{self.workspace}-{self.staging_bucket}" + self.staging_bucket= f"{self.workspace}-{self.staging_bucket_name}" + self.review_table = f"{self.workspace}_{self.review_table_name}" + self.review_bucket = f"{self.workspace}-{self.review_bucket_name}" def scan_bulk_upload_report_table(self): return self.dynamo_service.scan_whole_table(self.bulk_upload_table or "") @@ -231,6 +238,9 @@ def scan_bulk_upload_report_table(self): def scan_unstitch_table(self): return self.dynamo_service.scan_whole_table(self.unstitched_table or "") + def scan_review_table(self): + return self.dynamo_service.scan_whole_table(self.review_table or "") + def run_bulk_upload(self, payload): payload = json.dumps(payload) response = self.lambda_client.invoke( @@ -272,3 +282,14 @@ def check_record_exists_in_s3_with_version(self, key, version_id): return False else: raise + + def check_review_record_exists_in_s3_with_version(self, key): + s3_client = boto3.client("s3") + try: + _ = s3_client.head_object(Bucket=self.review_bucket, Key=key) + return True + except s3_client.exceptions.ClientError as e: + if e.response["Error"]["Code"] == "404": + return False + else: + raise \ No newline at end of file diff --git a/lambdas/utils/filename_utils.py b/lambdas/utils/filename_utils.py index c4b90d6575..8fb1cc4654 100644 --- a/lambdas/utils/filename_utils.py +++ b/lambdas/utils/filename_utils.py @@ -153,9 +153,9 @@ def extract_patient_name_from_bulk_upload_file_name( Raises: InvalidFileNameException: If the patient name is invalid or not found. """ - document_number_expression = r".*?([\p{L}][^\d]*[\p{L}])(.*)" + patient_extraction_pattern = r".*?([\p{L}][^\d]*[\p{L}])(.*)" expression_result = regex.search( - rf"{document_number_expression}", file_path, regex.IGNORECASE + rf"{patient_extraction_pattern}", file_path, regex.IGNORECASE ) if expression_result is None: