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.41 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.40 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.39 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.38 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.37 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.36 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.35 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.34 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.33 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.32 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.31 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.30 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.28 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.27 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.26 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.25 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.24 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.23 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.22 app/models/renalware/patients/message_param_parser.rb
renalware-core-2.0.21 app/models/renalware/patients/message_param_parser.rb