Skip to content

Commit e8e9f94

Browse files
committed
Consume performer display name from Imms record
* Write this to the Notes if it is present * We already record the ods code - we're only recording this as extra information Jira-Issue: MAV-5717
1 parent 142504c commit e8e9f94

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

app/lib/fhir_mapper/vaccination_record.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,16 @@ def self.from_fhir_record(fhir_record, patient:)
110110
)
111111
end
112112

113-
performer_ods_code = org_performer_ods_code_from_fhir(fhir_record)
113+
org_actor = org_performer_actor_from_fhir(fhir_record)
114+
performer_ods_code = org_actor&.identifier&.value
114115
unless performer_ods_code == FHIRMapper::Location::UNKNOWN_IDENTIFIER
115116
attrs[:performed_ods_code] = performer_ods_code
116117
end
117118

119+
if org_actor&.display.present?
120+
notes << "Performing organisation display name: #{org_actor.display}"
121+
end
122+
118123
user_performer_name = user_performer_name_from_fhir(fhir_record)
119124
attrs[:performed_by_given_name] = user_performer_name&.given&.first
120125
attrs[:performed_by_family_name] = user_performer_name&.family
@@ -332,10 +337,8 @@ def fhir_org_performer
332337
)
333338
end
334339

335-
private_class_method def self.org_performer_ods_code_from_fhir(fhir_record)
336-
org_actor =
337-
fhir_record.performer.find { it.actor&.type == "Organization" }&.actor
338-
org_actor&.identifier&.value
340+
private_class_method def self.org_performer_actor_from_fhir(fhir_record)
341+
fhir_record.performer.find { it.actor&.type == "Organization" }&.actor
339342
end
340343

341344
def fhir_reason_code

spec/lib/fhir_mapper/vaccination_record_spec.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,9 @@
701701
its(:performed_ods_code) { should eq "B0C4P" }
702702
its(:nhs_immunisations_api_primary_source) { should be true }
703703

704-
its(:notes) { should be_nil }
704+
its(:notes) do
705+
should eq "Performing organisation display name: Acme Healthcare"
706+
end
705707
end
706708

707709
context "with a record with not full dose" do
@@ -742,7 +744,9 @@
742744
its(:performed_ods_code) { should eq "B0C4P" }
743745
its(:nhs_immunisations_api_primary_source) { should be true }
744746

745-
its(:notes) { should be_nil }
747+
its(:notes) do
748+
should eq "Performing organisation display name: Acme Healthcare"
749+
end
746750
end
747751

748752
context "with a record with an unexpected dose unit, and is nasal flu" do
@@ -784,7 +788,9 @@
784788
its(:location_name) { should be_nil }
785789
its(:performed_ods_code) { should eq "B0C4P" }
786790

787-
its(:notes) { should be_nil }
791+
its(:notes) do
792+
should eq "Performing organisation display name: Acme Healthcare"
793+
end
788794
end
789795

790796
context "with a record with extended milliliter description" do

0 commit comments

Comments
 (0)