Sha256: d4d2986f767e391594568a2d408529aabb2400b2f0c712ccb8555a66722137b5

Contents?: true

Size: 869 Bytes

Versions: 4

Compression:

Stored size: 869 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_observations(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)
        MessageParamParser.new(message_payload).parse
      end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc6 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/pathology/message_listener.rb
renalware-core-2.0.0.pre.rc3 app/models/renalware/pathology/message_listener.rb