lib/segments/pid.rb in ruby-hl7-1.3.3 vs lib/segments/pid.rb in ruby-hl7-1.4.0
- old
+ new
@@ -1,24 +1,21 @@
-# encoding: UTF-8
+# frozen_string_literal: true
+
class HL7::Message::Segment::PID < HL7::Message::Segment
weight 1
- has_children [:NK1,:NTE,:PV1,:PV2]
+ has_children %i[NK1 NTE PV1 PV2]
add_field :set_id
add_field :patient_id
add_field :patient_id_list
add_field :alt_patient_id
add_field :patient_name
add_field :mother_maiden_name
add_field :patient_dob do |value|
convert_to_ts(value)
end
add_field :admin_sex do |sex|
- unless /^[FMOUANC]$/.match(sex) || sex == nil || sex == ""
- raise HL7::InvalidDataError.new( "bad administrative sex value (not F|M|O|U|A|N|C)" )
- end
- sex = "" unless sex
- sex
+ sanitize_admin_sex!(sex)
end
add_field :patient_alias
add_field :race
add_field :address
add_field :county_code
@@ -41,11 +38,11 @@
add_field :death_date do |value|
convert_to_ts(value)
end
add_field :death_indicator
add_field :id_unknown_indicator
- add_field :id_readability_code
+ add_field :id_reliability_code
add_field :last_update_date do |value|
convert_to_ts(value)
end
add_field :last_update_facility
add_field :species_code
@@ -53,16 +50,28 @@
add_field :strain
add_field :production_class_code
add_field :tribal_citizenship
def country_code
- warn "DEPRECATION WARNING: PID-12 is defined as 'county_code'; "+
+ warn "DEPRECATION WARNING: PID-12 is defined as 'county_code'; " \
"the 'country_code' alias is retained for backwards compatibility only."
county_code
end
def country_code=(country_code)
- warn "DEPRECATION WARNING: PID-12 is defined as 'county_code'; "+
+ warn "DEPRECATION WARNING: PID-12 is defined as 'county_code'; " \
"the 'country_code' alias is retained for backwards compatibility only."
self.county_code = country_code
+ end
+
+ def id_readability_code
+ warn "DEPRECATION WARNING: PID-32 is defined as 'id_reliability_code'; " \
+ "the 'id_readability_code' alias is retained for backwards compatibility only."
+ id_reliability_code
+ end
+
+ def id_readability_code=(code)
+ warn "DEPRECATION WARNING: PID-32 is defined as 'id_reliability_code'; " \
+ "the 'id_readability_code' alias is retained for backwards compatibility only."
+ self.id_reliability_code = code
end
end