lib/roqua/healthy/a19/transformer.rb in roqua-healthy-1.5.6 vs lib/roqua/healthy/a19/transformer.rb in roqua-healthy-1.5.7

- old
+ new

@@ -22,10 +22,11 @@ message['PID']['PID.11'] = [message.fetch('PID').fetch('PID.11')].flatten.compact message['PID']['PID.13'] = [message.fetch('PID').fetch('PID.13')].flatten.compact @message = MessageCleaner.new(message).message end + # rubocop:disable Metrics/AbcSize, Metrics/MethodLength def to_patient { status: status, source: source, identities: identities, @@ -41,13 +42,15 @@ zipcode: address.zipcode, country: address.country, birthdate: birthdate, gender: gender, phone_cell: phone_cell, - medoq_data: medoq_data + medoq_data: medoq_data, + deceased: deceased } end + # rubocop:enable Metrics/AbcSize, Metrics/MethodLength def status 'SUCCESS' end @@ -100,9 +103,16 @@ PhoneParser.new(message).to_s end def gender message.dig('PID', 'PID.8', 'PID.8.1') + end + + def deceased + case message.dig('PID', 'PID.30', 'PID.30.1') + when 'Y' then true + when 'N' then false + end end private def name