Skip to content

Commit f0081a2

Browse files
Save product code and term from Imms API records
...to the newly added columns Jira-Issue: MAV-5901
1 parent 6249286 commit f0081a2

2 files changed

Lines changed: 141 additions & 0 deletions

File tree

app/lib/fhir_mapper/vaccination_record.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ def self.from_fhir_record(fhir_record, patient:)
158158
attrs[:nhs_immunisations_api_snomed_reason_code] = reason_coding&.code
159159
attrs[:nhs_immunisations_api_snomed_reason_term] = reason_coding&.display
160160

161+
product_coding = vaccine_product_coding_from_fhir(fhir_record)
162+
attrs[:nhs_immunisations_api_snomed_product_code] = product_coding&.code
163+
attrs[
164+
:nhs_immunisations_api_snomed_product_term
165+
] = product_coding&.display
166+
161167
attrs[:vaccine] = Vaccine.from_fhir_record(fhir_record)
162168
attrs[:batch_number] = fhir_record.lotNumber&.to_s
163169

@@ -376,6 +382,12 @@ def fhir_org_performer
376382
end
377383
end
378384

385+
private_class_method def self.vaccine_product_coding_from_fhir(fhir_record)
386+
fhir_record.vaccineCode&.coding&.find do
387+
it.system == "http://snomed.info/sct"
388+
end
389+
end
390+
379391
def fhir_reason_code
380392
FHIR::CodeableConcept.new(
381393
coding: [

spec/lib/fhir_mapper/vaccination_record_spec.rb

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,15 @@
722722
its(:nhs_immunisations_api_snomed_reason_term) do
723723
should eq "Disease outbreak (event)"
724724
end
725+
726+
its(:nhs_immunisations_api_snomed_product_code) do
727+
should eq "43207411000001105"
728+
end
729+
730+
its(:nhs_immunisations_api_snomed_product_term) do
731+
should eq "Cell-based trivalent influenza vaccine (surface antigen, inactivated) suspension for injection " \
732+
"0.5ml pre-filled syringes (Seqirus UK Ltd)"
733+
end
725734
end
726735

727736
context "with a record with not full dose" do
@@ -772,6 +781,14 @@
772781
should eq "Disease outbreak (event)"
773782
end
774783

784+
its(:nhs_immunisations_api_snomed_product_code) do
785+
should eq "43208811000001106"
786+
end
787+
788+
its(:nhs_immunisations_api_snomed_product_term) do
789+
should eq "Fluenz (trivalent) vaccine nasal suspension 0.2ml unit dose (AstraZeneca UK Ltd) (product)"
790+
end
791+
775792
its(:notes) do
776793
should eq "Performing organisation display name: Acme Healthcare"
777794
end
@@ -826,6 +843,14 @@
826843
should eq "Disease outbreak (event)"
827844
end
828845

846+
its(:nhs_immunisations_api_snomed_product_code) do
847+
should eq "43208811000001106"
848+
end
849+
850+
its(:nhs_immunisations_api_snomed_product_term) do
851+
should eq "Fluenz (trivalent) vaccine nasal suspension 0.2ml unit dose (AstraZeneca UK Ltd) (product)"
852+
end
853+
829854
its(:notes) do
830855
should eq "Performing organisation display name: Acme Healthcare"
831856
end
@@ -886,6 +911,14 @@
886911
its(:nhs_immunisations_api_snomed_reason_code) { should be_nil }
887912
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
888913

914+
its(:nhs_immunisations_api_snomed_product_code) do
915+
should eq "43208811000001106"
916+
end
917+
918+
its(:nhs_immunisations_api_snomed_product_term) do
919+
should eq "Fluenz (trivalent) vaccine nasal suspension 0.2ml unit dose (AstraZeneca UK Ltd)"
920+
end
921+
889922
its(:notes) { should be_nil }
890923
end
891924

@@ -941,6 +974,15 @@
941974
should eq "Disease outbreak (event)"
942975
end
943976

977+
its(:nhs_immunisations_api_snomed_product_code) do
978+
should eq "43207411000001106"
979+
end
980+
981+
its(:nhs_immunisations_api_snomed_product_term) do
982+
should eq "Cell-based trivalent influenza vaccine (surface antigen, inactivated) suspension for injection " \
983+
"0.5ml pre-filled syringes (Seqirus UK Ltd)"
984+
end
985+
944986
its(:notes) do
945987
should include(
946988
"SNOMED product code: 43207411000001106",
@@ -994,6 +1036,9 @@
9941036
its(:nhs_immunisations_api_snomed_reason_code) { should be_nil }
9951037
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
9961038

1039+
its(:nhs_immunisations_api_snomed_product_code) { should be_nil }
1040+
its(:nhs_immunisations_api_snomed_product_term) { should be_nil }
1041+
9971042
its(:notes) do
9981043
should include(
9991044
"Reported dose number string: Dose sequence not recorded"
@@ -1043,6 +1088,14 @@
10431088
its(:nhs_immunisations_api_snomed_reason_code) { should be_nil }
10441089
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
10451090

1091+
its(:nhs_immunisations_api_snomed_product_code) do
1092+
should eq "43208811000001106"
1093+
end
1094+
1095+
its(:nhs_immunisations_api_snomed_product_term) do
1096+
should eq "Fluenz (trivalent) vaccine nasal suspension 0.2ml unit dose (AstraZeneca UK Ltd)"
1097+
end
1098+
10461099
its(:notes) { should be_nil }
10471100
end
10481101

@@ -1086,6 +1139,15 @@
10861139
its(:nhs_immunisations_api_snomed_reason_code) { should be_nil }
10871140
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
10881141

1142+
its(:nhs_immunisations_api_snomed_product_code) do
1143+
should eq "43207411000001105"
1144+
end
1145+
1146+
its(:nhs_immunisations_api_snomed_product_term) do
1147+
should eq "Cell-based trivalent influenza vaccine (surface antigen, inactivated) suspension for injection " \
1148+
"0.5ml pre-filled syringes (Seqirus UK Ltd)"
1149+
end
1150+
10891151
its(:notes) { should be_nil }
10901152
end
10911153

@@ -1133,6 +1195,15 @@
11331195
its(:nhs_immunisations_api_snomed_reason_code) { should be_nil }
11341196
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
11351197

1198+
its(:nhs_immunisations_api_snomed_product_code) do
1199+
should eq "43207411000001105"
1200+
end
1201+
1202+
its(:nhs_immunisations_api_snomed_product_term) do
1203+
should eq "Cell-based trivalent influenza vaccine (surface antigen, inactivated) suspension for injection " \
1204+
"0.5ml pre-filled syringes (Seqirus UK Ltd)"
1205+
end
1206+
11361207
its(:notes) { should be_nil }
11371208
end
11381209

@@ -1185,6 +1256,14 @@
11851256
its(:nhs_immunisations_api_snomed_reason_code) { should eq "723620004" }
11861257
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
11871258

1259+
its(:nhs_immunisations_api_snomed_product_code) do
1260+
should eq "43208811000001106"
1261+
end
1262+
1263+
its(:nhs_immunisations_api_snomed_product_term) do
1264+
should eq "Fluenz (trivalent) vaccine nasal suspension 0.2ml unit dose (AstraZeneca UK Ltd) (product)"
1265+
end
1266+
11881267
its(:notes) { should be_nil }
11891268
end
11901269

@@ -1237,6 +1316,9 @@
12371316
its(:nhs_immunisations_api_snomed_reason_code) { should be_nil }
12381317
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
12391318

1319+
its(:nhs_immunisations_api_snomed_product_code) { should be_nil }
1320+
its(:nhs_immunisations_api_snomed_product_term) { should be_nil }
1321+
12401322
its(:notes) { should be_nil }
12411323
end
12421324

@@ -1281,6 +1363,9 @@
12811363
its(:nhs_immunisations_api_snomed_reason_code) { should be_nil }
12821364
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
12831365

1366+
its(:nhs_immunisations_api_snomed_product_code) { should be_nil }
1367+
its(:nhs_immunisations_api_snomed_product_term) { should be_nil }
1368+
12841369
its(:notes) do
12851370
should include(
12861371
"Reported dose number string: Dose sequence not recorded"
@@ -1345,6 +1430,15 @@
13451430
its(:nhs_immunisations_api_snomed_reason_code) { should eq "723620004" }
13461431
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
13471432

1433+
its(:nhs_immunisations_api_snomed_product_code) do
1434+
should eq "33493111000001108"
1435+
end
1436+
1437+
its(:nhs_immunisations_api_snomed_product_term) do
1438+
should eq "Gardasil 9 vaccine suspension for injection 0.5ml pre-filled syringes " \
1439+
"(Merck Sharp & Dohme (UK) Ltd) (product)"
1440+
end
1441+
13481442
its(:notes) { should be_nil }
13491443
end
13501444
end
@@ -1407,6 +1501,14 @@
14071501
its(:nhs_immunisations_api_snomed_reason_code) { should eq "723620004" }
14081502
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
14091503

1504+
its(:nhs_immunisations_api_snomed_product_code) do
1505+
should eq "39779611000001104"
1506+
end
1507+
1508+
its(:nhs_immunisations_api_snomed_product_term) do
1509+
should eq "MenQuadfi vaccine solution for injection 0.5ml vials (Sanofi) (product)"
1510+
end
1511+
14101512
its(:notes) { should include("Reported dose number string: Unknown") }
14111513
end
14121514
end
@@ -1469,6 +1571,15 @@
14691571
its(:nhs_immunisations_api_snomed_reason_code) { should eq "723620004" }
14701572
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
14711573

1574+
its(:nhs_immunisations_api_snomed_product_code) do
1575+
should eq "7374511000001107"
1576+
end
1577+
1578+
its(:nhs_immunisations_api_snomed_product_term) do
1579+
should eq "Revaxis vaccine suspension for injection 0.5ml pre-filled syringes (Sanofi) " \
1580+
"1 pre-filled disposable injection (product)"
1581+
end
1582+
14721583
its(:notes) { should include("Reported dose number string: Unknown") }
14731584
end
14741585
end
@@ -1535,6 +1646,15 @@
15351646
its(:nhs_immunisations_api_snomed_reason_code) { should eq "723620004" }
15361647
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
15371648

1649+
its(:nhs_immunisations_api_snomed_product_code) do
1650+
should eq "13968211000001108"
1651+
end
1652+
1653+
its(:nhs_immunisations_api_snomed_product_term) do
1654+
should eq "M-M-RVAXPRO vaccine powder and solvent for suspension for injection 0.5ml pre-filled syringes " \
1655+
"(Merck Sharp & Dohme (UK) Ltd) (product)"
1656+
end
1657+
15381658
its(:notes) { should include("Reported dose number string: Unknown") }
15391659
end
15401660
end
@@ -1601,6 +1721,15 @@
16011721
its(:nhs_immunisations_api_snomed_reason_code) { should eq "723620004" }
16021722
its(:nhs_immunisations_api_snomed_reason_term) { should be_nil }
16031723

1724+
its(:nhs_immunisations_api_snomed_product_code) do
1725+
should eq "45525711000001102"
1726+
end
1727+
1728+
its(:nhs_immunisations_api_snomed_product_term) do
1729+
should eq "Priorix Tetra vaccine powder and solvent for solution for injection 0.5ml pre-filled syringes " \
1730+
"(GlaxoSmithKline UK Ltd) (product)"
1731+
end
1732+
16041733
its(:notes) { should include("Reported dose number string: Unknown") }
16051734
end
16061735
end

0 commit comments

Comments
 (0)