Skip to content

Commit df766ce

Browse files
Merge pull request #5653 from nhsuk/alistair/national-reporting-ignore-headers
National reporting - ignore more headers
2 parents 4dc8d70 + b753f26 commit df766ce

2 files changed

Lines changed: 46 additions & 6 deletions

File tree

app/models/immunisation_import_row.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ def care_setting = poc? ? @data[:care_setting] : nil
207207
def clinic_name =
208208
poc? ? @data[:clinic_name].presence || @data[:event_done_at] : nil
209209

210-
def combined_vaccination_and_dose_sequence = @data[:vaccination_type]
210+
def combined_vaccination_and_dose_sequence =
211+
poc? ? @data[:vaccination_type] : nil
211212

212213
def date_of_vaccination =
213214
@data[:date_of_vaccination].presence || @data[:event_date]
@@ -216,7 +217,7 @@ def delivery_site = @data[:anatomical_site]
216217

217218
def dose_sequence = @data[:dose_sequence]
218219

219-
def location_type = @data[:event_location_type]
220+
def location_type = poc? ? @data[:event_location_type] : nil
220221

221222
def notes = poc? ? @data[:notes] : nil
222223

@@ -246,7 +247,7 @@ def performed_ods_code = @data[:organisation_code]
246247

247248
def programme_name = poc? ? @data[:programme] : nil
248249

249-
def reason_not_administered = @data[:reason_not_vaccinated]
250+
def reason_not_administered = poc? ? @data[:reason_not_vaccinated] : nil
250251

251252
def school_name =
252253
if poc?
@@ -258,7 +259,7 @@ def school_urn = @data[:school_urn].presence || @data[:school_code]
258259

259260
def session_id = poc? ? @data[:session_id] : nil
260261

261-
def supplied_by_email = @data[:supplier_email]
262+
def supplied_by_email = poc? ? @data[:supplier_email] : nil
262263

263264
def time_of_vaccination =
264265
@data[:time_of_vaccination].presence || @data[:event_time]

spec/models/immunisation_import_row_spec.rb

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,30 @@
10191019
end
10201020
end
10211021

1022+
shared_examples "when Mavis columns are present, which the bulk upload should ignore" do
1023+
let(:data) do
1024+
valid_bulk_flu_data.merge(
1025+
{
1026+
"PROGRAMME" => "HPV",
1027+
"PERFORMING_PROFESSIONAL_EMAIL" => "abc123@example.com",
1028+
"NOTES" => "Here are some notes",
1029+
"CARE_SETTING" => 2,
1030+
"CLINIC_NAME" => "The Hog's Head",
1031+
"SESSION_ID" => 1,
1032+
"UUID" => "ABCD1234-26cc-44e4-b886-c3cc90ba01b6",
1033+
"REASON_NOT_VACCINATED" => "Unwell",
1034+
"Vaccination type" => "HPV 1",
1035+
"EVENT_LOCATION_TYPE" => "school",
1036+
"SUPPLIER_EMAIL" => "abc@example.com"
1037+
}
1038+
)
1039+
end
1040+
1041+
it "ignores the Mavis columns" do
1042+
expect(immunisation_import_row).to be_valid
1043+
end
1044+
end
1045+
10221046
context "of unknown type (no VACCINE_GIVEN)" do
10231047
context "with an empty row" do
10241048
let(:data) { {} }
@@ -1096,6 +1120,8 @@
10961120
end
10971121

10981122
include_examples "when `VACCINATED` is `N`"
1123+
1124+
include_examples "when Mavis columns are present, which the bulk upload should ignore"
10991125
end
11001126

11011127
context "of type hpv" do
@@ -1127,6 +1153,8 @@
11271153
end
11281154

11291155
include_examples "when `VACCINATED` is `N`"
1156+
1157+
include_examples "when Mavis columns are present, which the bulk upload should ignore"
11301158
end
11311159
end
11321160
end
@@ -2311,7 +2339,11 @@
23112339
"CARE_SETTING" => 2,
23122340
"CLINIC_NAME" => "The Hog's Head",
23132341
"SESSION_ID" => session.id,
2314-
"UUID" => "ABCD1234-26cc-44e4-b886-c3cc90ba01b6"
2342+
"UUID" => "ABCD1234-26cc-44e4-b886-c3cc90ba01b6",
2343+
"REASON_NOT_VACCINATED" => "Unwell",
2344+
"Vaccination type" => "HPV 1",
2345+
"EVENT_LOCATION_TYPE" => "school",
2346+
"SUPPLIER_EMAIL" => "abc@example.com"
23152347
}
23162348
)
23172349
end
@@ -2331,10 +2363,13 @@
23312363
its(:notes) { should be_nil }
23322364

23332365
its(:location) { should eq location }
2366+
its(:location_name) { should be_nil }
23342367

23352368
its(:session) { should be_nil }
23362369

23372370
its(:uuid) { should_not eq "ABCD1234-26cc-44e4-b886-c3cc90ba01b6" }
2371+
2372+
its(:supplied_by) { should be_nil }
23382373
end
23392374

23402375
include_examples "accepts a VACCINE_GIVEN code",
@@ -2416,7 +2451,11 @@
24162451
"CARE_SETTING" => 2,
24172452
"CLINIC_NAME" => "The Hog's Head",
24182453
"SESSION_ID" => session.id,
2419-
"UUID" => "ABCD1234-26cc-44e4-b886-c3cc90ba01b6"
2454+
"UUID" => "ABCD1234-26cc-44e4-b886-c3cc90ba01b6",
2455+
"REASON_NOT_VACCINATED" => "Unwell",
2456+
"Vaccination type" => "flu 1",
2457+
"EVENT_LOCATION_TYPE" => "school",
2458+
"SUPPLIER_EMAIL" => "abc@example.com"
24202459
}
24212460
)
24222461
end

0 commit comments

Comments
 (0)