Sha256: a54b0b491a29bf96cfa7e7fd924ba11bfa5611b8a841c7e5551aae07fb13c9c2

Contents?: true

Size: 654 Bytes

Versions: 119

Compression:

Stored size: 654 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/patients"

module Renalware
  module Patients
    # Responsible for transforming an HL7 message payload into a params hash
    # that can be persisted by Patient.
    #
    class MessageParamParser
      def parse(hl7_message)
        pi = hl7_message.patient_identification

        {
          patient: {
            nhs_number: pi.external_id,
            local_patient_id: pi.internal_id,
            family_name: pi.family_name,
            given_name: pi.given_name,
            sex: pi.sex,
            born_on: Date.parse(pi.dob).to_s
          }
        }
      end
    end
  end
end

Version data entries

119 entries across 119 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.1.0 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.167 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.166 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.165 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.164 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.163 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.162 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.161 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.160 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.159 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.158 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.157 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.156 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.155 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.153 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.152 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.151 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.149 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.148 app/models/renalware/patients/message_param_parser.rb