Sha256: e3409e672062895d15950afbfa2ea6b564afa4b3976c40addebd01d2635800e6

Contents?: true

Size: 724 Bytes

Versions: 64

Compression:

Stored size: 724 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/feeds"

module Renalware
  module Feeds
    class PersistMessage
      # hl7_message is an HL7Message (a decorator around ::HL7::Message)
      # If the same message is persisted twice we'll get an ActiveRecord::RecordNotUnique error
      # but that's fine as we don't want to process the same HL7 message twice.
      def call(hl7_message)
        Message.create!(
          event_code: hl7_message.type,
          header_id: hl7_message.header_id,
          body: hl7_message.to_s,
          body_hash: Digest::MD5.hexdigest(hl7_message.to_s),
          patient_identifier: hl7_message.patient_identification&.internal_id
        )
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
renalware-core-2.0.110 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.109 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.108 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.106 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.105 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.104 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.103 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.102 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.101 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.100 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.99 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.98 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.97 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.96 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.95 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.94 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.93 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.92 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.91 app/models/renalware/feeds/persist_message.rb
renalware-core-2.0.90 app/models/renalware/feeds/persist_message.rb