Skip to content

Commit 3cce532

Browse files
Refactor source code to use upload_name
Instead of `nivs_name` Jira-Issue: MAV-2747
1 parent d40b89f commit 3cce532

11 files changed

Lines changed: 19 additions & 20 deletions

app/components/app_import_format_details_component.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def programme
230230
end
231231

232232
def vaccine_and_batch
233-
vaccines = team.vaccines.pluck(:nivs_name).map { tag.i(it) }
233+
vaccines = team.vaccines.pluck(:upload_name).map { tag.i(it) }
234234

235235
vaccines_sentence =
236236
vaccines.to_sentence(

app/lib/graph_records.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class GraphRecords
180180
uuid
181181
],
182182
programme: %i[type],
183-
vaccine: %i[nivs_name],
183+
vaccine: %i[upload_name],
184184
organisation: %i[ods_code],
185185
team: %i[name workgroup],
186186
subteam: %i[name],

app/lib/reports/offline_session_exporter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def add_existing_row_cells(row, vaccination_record:)
333333
)
334334
row[:programme] = programme.import_names.first
335335
row[:vaccine_given] = Cell.new(
336-
vaccine&.nivs_name,
336+
vaccine&.upload_name,
337337
allowed_values: vaccine_values_for_programme(programme)
338338
)
339339
row[:performing_professional_email] = Cell.new(
@@ -412,7 +412,7 @@ def vaccine_values_for_programme(programme)
412412
@vaccines[programme] ||= Vaccine
413413
.active
414414
.where_programme(programme)
415-
.pluck(:nivs_name)
415+
.pluck(:upload_name)
416416
end
417417

418418
def batch_values_for_programme(programme, existing_batch: nil)

app/lib/reports/programme_vaccinations_exporter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def row(vaccination_record:)
232232
vaccination_record.performed_at.to_date.iso8601,
233233
vaccination_record.performed_at.strftime("%H:%M:%S"),
234234
programme.name,
235-
vaccine&.nivs_name || "",
235+
vaccine&.upload_name || "",
236236
vaccination_record.protocol || "",
237237
vaccination_record.performed_by_user&.email || "",
238238
vaccination_record.performed_by&.given_name || "",

app/models/immunisation_import_row.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,13 @@ def protocol
357357
end
358358
end
359359

360-
def vaccine_nivs_name
360+
def vaccine_upload_name
361361
parsed_vaccination_description_string&.dig(:vaccine_name) ||
362362
vaccine_name&.to_s
363363
end
364364

365365
def vaccine
366-
@vaccine ||= team.vaccines.find_by(nivs_name: vaccine_nivs_name)
366+
@vaccine ||= team.vaccines.find_by(upload_name: vaccine_upload_name)
367367
end
368368

369369
def batch
@@ -1023,7 +1023,7 @@ def validate_vaccine
10231023
"is not given in the #{programme.name_in_sentence} programme"
10241024
)
10251025
end
1026-
elsif vaccine_nivs_name.present?
1026+
elsif vaccine_upload_name.present?
10271027
errors.add(field.header, "This vaccine is not available in this session.")
10281028
elsif offline_recording? && administered
10291029
if vaccine_name.nil?

lib/tasks/vaccines.rake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ namespace :vaccines do
2323
vaccine.dose_volume_ml = data["dose_volume_ml"]
2424
vaccine.manufacturer = data["manufacturer"]
2525
vaccine.method = data["method"]
26-
vaccine.nivs_name = data["nivs_name"]
2726
vaccine.upload_name = data["upload_name"]
2827
vaccine.snomed_product_term = data["snomed_product_term"]
2928
vaccine.disease_types = data["disease_types"]

spec/components/app_activity_log_component_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
performed_at: Time.zone.local(2025, 5, 31, 12, 0, 0, 1),
164164
performed_by: nil,
165165
notes: "Some notes millisecond later",
166-
vaccine: programmes.first.vaccines.find_by!(nivs_name: "Cervarix")
166+
vaccine: programmes.first.vaccines.find_by!(upload_name: "Cervarix")
167167
)
168168

