Sha256: 677971afa6dfdce46ac2f79d2957c1f1ccb9d64c9f47c65e1e4cf3ed66026a3a

Contents?: true

Size: 662 Bytes

Versions: 30

Compression:

Stored size: 662 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(message_payload)
        pi = message_payload.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

30 entries across 30 versions & 1 rubygems

Version Path
renalware-core-2.0.20 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.18 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.17 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.16 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.15 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.14 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.13 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.12 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.11 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.9 app/models/renalware/patients/message_param_parser.rb