Skip to content

Commit 6249286

Browse files
Add columns for product code and term from Imms API records
These columns will be used to save the SNOMED product code and product term for records which we pull from the Imms API. This will be useful for us to query when investigating for the Vaccs History Alpha. The product code is already used when assigning the `Vaccine` for the record. However, the records which we ingest have more product codes than we have `Vaccine` objects; the range of codes which we get is so broad that we can't map all of them to `Vaccine` objects. The solution until now was to save these denormalised in the notes, but this solution will make it much easier to query them. It's also possible for the terms to be different, despite having the same codes; it would be useful to be able to analyse this. Jira-Issue: MAV-5901
1 parent 74462d8 commit 6249286

5 files changed

Lines changed: 21 additions & 1 deletion

File tree

app/models/vaccination_record.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
# nhs_immunisations_api_recorded_at :datetime
2424
# nhs_immunisations_api_snomed_procedure_code :string
2525
# nhs_immunisations_api_snomed_procedure_term :string
26+
# nhs_immunisations_api_snomed_product_code :string
27+
# nhs_immunisations_api_snomed_product_term :string
2628
# nhs_immunisations_api_snomed_reason_code :string
2729
# nhs_immunisations_api_snomed_reason_term :string
2830
# nhs_immunisations_api_sync_pending_at :datetime
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
class AddNHSImmunisationsAPISnomedProductToVaccinationRecords < ActiveRecord::Migration[
4+
8.1
5+
]
6+
def change
7+
change_table :vaccination_records, bulk: true do |t|
8+
t.string :nhs_immunisations_api_snomed_product_code
9+
t.string :nhs_immunisations_api_snomed_product_term
10+
end
11+
end
12+
end

db/schema.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.1].define(version: 2026_03_31_110000) do
13+
ActiveRecord::Schema[8.1].define(version: 2026_04_07_120000) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_catalog.plpgsql"
1616
enable_extension "pg_trgm"
@@ -1007,6 +1007,8 @@
10071007
t.datetime "nhs_immunisations_api_recorded_at"
10081008
t.string "nhs_immunisations_api_snomed_procedure_code"
10091009
t.string "nhs_immunisations_api_snomed_procedure_term"
1010+
t.string "nhs_immunisations_api_snomed_product_code"
1011+
t.string "nhs_immunisations_api_snomed_product_term"
10101012
t.string "nhs_immunisations_api_snomed_reason_code"
10111013
t.string "nhs_immunisations_api_snomed_reason_term"
10121014
t.datetime "nhs_immunisations_api_sync_pending_at"

spec/factories/vaccination_records.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
# nhs_immunisations_api_recorded_at :datetime
2424
# nhs_immunisations_api_snomed_procedure_code :string
2525
# nhs_immunisations_api_snomed_procedure_term :string
26+
# nhs_immunisations_api_snomed_product_code :string
27+
# nhs_immunisations_api_snomed_product_term :string
2628
# nhs_immunisations_api_snomed_reason_code :string
2729
# nhs_immunisations_api_snomed_reason_term :string
2830
# nhs_immunisations_api_sync_pending_at :datetime

spec/models/vaccination_record_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
# nhs_immunisations_api_recorded_at :datetime
2424
# nhs_immunisations_api_snomed_procedure_code :string
2525
# nhs_immunisations_api_snomed_procedure_term :string
26+
# nhs_immunisations_api_snomed_product_code :string
27+
# nhs_immunisations_api_snomed_product_term :string
2628
# nhs_immunisations_api_snomed_reason_code :string
2729
# nhs_immunisations_api_snomed_reason_term :string
2830
# nhs_immunisations_api_sync_pending_at :datetime

0 commit comments

Comments
 (0)