169169
create(
@@ -302,7 +302,7 @@
302302
performed_at: Time.zone.local(2025, 5, 31, 13),
303303
performed_by: user,
304304
notes: "Some notes.",
305-
vaccine: programmes.first.vaccines.find_by!(nivs_name: "Gardasil")
305+
vaccine: programmes.first.vaccines.find_by!(upload_name: "Gardasil")
306306
)
307307
end
308308

spec/factories/vaccines.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
brand { Faker::Commerce.product_name }
3838
manufacturer { Faker::Company.name }
39-
sequence(:nivs_name) { |n| "#{brand.parameterize}-#{n}" }
39+
sequence(:upload_name) { |n| "#{brand.parameterize}-#{n}" }
4040
dose_volume_ml { Faker::Number.decimal(l_digits: 0) }
4141
snomed_product_code { Faker::Number.decimal_part(digits: 17) }
4242
snomed_product_term { Faker::Lorem.sentence }
@@ -192,7 +192,7 @@
192192
disease_types { data["disease_types"] }
193193
manufacturer { data["manufacturer"] }
194194
add_attribute(:method) { data["method"] }
195-
nivs_name { data["nivs_name"] }
195+
upload_name { data["upload_name"] }
196196
snomed_product_code { data["snomed_product_code"] }
197197
snomed_product_term { data["snomed_product_term"] }
198198
end

spec/features/import_vaccination_records_with_duplicates_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def and_an_existing_patient_record_exists
9393
)
9494
@third_patient_location =
9595
create(:patient_location, patient: @third_patient, session: @session)
96-
@vaccine = @programme.vaccines.find_by(nivs_name: "Gardasil9")
97-
@other_vaccine = @programme.vaccines.find_by(nivs_name: "Cervarix")
96+
@vaccine = @programme.vaccines.find_by(upload_name: "Gardasil9")
97+
@other_vaccine = @programme.vaccines.find_by(upload_name: "Cervarix")
9898
@batch = create(:batch, vaccine: @vaccine, name: "SomethingElse")
9999
@other_batch =
100100
create(:batch, vaccine: @other_vaccine, name: "CervarixBatch")

spec/lib/reports/offline_session_exporter_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def validation_formula(worksheet:, column_name:, row: 1)
311311
"TRIAGE_NOTES" => nil,
312312
"TRIAGE_STATUS" => nil,
313313
"VACCINATED" => "Y",
314-
"VACCINE_GIVEN" => vaccination_record.vaccine.nivs_name,
314+
"VACCINE_GIVEN" => vaccination_record.vaccine.upload_name,
315315
"UUID" => vaccination_record.uuid,
316316
"YEAR_GROUP" => patient.year_group(academic_year:),
317317
"REGISTRATION" => patient.registration
@@ -507,7 +507,7 @@ def validation_formula(worksheet:, column_name:, row: 1)
507507
"TRIAGE_NOTES" => nil,
508508
"TRIAGE_STATUS" => nil,
509509
"VACCINATED" => "Y",
510-
"VACCINE_GIVEN" => vaccination_record.vaccine.nivs_name,
510+
"VACCINE_GIVEN" => vaccination_record.vaccine.upload_name,
511511
"UUID" => vaccination_record.uuid,
512512
"YEAR_GROUP" => patient.year_group(academic_year:),
513513
"REGISTRATION" => patient.registration
@@ -955,7 +955,7 @@ def validation_formula(worksheet:, column_name:, row: 1)
955955
"TRIAGE_NOTES" => nil,
956956
"TRIAGE_STATUS" => nil,
957957
"VACCINATED" => "Y",
958-
"VACCINE_GIVEN" => vaccination_record.vaccine.nivs_name,
958+
"VACCINE_GIVEN" => vaccination_record.vaccine.upload_name,
959959
"UUID" => vaccination_record.uuid,
960960
"YEAR_GROUP" => patient.year_group(academic_year:),
961961
"REGISTRATION" => patient.registration

0 commit comments

Comments
 (0)