Sha256: bacb0a167cd2f012f538cec592be4e9a4b3b812b362bd735faa1f70f9476c31f

Contents?: true

Size: 999 Bytes

Versions: 14

Compression:

Stored size: 999 Bytes

Contents

require_dependency "renalware/pathology"

#
# When subscribed to HL7 `message_processed` messages, gets notified of incoming HL7 messages
# and creates the observations contained therein provided the patient exists.
#
module Renalware
  module Pathology
    class MessageListener
      def message_processed(message_payload)
        pathology_params = parse_pathology_params(message_payload)
        create_observation_requests_and_their_child_observations_from(pathology_params)
        #
        # Note: The the current_observation_set for the patient is updated by a trigger here
        #
      end

      private

      def parse_pathology_params(message_payload)
        ObservationRequestsAttributesBuilder.new(message_payload).parse
      end

      def create_observation_requests_and_their_child_observations_from(pathology_params)
        return if pathology_params.nil? # eg patient does not exist
        CreateObservationRequests.new.call(pathology_params)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.7 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.5 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.4 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.3 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.2 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.1 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.0 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/pathology/message_listener.rb