Class: Renalware::Feeds::HL7Message
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Renalware::Feeds::HL7Message
- Defined in:
- app/models/renalware/feeds/hl7_message.rb
Overview
Responsible for representing an HL7 message. Fields can be queried via chained method calls. For example, accessing the patient identifier field in the PID segment can be accessed by calling:
HL7Message.new().patient_identification.internal_id
Defined Under Namespace
Classes: Observation, ObservationRequest, PatientIdentification
Instance Method Summary collapse
- #header_id ⇒ Object
-
#initialize(message_string) ⇒ HL7Message
constructor
A new instance of HL7Message.
-
#observation_requests ⇒ Object
There is a problem here is there are < 1 OBR i.e.
- #patient_identification ⇒ Object
- #to_s ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(message_string) ⇒ HL7Message
Returns a new instance of HL7Message.
14 15 16 17 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 14 def initialize() @message_string = super(::HL7::Message.new(.lines)) end |
Instance Method Details
#header_id ⇒ Object
144 145 146 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 144 def header_id self[:MSH]. end |
#observation_requests ⇒ Object
There is a problem here is there are < 1 OBR i.e. self could be an array
104 105 106 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 104 def observation_requests Array(self[:OBR]).map{ |obr| ObservationRequest.new(obr) } end |
#patient_identification ⇒ Object
136 137 138 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 136 def patient_identification PatientIdentification.new(self[:PID]) end |
#to_s ⇒ Object
148 149 150 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 148 def to_s @message_string.tr("\r", "\n") end |
#type ⇒ Object
140 141 142 |
# File 'app/models/renalware/feeds/hl7_message.rb', line 140 def type self[:MSH]. end |