@@ -50,43 +50,129 @@ def valid_batch_file_is_created_with_invalid_person_dateOfBirth_date(datatable,
5050@ignore_if_local_run
5151def valid_batch_file_is_created_with_invalid_patient_data (datatable , context ):
5252 build_dataFrame_using_datatable (datatable , context )
53- context .vaccine_df .loc [0 ,[ "NHS_NUMBER" ] ] = "12345678"
54- context .vaccine_df .loc [1 ,[ "NHS_NUMBER" ] ] = "1234567890"
55- context .vaccine_df .loc [2 ,[ "PERSON_FORENAME" ] ] = ""
53+ context .vaccine_df .loc [0 ,"NHS_NUMBER" ] = "12345678"
54+ context .vaccine_df .loc [1 ,"NHS_NUMBER" ] = "1234567890"
55+ context .vaccine_df .loc [2 ,"PERSON_FORENAME" ] = ""
5656 context .vaccine_df .loc [3 ,["PERSON_FORENAME" , "PERSON_SURNAME" ]] = ""
57- context .vaccine_df .loc [4 ,[ "PERSON_SURNAME" ] ] = ""
58- context .vaccine_df .loc [5 ,[ "PERSON_GENDER_CODE" ] ] = "8"
59- context .vaccine_df .loc [6 ,[ "PERSON_GENDER_CODE" ] ] = "unknow"
60- context .vaccine_df .loc [7 ,[ "PERSON_GENDER_CODE" ] ] = ""
61- context .vaccine_df .loc [8 ,[ "PERSON_FORENAME" ] ] = " "
62- context .vaccine_df .loc [9 ,[ "PERSON_SURNAME" ] ] = " "
63- context .vaccine_df .loc [10 ,[ "PERSON_SURNAME" ] ] = get_text ("name_length_36" )
64- context .vaccine_df .loc [11 ,[ "PERSON_FORENAME" ] ] = get_text ("name_length_36" )
57+ context .vaccine_df .loc [4 ,"PERSON_SURNAME" ] = ""
58+ context .vaccine_df .loc [5 ,"PERSON_GENDER_CODE" ] = "8"
59+ context .vaccine_df .loc [6 ,"PERSON_GENDER_CODE" ] = "unknow"
60+ context .vaccine_df .loc [7 ,"PERSON_GENDER_CODE" ] = ""
61+ context .vaccine_df .loc [8 ,"PERSON_FORENAME" ] = " "
62+ context .vaccine_df .loc [9 ,"PERSON_SURNAME" ] = " "
63+ context .vaccine_df .loc [10 ,"PERSON_SURNAME" ] = get_text ("name_length_36" )
64+ context .vaccine_df .loc [11 ,"PERSON_FORENAME" ] = get_text ("name_length_36" )
6565 create_batch_file (context )
6666
6767@given ("batch file is created for below data where performer detail has invalid data" )
6868@ignore_if_local_run
6969def valid_batch_file_is_created_with_invalid_performer_data (datatable , context ):
7070 build_dataFrame_using_datatable (datatable , context )
71- context .vaccine_df .loc [0 ,[ "PERFORMING_PROFESSIONAL_FORENAME" ] ] = ""
72- context .vaccine_df .loc [1 ,[ "PERFORMING_PROFESSIONAL_SURNAME" ] ] = ""
71+ context .vaccine_df .loc [0 ,"PERFORMING_PROFESSIONAL_FORENAME" ] = ""
72+ context .vaccine_df .loc [1 ,"PERFORMING_PROFESSIONAL_SURNAME" ] = ""
7373 create_batch_file (context )
7474
7575@given ("batch file is created for below data where person detail has valid values" )
7676@ignore_if_local_run
7777def valid_batch_file_is_created_with_different_values_gender (datatable , context ):
7878 build_dataFrame_using_datatable (datatable , context )
79- context .vaccine_df .loc [0 ,["PERSON_GENDER_CODE" ]] = "0"
80- context .vaccine_df .loc [1 ,["PERSON_GENDER_CODE" ]] = "1"
81- context .vaccine_df .loc [2 ,["PERSON_GENDER_CODE" ]] = "2"
82- context .vaccine_df .loc [3 ,["PERSON_GENDER_CODE" ]] = "9"
83- context .vaccine_df .loc [4 ,["PERSON_GENDER_CODE" ]] = "unknown"
84- context .vaccine_df .loc [5 ,["PERSON_GENDER_CODE" ]] = "male"
85- context .vaccine_df .loc [6 ,["PERSON_GENDER_CODE" ]] = "female"
86- context .vaccine_df .loc [7 ,["PERSON_GENDER_CODE" ]] = "other"
87- context .vaccine_df .loc [8 ,["PERSON_SURNAME" ]] = get_text ("name_length_35" )
88- context .vaccine_df .loc [9 ,["PERSON_FORENAME" ]] = get_text ("name_length_35" )
89- context .vaccine_df .loc [10 ,["PERSON_FORENAME" ]] = f'Elan { get_text ("name_length_15" )} '
79+ context .vaccine_df .loc [0 ,"PERSON_GENDER_CODE" ] = "0"
80+ context .vaccine_df .loc [1 ,"PERSON_GENDER_CODE" ] = "1"
81+ context .vaccine_df .loc [2 ,"PERSON_GENDER_CODE" ] = "2"
82+ context .vaccine_df .loc [3 ,"PERSON_GENDER_CODE" ] = "9"
83+ context .vaccine_df .loc [4 ,"PERSON_GENDER_CODE" ] = "unknown"
84+ context .vaccine_df .loc [5 ,"PERSON_GENDER_CODE" ] = "male"
85+ context .vaccine_df .loc [6 ,"PERSON_GENDER_CODE" ] = "female"
86+ context .vaccine_df .loc [7 ,"PERSON_GENDER_CODE" ] = "other"
87+ context .vaccine_df .loc [8 ,"PERSON_SURNAME" ] = get_text ("name_length_35" )
88+ context .vaccine_df .loc [9 ,"PERSON_FORENAME" ] = get_text ("name_length_35" )
89+ context .vaccine_df .loc [10 ,"PERSON_FORENAME" ] = f'Elan { get_text ("name_length_15" )} '
90+ create_batch_file (context )
91+
92+ @given ("batch file is created for below data where mandatory fields for site, location, action flag, primary source and unique identifiers are missing" )
93+ @ignore_if_local_run
94+ def valid_batch_file_is_created_with_missing_mandatory_fields (datatable , context ):
95+ build_dataFrame_using_datatable (datatable , context )
96+ context .vaccine_df .loc [0 , "SITE_CODE" ] = ""
97+ context .vaccine_df .loc [1 , "SITE_CODE_TYPE_URI" ] = ""
98+ context .vaccine_df .loc [2 , "LOCATION_CODE" ] = ""
99+ context .vaccine_df .loc [3 , "LOCATION_CODE_TYPE_URI" ] = ""
100+ context .vaccine_df .loc [4 , ["UNIQUE_ID" ,"PERSON_SURNAME" ]] = ["" , "no_unique_identifiers" ]
101+ context .vaccine_df .loc [5 , ["UNIQUE_ID_URI" , "PERSON_SURNAME" ]] = ["" , "no_unique_identifiers" ]
102+ context .vaccine_df .loc [6 , "PRIMARY_SOURCE" ] = ""
103+ context .vaccine_df .loc [7 , "VACCINATION_PROCEDURE_CODE" ] = ""
104+ context .vaccine_df .loc [8 , "SITE_CODE" ] = " "
105+ context .vaccine_df .loc [9 , "SITE_CODE_TYPE_URI" ] = " "
106+ context .vaccine_df .loc [10 , "LOCATION_CODE" ] = " "
107+ context .vaccine_df .loc [11 , "LOCATION_CODE_TYPE_URI" ] = " "
108+ context .vaccine_df .loc [12 , ["UNIQUE_ID" ,"PERSON_SURNAME" ]] = [" " , "no_unique_id" ]
109+ context .vaccine_df .loc [13 , ["UNIQUE_ID_URI" , "PERSON_SURNAME" ]] = [" " , "no_unique_id_uri" ]
110+ context .vaccine_df .loc [14 , "PRIMARY_SOURCE" ] = " "
111+ context .vaccine_df .loc [15 , "VACCINATION_PROCEDURE_CODE" ] = " "
112+ context .vaccine_df .loc [16 , "PRIMARY_SOURCE" ] = "test"
113+ context .vaccine_df .loc [17 , "ACTION_FLAG" ] = ""
114+ context .vaccine_df .loc [18 , "ACTION_FLAG" ] = " "
115+ create_batch_file (context )
116+
117+ @given ("batch file is created for below data where mandatory field for site, location and unique uri values are invalid" )
118+ @ignore_if_local_run
119+ def valid_batch_file_is_created_with_invalid_mandatory_fields (datatable , context ):
120+ build_dataFrame_using_datatable (datatable , context )
121+ context .vaccine_df .loc [0 , "UNIQUE_ID_URI" ] = "invalid_uri"
122+ context .vaccine_df .loc [1 , "SITE_CODE_TYPE_URI" ] = "invalid_uri"
123+ context .vaccine_df .loc [2 , "LOCATION_CODE_TYPE_URI" ] = "invalid_uri"
124+ create_batch_file (context )
125+
126+
127+ @given ("batch file is created for below data where action flag has different cases" )
128+ @ignore_if_local_run
129+ def valid_batch_file_is_created_with_different_action_flag_cases (datatable , context ):
130+ build_dataFrame_using_datatable (datatable , context )
131+ context .vaccine_df .loc [0 , "ACTION_FLAG" ] = "NEW"
132+ context .vaccine_df .loc [1 , "ACTION_FLAG" ] = "New"
133+ context .vaccine_df .loc [2 , "ACTION_FLAG" ] = "new"
134+ context .vaccine_df .loc [3 , "ACTION_FLAG" ] = "nEw"
135+ create_batch_file (context )
136+
137+
138+ @given ("batch file is created for below data where non mandatory fields are empty string" )
139+ @ignore_if_local_run
140+ def valid_batch_file_is_created_with_empty_non_mandatory_fields (datatable , context ):
141+ build_dataFrame_using_datatable (datatable , context )
142+ context .vaccine_df .loc [0 , "NHS_NUMBER" ] = " "
143+ context .vaccine_df .loc [1 , "VACCINATION_PROCEDURE_TERM" ] = " "
144+ context .vaccine_df .loc [2 , "VACCINE_PRODUCT_CODE" ] = " "
145+ context .vaccine_df .loc [3 , "VACCINE_PRODUCT_TERM" ] = " "
146+ context .vaccine_df .loc [4 , "VACCINE_MANUFACTURER" ] = " "
147+ context .vaccine_df .loc [5 , "BATCH_NUMBER" ] = " "
148+ context .vaccine_df .loc [6 , "SITE_OF_VACCINATION_CODE" ] = " "
149+ context .vaccine_df .loc [7 , "SITE_OF_VACCINATION_TERM" ] = " "
150+ context .vaccine_df .loc [8 , "ROUTE_OF_VACCINATION_CODE" ] = " "
151+ context .vaccine_df .loc [9 , "ROUTE_OF_VACCINATION_TERM" ] = " "
152+ context .vaccine_df .loc [10 , "DOSE_SEQUENCE" ] = " "
153+ context .vaccine_df .loc [11 , "DOSE_UNIT_CODE" ] = " "
154+ context .vaccine_df .loc [12 , "DOSE_UNIT_TERM" ] = " "
155+ context .vaccine_df .loc [13 , "INDICATION_CODE" ] = " "
156+ create_batch_file (context )
157+
158+ @given ("batch file is created for below data where non mandatory fields are missing" )
159+ @ignore_if_local_run
160+ def valid_batch_file_is_created_with_missing_non_mandatory_fields (datatable , context ):
161+ build_dataFrame_using_datatable (datatable , context )
162+ context .vaccine_df .loc [0 , "NHS_NUMBER" ] = ""
163+ context .vaccine_df .loc [1 , "VACCINATION_PROCEDURE_TERM" ] = ""
164+ context .vaccine_df .loc [2 , "VACCINE_PRODUCT_CODE" ] = ""
165+ context .vaccine_df .loc [3 , "VACCINE_PRODUCT_TERM" ] = ""
166+ context .vaccine_df .loc [4 , "VACCINE_MANUFACTURER" ] = ""
167+ context .vaccine_df .loc [5 , "BATCH_NUMBER" ] = ""
168+ context .vaccine_df .loc [6 , "SITE_OF_VACCINATION_CODE" ] = ""
169+ context .vaccine_df .loc [7 , "SITE_OF_VACCINATION_TERM" ] = ""
170+ context .vaccine_df .loc [8 , "ROUTE_OF_VACCINATION_CODE" ] = ""
171+ context .vaccine_df .loc [9 , "ROUTE_OF_VACCINATION_TERM" ] = ""
172+ context .vaccine_df .loc [10 , "DOSE_SEQUENCE" ] = ""
173+ context .vaccine_df .loc [11 , "DOSE_UNIT_CODE" ] = ""
174+ context .vaccine_df .loc [12 , "DOSE_UNIT_TERM" ] = ""
175+ context .vaccine_df .loc [13 , "INDICATION_CODE" ] = ""
90176 create_batch_file (context )
91177
92178@then ("all records are rejected in the bus ack file and no imms id is generated" )
0 commit comments