Skip to content

Commit 1a28084

Browse files
committed
[PRMP-1345] Setup SCOD Tests for Review
1 parent 553000e commit 1a28084

5 files changed

Lines changed: 64 additions & 25 deletions

File tree

lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_scod_bulk_upload/test_scod_ingestions[SCOD-Accept-9730787158].json renamed to lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_scod_bulk_upload/test_scod_ingestions[SCOD-Accept-9730787158-G12345].json

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"_description": "SCOD-Accept",
33
"bulk_upload_report": {
4-
"FilePath": "expedite/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787158]_[03-01-2016].pdf",
4+
"FilePath": "expedite/G12345/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787158]_[03-01-2016].pdf",
55
"NhsNumber": "9730787158",
66
"PdsOdsCode": "M85143",
77
"Reason": "Patient matched on full match 3/3, matched on 1 family_name and 2 given name",
88
"SentToReview": false,
9-
"StoredFileName": "expedite/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787158]_[03-01-2016].pdf",
9+
"StoredFileName": "expedite/G12345/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787158]_[03-01-2016].pdf",
1010
"UploadStatus": "complete",
11-
"UploaderOdsCode": "expedite"
11+
"UploaderOdsCode": "G12345"
1212
},
1313
"metadata": {
14-
"Author": "expedite",
14+
"Author": "G12345",
1515
"ContentType": "application/pdf",
1616
"CurrentGpOds": "M85143",
1717
"Custodian": "M85143",
@@ -25,5 +25,19 @@
2525
"Version": "1",
2626
"VirusScannerResult": "Clean"
2727
},
28+
"review": {
29+
"Author": "G12345",
30+
"Custodian": "G12345",
31+
"DocumentSnomedCodeType": "16521000000101",
32+
"Files": [
33+
{
34+
"FileName": "1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787159]_[03-01-2016].pdf"
35+
}
36+
],
37+
"NhsNumber": "0000000000",
38+
"ReviewReason": "Unsuccessful upload",
39+
"ReviewStatus": "PENDING_REVIEW",
40+
"Version": "Decimal('1')"
41+
},
2842
"unstitched": []
2943
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"_description": "SCOD-Reject",
3+
"bulk_upload_report": {
4+
"FilePath": "expedite/G12345/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787159]_[03-01-2016].pdf",
5+
"NhsNumber": "9730787159",
6+
"PdsOdsCode": "",
7+
"Reason": "Invalid NHS number format",
8+
"SentToReview": true,
9+
"StoredFileName": "expedite/G12345/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787159]_[03-01-2016].pdf",
10+
"UploadStatus": "failed",
11+
"UploaderOdsCode": "G12345"
12+
},
13+
"metadata": null,
14+
"review": {
15+
"Author": "G12345",
16+
"Custodian": "G12345",
17+
"DocumentSnomedCodeType": "16521000000101",
18+
"Files": [
19+
{
20+
"FileName": "1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787159]_[03-01-2016].pdf"
21+
}
22+
],
23+
"NhsNumber": "0000000000",
24+
"ReviewReason": "Unsuccessful upload",
25+
"ReviewStatus": "PENDING_REVIEW",
26+
"Version": "Decimal('1')"
27+
},
28+
"unstitched": []
29+
}

lambdas/tests/e2e/bulk_upload/check/__snapshots__/test_scod_bulk_upload/test_scod_ingestions[SCOD-Reject-9730787159].json

Lines changed: 0 additions & 15 deletions
This file was deleted.

lambdas/tests/e2e/bulk_upload/check/test_scod_bulk_upload.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from tests.e2e.bulk_upload.conftest import (
77
get_all_entries_from_table_by_nhs_number,
88
get_entry_from_table_by_nhs_number,
9-
read_metadata_csv,
9+
read_metadata_csv, get_entry_from_table_by_custodian,
1010
)
1111
from tests.e2e.helpers.data_helper import LloydGeorgeDataHelper
1212

@@ -19,7 +19,9 @@
1919

2020
accept_test_cases = []
2121
for record in accept_test_data:
22-
accept_test_cases.append((record["Test-Description"], record["NHS-NO"]))
22+
accept_test_cases.append(
23+
(record["Test-Description"], record["NHS-NO"], record["GP-PRACTICE-CODE"])
24+
)
2325

2426

2527
@pytest.fixture(scope="session", autouse=True)
@@ -28,15 +30,17 @@ def bulk_upload_table_records():
2830
"lloyd_george_records": lloyd_george_data_helper.scan_lloyd_george_table(),
2931
"bulk_upload_report_records": lloyd_george_data_helper.scan_bulk_upload_report_table(),
3032
"unstitched_records": lloyd_george_data_helper.scan_unstitch_table(),
33+
"review_records": lloyd_george_data_helper.scan_review_table(),
3134
}
3235

3336

3437
@pytest.mark.parametrize(
35-
"description, nhs_number",
38+
"description, nhs_number, custodian",
3639
accept_test_cases,
3740
)
3841
def test_scod_ingestions(
3942
nhs_number,
43+
custodian,
4044
description,
4145
snapshot_json,
4246
bulk_upload_table_records,
@@ -52,6 +56,9 @@ def test_scod_ingestions(
5256
"unstitched": get_all_entries_from_table_by_nhs_number(
5357
nhs_number, bulk_upload_table_records["unstitched_records"]
5458
),
59+
"review": get_entry_from_table_by_custodian(
60+
custodian, bulk_upload_table_records["review_records"]
61+
)
5562
}
5663
assert records_by_num == snapshot_json(
5764
exclude=paths(
@@ -65,6 +72,10 @@ def test_scod_ingestions(
6572
"bulk_upload_report.Date",
6673
"bulk_upload_report.ID",
6774
"bulk_upload_report.Timestamp",
75+
"review.ID",
76+
"review.UploadDate",
77+
"review.Files.0.FileLocation",
78+
"review.Files.1.FileLocation",
6879
)
6980
)
7081
metadata = records_by_num.get("metadata") or {}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Test-Description,FILEPATH,NHS-NO
2-
SCOD-Accept,expedite/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787158]_[03-01-2016].pdf,9730787158
3-
SCOD-Reject,expedite/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787159]_[03-01-2016].pdf,9730787159
1+
Test-Description,FILEPATH,NHS-NO,GP-PRACTICE-CODE
2+
SCOD-Accept,expedite/G12345/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787158]_[03-01-2016].pdf,9730787158,G12345
3+
SCOD-Reject,expedite/G12345/1of1_Lloyd_George_Record_[Felix Alfred VOS]_[9730787159]_[03-01-2016].pdf,9730787159,G12345

0 commit comments

Comments
 (0)