Skip to content

Commit cef4424

Browse files
Add data migration to seed vaccines and re-sync Td/IPV records
Mavis vaccination records for Td/IPV using the Revaxis product have been being rejected by TPP for the last four weeks, due to an incorrect SNOMED code. This change seeds that new code in the database, and triggers a re-sync for all Td/IPV records which have in the past been sent to the API. Jira-Issue: MAV-7480
1 parent 7de67c7 commit cef4424

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# frozen_string_literal: true
2+
3+
class SeedAndResendTdIpvSnomedCode < ActiveRecord::Migration[8.1]
4+
def up
5+
Rails.logger.debug "Seeding vaccines"
6+
Rake::Task['vaccines:seed'].execute
7+
8+
unless HostingEnvironment.name.in?(%w[production test])
9+
Rails.logger.debug "Skipping resending of vaccination records to the Imms API; not in production or test"
10+
return
11+
end
12+
13+
vaccination_records = VaccinationRecord.where(programe_type: "td_ipv").synced_to_nhs_immunisations_api
14+
Rails.logger.debug "Enqueueing #{vaccination_records.count} vaccination records to be synced to the Imms API"
15+
vaccination_records.sync_all_to_nhs_immunisations_api
16+
17+
Rails.logger.debug "Enqueue complete"
18+
end
19+
20+
def down
21+
raise ActiveRecord::IrreversibleMigration
22+
end
23+
end

db/data_schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DataMigrate::Data.define(version: 2026_04_22_155320)
1+
DataMigrate::Data.define(version: 2026_04_30_172618)

0 commit comments

Comments
 (0)