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
164 165 166 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 164 def address super.split("^") end |
#family_name ⇒ Object
148 149 150 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 148 def family_name patient_name[0] end |
#given_name ⇒ Object
152 153 154 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 152 def given_name patient_name[1] end |
#internal_id ⇒ Object
132 133 134 135 136 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 132 def internal_id return unless defined?(patient_id_list) patient_id_list.split("^").first end |
#name ⇒ Object
144 145 146 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 144 def name Name.new(patient_name) end |
#nhs_number ⇒ Object
138 139 140 141 142 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 138 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/
183 184 185 186 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 183 def sex pid_sex = self[8]&.upcase Renalware.config.hl7_pid_sex_map.fetch(pid_sex, pid_sex) end |
#suffix ⇒ Object
156 157 158 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 156 def suffix patient_name[3] end |
#title ⇒ Object
160 161 162 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 160 def title patient_name[4] end |