Class: Renalware::Feeds::HL7Message::ObservationRequest

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/models/renalware/feeds/hl7_message.rb

Instance Method Summary collapse

Constructor Details

#initialize(observation_request_segment) ⇒ ObservationRequest

Returns a new instance of ObservationRequest.



31
32
33
# File 'app/models/renalware/feeds/hl7_message.rb', line 31

def initialize(observation_request_segment)
  super(observation_request_segment)
end

Instance Method Details

#identifierObject



35
36
37
# File 'app/models/renalware/feeds/hl7_message.rb', line 35

def identifier
  universal_service_id.split("^").first
end

#nameObject



39
40
41
# File 'app/models/renalware/feeds/hl7_message.rb', line 39

def name
  universal_service_id.split("^")[1]
end

#observationsObject

Select only OBX children. OBR can have other types of child segments but we want to ignore those.



45
46
47
48
49
50
51
# File 'app/models/renalware/feeds/hl7_message.rb', line 45

def observations
  @observations ||= begin
    children
      .select { |segment| segment.is_a? HL7::Message::Segment::OBX }
      .map { |obx_segment| Observation.new(obx_segment) }
  end
end

#ordering_provider_nameObject



53
54
55
# File 'app/models/renalware/feeds/hl7_message.rb', line 53

def ordering_provider_name
  ordering_provider.last
end

#placer_order_numberObject



57
58
59
# File 'app/models/renalware/feeds/hl7_message.rb', line 57

def placer_order_number
  super.split("^").first
end