Skip to content

Commit 08c20a3

Browse files
Merge pull request #6487 from NHSDigital/mike/fallback-mmr-systmone-product-codes
Fallback to product-specific MMR codes when record has nil dose sequence
2 parents c24c8b5 + 720adad commit 08c20a3

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

app/lib/reports/systm_one_exporter.rb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,16 @@ class Reports::SystmOneExporter
3131
1 => "Y0da5",
3232
nil => "Y0da5"
3333
},
34+
"MMR VaxPro" => {
35+
nil => "Yb9ZN"
36+
},
3437
"Nimenrix" => {
3538
1 => "YOfcf",
3639
nil => "YOfcf"
3740
},
41+
"Priorix" => {
42+
nil => "Yav8l"
43+
},
3844
"Revaxis" => {
3945
1 => "Y3417",
4046
2 => "Y3418",
@@ -231,14 +237,14 @@ def vaccination(vaccination_record)
231237
vaccine_brand = vaccination_record.vaccine.brand
232238
dose_sequence = vaccination_record.dose_sequence
233239

234-
mapping =
235-
if programme.mmr?
240+
if programme.mmr?
241+
procedure_mapping =
236242
PROCEDURE_DOSE_MAPPINGS.dig(programme.variant_type, dose_sequence)
237-
else
238-
PRODUCT_DOSE_MAPPINGS.dig(vaccine_brand, dose_sequence)
239-
end
243+
return procedure_mapping if procedure_mapping.present?
244+
end
240245

241-
return mapping if mapping.present?
246+
product_mapping = PRODUCT_DOSE_MAPPINGS.dig(vaccine_brand, dose_sequence)
247+
return product_mapping if product_mapping.present?
242248

243249
dose_sequence ? "#{vaccine_brand} Part #{dose_sequence}" : vaccine_brand
244250
end

spec/lib/reports/systm_one_exporter_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,13 @@
298298
context "Priorix with unknown dose sequence" do
299299
let(:vaccine) { Vaccine.find_by!(brand: "Priorix") }
300300

301-
it { should eq("Priorix") }
301+
it { should eq("Yav8l") }
302302
end
303303

304304
context "MMR VaxPro with unknown dose sequence" do
305305
let(:vaccine) { Vaccine.find_by!(brand: "MMR VaxPro") }
306306

307-
it { should eq("MMR VaxPro") }
307+
it { should eq("Yb9ZN") }
308308
end
309309

310310
context "Priorix with dose sequence 1" do

0 commit comments

Comments
 (0)