Class: Renalware::Feeds::HL7Message::PatientIdentification
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Renalware::Feeds::HL7Message::PatientIdentification
- Defined in:
- app/models/renalware/feeds/hl7_message.rb
Instance Method Summary collapse
- #address ⇒ Object
- #family_name ⇒ Object
- #given_name ⇒ Object
- #internal_id ⇒ Object
- #name ⇒ Object
- #nhs_number ⇒ Object
-
#sex ⇒ Object
(also: #admin_sex)
We don’t use the HL7::Message#sex_admin method (from the ruby hl7 gem) because it raises an error during reading if the sex value in the PID is not in (F|M|O|U|A|N|C).
- #suffix ⇒ Object
- #title ⇒ Object
Instance Method Details
#address ⇒ Object
163 164 165 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 163 def address super.split("^") end |
#family_name ⇒ Object
147 148 149 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 147 def family_name patient_name[0] end |
#given_name ⇒ Object
151 152 153 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 151 def given_name patient_name[1] end |
#internal_id ⇒ Object
131 132 133 134 135 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 131 def internal_id return unless defined?(patient_id_list) patient_id_list.split("^").first end |
#name ⇒ Object
143 144 145 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 143 def name Name.new(patient_name) end |
#nhs_number ⇒ Object
137 138 139 140 141 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 137 def nhs_number return unless defined?(patient_id) patient_id.split("^").first end |
#sex ⇒ Object Also known as: admin_sex
We don’t use the HL7::Message#sex_admin method (from the ruby hl7 gem) because it raises an error during reading if the sex value in the PID is not in (F|M|O|U|A|N|C). I think that behaviour is a not quite right as a hospital might not use those values in their HL7 PID implementation, especially in the UK. KCH does not for instance. So instead we read the PID array directly, and map whatever is in there to its Renalware equivalent, then overwrite the existing #admin_sex method so the HL7::Message version cannot be called. If we can’t map it we just return whatever is in there and its up to calling code to handle any coercion issues. The hl7_pid_sex_map hash can be configured by the host app to support whatever sex values it uses intenrally. I think some work needs to be done on Renalware sex and gender (which are slightly conflated in Renalware). For example:
-
the LOINC names for administrative sex: Male Female Unknown (loinc.org/72143-1/)
-
the LOINC names for sex at birth: Male Female Unknown (loinc.org/LL3324-2/)
-
HL7’s definitions: F Female, M Male, O Other, U Unknown, A Ambiguous, N Not applicable
-
gender: 7 options loinc.org/76691-5/
182 183 184 185 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 182 def sex pid_sex = self[8]&.upcase Renalware.config.hl7_pid_sex_map.fetch(pid_sex, pid_sex) end |
#suffix ⇒ Object
155 156 157 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 155 def suffix patient_name[3] end |
#title ⇒ Object
159 160 161 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 159 def title patient_name[4] end |