Class: Roqua::Healthy::A19::PhoneParser
- Inherits:
-
Object
- Object
- Roqua::Healthy::A19::PhoneParser
- Defined in:
- lib/roqua/healthy/a19/phone_parser.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(message) ⇒ PhoneParser
constructor
A new instance of PhoneParser.
-
#to_s ⇒ Object
this is a heuristic to pick likely dutch cell phone numbers from hl7 messages.
Constructor Details
#initialize(message) ⇒ PhoneParser
Returns a new instance of PhoneParser.
8 9 10 |
# File 'lib/roqua/healthy/a19/phone_parser.rb', line 8 def initialize() @message = end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/roqua/healthy/a19/phone_parser.rb', line 6 def @message end |
Instance Method Details
#to_s ⇒ Object
this is a heuristic to pick likely dutch cell phone numbers from hl7 messages
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/roqua/healthy/a19/phone_parser.rb', line 13 def to_s pid13 = .fetch('PID').fetch('PID.13') # prefer PRN (Primary Residence Number) that contains a cell phone number phone_cell_record = pid13.find do |record| phone_cell_number?(record.fetch('PID.13.1', '') || '') && record.fetch('PID.13.2', :unknown_type_of_phone_record) == 'PRN' end # otherwise choose the first occuring cell phone number phone_cell_record ||= pid13.find do |record| phone_cell_number?(record.fetch('PID.13.1', '') || '') end # any number for which phone_cell_number? returns false is ignored strip_non_phone_number_characters(phone_cell_record.fetch('PID.13.1')) if phone_cell_record.present? end |