Skip to content

Commit 38472a4

Browse files
committed
relocate create_row
1 parent b1f2bde commit 38472a4

File tree

3 files changed

+44
-46
lines changed

3 files changed

+44
-46
lines changed

e2e_batch/constants.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
from datetime import datetime, timezone
32

43
environment = os.environ.get("ENVIRONMENT", "internal-dev")
54
REGION = "eu-west-2"
@@ -96,45 +95,3 @@ class TestSet():
9695
REINSTATE_OK = ActionSequence("Reinstate. OK", [ActionFlag.CREATE, ActionFlag.DELETE_LOGICAL, ActionFlag.UPDATE])
9796
DELETE_FAIL = ActionSequence("Delete without Create. Fail", [ActionFlag.DELETE_LOGICAL])
9897
UPDATE_FAIL = ActionSequence("Update without Create. Fail", [ActionFlag.UPDATE], outcome=ActionFlag.NONE)
99-
100-
101-
def create_row(unique_id, dose_amount, action_flag: str, header, inject_cp1252=None):
102-
"""Helper function to create a single row with the specified UNIQUE_ID and ACTION_FLAG."""
103-
104-
name = "James" if not inject_cp1252 else b'Jam\xe9s'
105-
return {
106-
header: "9732928395",
107-
"PERSON_FORENAME": "PHYLIS",
108-
"PERSON_SURNAME": name,
109-
"PERSON_DOB": "20080217",
110-
"PERSON_GENDER_CODE": "0",
111-
"PERSON_POSTCODE": "WD25 0DZ",
112-
"DATE_AND_TIME": datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%S"),
113-
"SITE_CODE": "RVVKC",
114-
"SITE_CODE_TYPE_URI": "https://fhir.nhs.uk/Id/ods-organization-code",
115-
"UNIQUE_ID": unique_id,
116-
"UNIQUE_ID_URI": RAVS_URI,
117-
"ACTION_FLAG": action_flag,
118-
"PERFORMING_PROFESSIONAL_FORENAME": "PHYLIS",
119-
"PERFORMING_PROFESSIONAL_SURNAME": name,
120-
"RECORDED_DATE": datetime.now(timezone.utc).strftime("%Y%m%d"),
121-
"PRIMARY_SOURCE": "TRUE",
122-
"VACCINATION_PROCEDURE_CODE": "956951000000104",
123-
"VACCINATION_PROCEDURE_TERM": "RSV vaccination in pregnancy (procedure)",
124-
"DOSE_SEQUENCE": "1",
125-
"VACCINE_PRODUCT_CODE": "42223111000001107",
126-
"VACCINE_PRODUCT_TERM": "Quadrivalent influenza vaccine (Sanofi Pasteur)",
127-
"VACCINE_MANUFACTURER": "Sanofi Pasteur",
128-
"BATCH_NUMBER": "BN92478105653",
129-
"EXPIRY_DATE": "20240915",
130-
"SITE_OF_VACCINATION_CODE": "368209003",
131-
"SITE_OF_VACCINATION_TERM": "Right arm",
132-
"ROUTE_OF_VACCINATION_CODE": "1210999013",
133-
"ROUTE_OF_VACCINATION_TERM": "Intradermal use",
134-
"DOSE_AMOUNT": dose_amount,
135-
"DOSE_UNIT_CODE": "2622896019",
136-
"DOSE_UNIT_TERM": "Inhalation - unit of product usage",
137-
"INDICATION_CODE": "1037351000000105",
138-
"LOCATION_CODE": "RJC02",
139-
"LOCATION_CODE_TYPE_URI": "https://fhir.nhs.uk/Id/ods-organization-code",
140-
}

e2e_batch/scenarios.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from vax_suppliers import TestPair, OdsVax
44
from constants import (
55
ActionFlag, BusRowResult, DestinationType, Operation,
6-
create_row,
76
ACK_BUCKET,
87
RAVS_URI,
98
OperationOutcome
@@ -12,7 +11,8 @@
1211
poll_s3_file_pattern, fetch_pk_and_operation_from_dynamodb,
1312
validate_fatal_error,
1413
get_file_content_from_s3,
15-
aws_cleanup
14+
aws_cleanup,
15+
create_row,
1616
)
1717
from clients import logger
1818
from errors import DynamoDBMismatchError

e2e_batch/utils.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
FORWARDEDFILE_PREFIX,
2121
SOURCE_BUCKET,
2222
DUPLICATE,
23-
create_row,
2423
ACK_PREFIX,
2524
FILE_NAME_VAL_ERROR,
2625
HEADER_RESPONSE_CODE_COLUMN,
@@ -474,3 +473,45 @@ def purge_sqs_queues() -> bool:
474473
except Exception as e:
475474
logger.error(f"SQS Purge error: {e}")
476475
return False
476+
477+
478+
def create_row(unique_id, dose_amount, action_flag: str, header, inject_cp1252=None):
479+
"""Helper function to create a single row with the specified UNIQUE_ID and ACTION_FLAG."""
480+
481+
name = "James" if not inject_cp1252 else b'Jam\xe9s'
482+
return {
483+
header: "9732928395",
484+
"PERSON_FORENAME": "PHYLIS",
485+
"PERSON_SURNAME": name,
486+
"PERSON_DOB": "20080217",
487+
"PERSON_GENDER_CODE": "0",
488+
"PERSON_POSTCODE": "WD25 0DZ",
489+
"DATE_AND_TIME": datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%S"),
490+
"SITE_CODE": "RVVKC",
491+
"SITE_CODE_TYPE_URI": "https://fhir.nhs.uk/Id/ods-organization-code",
492+
"UNIQUE_ID": unique_id,
493+
"UNIQUE_ID_URI": RAVS_URI,
494+
"ACTION_FLAG": action_flag,
495+
"PERFORMING_PROFESSIONAL_FORENAME": "PHYLIS",
496+
"PERFORMING_PROFESSIONAL_SURNAME": name,
497+
"RECORDED_DATE": datetime.now(timezone.utc).strftime("%Y%m%d"),
498+
"PRIMARY_SOURCE": "TRUE",
499+
"VACCINATION_PROCEDURE_CODE": "956951000000104",
500+
"VACCINATION_PROCEDURE_TERM": "RSV vaccination in pregnancy (procedure)",
501+
"DOSE_SEQUENCE": "1",
502+
"VACCINE_PRODUCT_CODE": "42223111000001107",
503+
"VACCINE_PRODUCT_TERM": "Quadrivalent influenza vaccine (Sanofi Pasteur)",
504+
"VACCINE_MANUFACTURER": "Sanofi Pasteur",
505+
"BATCH_NUMBER": "BN92478105653",
506+
"EXPIRY_DATE": "20240915",
507+
"SITE_OF_VACCINATION_CODE": "368209003",
508+
"SITE_OF_VACCINATION_TERM": "Right arm",
509+
"ROUTE_OF_VACCINATION_CODE": "1210999013",
510+
"ROUTE_OF_VACCINATION_TERM": "Intradermal use",
511+
"DOSE_AMOUNT": dose_amount,
512+
"DOSE_UNIT_CODE": "2622896019",
513+
"DOSE_UNIT_TERM": "Inhalation - unit of product usage",
514+
"INDICATION_CODE": "1037351000000105",
515+
"LOCATION_CODE": "RJC02",
516+
"LOCATION_CODE_TYPE_URI": "https://fhir.nhs.uk/Id/ods-organization-code",
517+
}

0 commit comments

Comments
 (0)