ruby-hl7 0.2.50 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README +2 -2
- data/lib/ruby-hl7.rb +639 -621
- data/lib/segments/evn.rb +8 -8
- data/lib/segments/msa.rb +7 -7
- data/lib/segments/msh.rb +19 -19
- data/lib/segments/nte.rb +5 -5
- data/lib/segments/obr.rb +48 -47
- data/lib/segments/obx.rb +20 -19
- data/lib/segments/oru.rb +1 -1
- data/lib/segments/pid.rb +39 -39
- data/lib/segments/pv1.rb +53 -53
- data/lib/segments/pv2.rb +49 -49
- data/lib/segments/qrd.rb +13 -13
- data/lib/segments/qrf.rb +11 -11
- data/test/test_basic_parsing.rb +12 -1
- data/test/test_child_segment.rb +1 -1
- data/test/test_default_segment.rb +1 -1
- data/test/test_dynamic_segment_def.rb +1 -1
- data/test/test_msa_segment.rb +1 -1
- data/test/test_obr_segment.rb +5 -5
- data/test/test_obx_segment.rb +1 -1
- data/test/test_pid_segment.rb +1 -1
- data/test_data/empty_segments.hl7 +1 -1
- metadata +65 -64
data/lib/segments/evn.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# $Id
|
1
|
+
# $Id$
|
2
2
|
require 'ruby-hl7'
|
3
3
|
class HL7::Message::Segment::EVN < HL7::Message::Segment
|
4
4
|
weight 0 # should occur after the MSH segment
|
5
|
-
add_field :
|
6
|
-
add_field :
|
7
|
-
add_field :
|
8
|
-
add_field :
|
9
|
-
add_field :
|
10
|
-
add_field :
|
11
|
-
add_field :
|
5
|
+
add_field :type_code, :idx=>1
|
6
|
+
add_field :recorded_date, :idx=>2
|
7
|
+
add_field :planned_date, :idx=>3
|
8
|
+
add_field :reason_code, :idx=>4
|
9
|
+
add_field :operator_id, :idx=>5
|
10
|
+
add_field :event_occurred, :idx=>6
|
11
|
+
add_field :event_facility, :idx=>6
|
12
12
|
end
|
data/lib/segments/msa.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# $Id
|
1
|
+
# $Id$
|
2
2
|
require 'ruby-hl7'
|
3
3
|
class HL7::Message::Segment::MSA < HL7::Message::Segment
|
4
4
|
weight 0 # should occur after the msh segment
|
5
|
-
add_field :
|
6
|
-
add_field :
|
7
|
-
add_field :
|
8
|
-
add_field :
|
9
|
-
add_field :
|
10
|
-
add_field :
|
5
|
+
add_field :ack_code
|
6
|
+
add_field :control_id
|
7
|
+
add_field :text
|
8
|
+
add_field :expected_seq
|
9
|
+
add_field :delayed_ack_type
|
10
|
+
add_field :error_cond
|
11
11
|
end
|
12
12
|
|
data/lib/segments/msh.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
# $Id
|
1
|
+
# $Id$
|
2
2
|
require 'ruby-hl7'
|
3
3
|
class HL7::Message::Segment::MSH < HL7::Message::Segment
|
4
|
-
weight -1 # the msh should always start a message
|
5
|
-
add_field :
|
6
|
-
add_field :
|
7
|
-
add_field :
|
8
|
-
add_field :
|
9
|
-
add_field :
|
10
|
-
add_field :
|
11
|
-
add_field :
|
12
|
-
add_field :
|
13
|
-
add_field :
|
14
|
-
add_field :
|
15
|
-
add_field :
|
16
|
-
add_field :
|
17
|
-
add_field :
|
18
|
-
add_field :
|
19
|
-
add_field :
|
20
|
-
add_field :
|
21
|
-
add_field :
|
4
|
+
weight( -1 ) # the msh should always start a message
|
5
|
+
add_field :enc_chars, :idx=>1
|
6
|
+
add_field :sending_app, :idx=>2
|
7
|
+
add_field :sending_facility, :idx=>3
|
8
|
+
add_field :recv_app, :idx=>4
|
9
|
+
add_field :recv_facility, :idx=>5
|
10
|
+
add_field :time, :idx=>6
|
11
|
+
add_field :security, :idx=>7
|
12
|
+
add_field :message_type, :idx=>8
|
13
|
+
add_field :message_control_id, :idx=>9
|
14
|
+
add_field :processing_id, :idx=>10
|
15
|
+
add_field :version_id, :idx=>11
|
16
|
+
add_field :seq, :idx=>12
|
17
|
+
add_field :continue_ptr, :idx=>13
|
18
|
+
add_field :accept_ack_type, :idx=>14
|
19
|
+
add_field :app_ack_type, :idx=>15
|
20
|
+
add_field :country_code, :idx=>16
|
21
|
+
add_field :charset, :idx=>17
|
22
22
|
end
|
data/lib/segments/nte.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
# $Id
|
1
|
+
# $Id$
|
2
2
|
require 'ruby-hl7'
|
3
3
|
class HL7::Message::Segment::NTE < HL7::Message::Segment
|
4
4
|
weight 4
|
5
|
-
add_field :
|
6
|
-
add_field :
|
7
|
-
add_field :
|
8
|
-
add_field :
|
5
|
+
add_field :set_id, :idx=>1
|
6
|
+
add_field :source, :idx=>2
|
7
|
+
add_field :comment, :idx=>3
|
8
|
+
add_field :comment_type, :idx=>4
|
9
9
|
end
|
data/lib/segments/obr.rb
CHANGED
@@ -1,52 +1,53 @@
|
|
1
|
-
# $Id
|
1
|
+
# $Id$
|
2
2
|
require 'ruby-hl7'
|
3
3
|
class HL7::Message::Segment::OBR < HL7::Message::Segment
|
4
4
|
weight 89 # obr.weight-1
|
5
5
|
has_children [:OBX]
|
6
|
-
add_field :
|
7
|
-
add_field :
|
8
|
-
add_field :
|
9
|
-
add_field :
|
10
|
-
add_field :
|
11
|
-
add_field :
|
12
|
-
add_field :
|
13
|
-
add_field :
|
14
|
-
add_field :
|
15
|
-
add_field :
|
16
|
-
add_field :
|
17
|
-
add_field :
|
18
|
-
add_field :
|
19
|
-
add_field :
|
20
|
-
add_field :
|
21
|
-
add_field :
|
22
|
-
add_field :
|
23
|
-
add_field :
|
24
|
-
add_field :
|
25
|
-
add_field :
|
26
|
-
add_field :
|
27
|
-
add_field :
|
28
|
-
add_field :
|
29
|
-
add_field :
|
30
|
-
add_field :
|
31
|
-
add_field :
|
32
|
-
add_field :
|
33
|
-
add_field :
|
34
|
-
add_field :
|
35
|
-
add_field :
|
36
|
-
add_field :
|
37
|
-
add_field :
|
38
|
-
add_field :
|
39
|
-
add_field :
|
40
|
-
add_field :
|
41
|
-
add_field :
|
42
|
-
add_field :
|
43
|
-
add_field :
|
44
|
-
add_field :
|
45
|
-
add_field :
|
46
|
-
add_field :
|
47
|
-
add_field :
|
48
|
-
add_field :
|
49
|
-
add_field :
|
50
|
-
add_field :
|
51
|
-
add_field :name
|
6
|
+
add_field :set_id
|
7
|
+
add_field :placer_order_number
|
8
|
+
add_field :filler_order_number
|
9
|
+
add_field :universal_service_id
|
10
|
+
add_field :priority
|
11
|
+
add_field :requested_date
|
12
|
+
add_field :observation_date
|
13
|
+
add_field :observation_end_date
|
14
|
+
add_field :collection_volume
|
15
|
+
add_field :collector_identifier
|
16
|
+
add_field :specimen_action_code
|
17
|
+
add_field :danger_code
|
18
|
+
add_field :relevant_clinical_info
|
19
|
+
add_field :specimen_received_date
|
20
|
+
add_field :specimen_source
|
21
|
+
add_field :ordering_provider
|
22
|
+
add_field :order_callback_phone_number
|
23
|
+
add_field :placer_field_1
|
24
|
+
add_field :placer_field_2
|
25
|
+
add_field :filer_field_1
|
26
|
+
add_field :filer_field_2
|
27
|
+
add_field :results_status_change_date
|
28
|
+
add_field :charge_to_practice
|
29
|
+
add_field :parent_result
|
30
|
+
add_field :quantity_timing
|
31
|
+
add_field :result_copies_to
|
32
|
+
add_field :parent
|
33
|
+
add_field :transport_mode
|
34
|
+
add_field :reason_for_study
|
35
|
+
add_field :principal_result_interpreter
|
36
|
+
add_field :assistant_result_interpreter
|
37
|
+
add_field :technician
|
38
|
+
add_field :transcriptionist
|
39
|
+
add_field :scheduled_date
|
40
|
+
add_field :number_of_sample_containers
|
41
|
+
add_field :transport_logistics_of_sample
|
42
|
+
add_field :collectors_comment
|
43
|
+
add_field :transport_arrangement_responsibility
|
44
|
+
add_field :transport_arranged
|
45
|
+
add_field :escort_required
|
46
|
+
add_field :planned_patient_transport_comment
|
47
|
+
add_field :procedure_code
|
48
|
+
add_field :procedure_code_modifier
|
49
|
+
add_field :placer_supplemental_service_info
|
50
|
+
add_field :filler_supplemental_service_info
|
51
|
+
add_field :medically_necessary_dup_procedure_reason #longest method name ever. sry.
|
52
|
+
add_field :result_handling
|
52
53
|
end
|
data/lib/segments/obx.rb
CHANGED
@@ -1,25 +1,26 @@
|
|
1
|
-
# $Id
|
1
|
+
# $Id$
|
2
2
|
require 'ruby-hl7'
|
3
3
|
class HL7::Message::Segment::OBX < HL7::Message::Segment
|
4
4
|
weight 90
|
5
5
|
has_children [:NTE]
|
6
|
-
add_field :
|
7
|
-
add_field :
|
8
|
-
add_field :
|
9
|
-
add_field :
|
10
|
-
add_field :
|
11
|
-
add_field :
|
12
|
-
add_field :
|
13
|
-
add_field :
|
14
|
-
add_field :
|
15
|
-
add_field :
|
16
|
-
add_field :
|
17
|
-
add_field :
|
18
|
-
add_field :
|
19
|
-
add_field :
|
20
|
-
add_field :
|
21
|
-
add_field :
|
22
|
-
add_field :
|
23
|
-
add_field :
|
6
|
+
add_field :set_id
|
7
|
+
add_field :value_type
|
8
|
+
add_field :observation_id
|
9
|
+
add_field :observation_sub_id
|
10
|
+
add_field :observation_value
|
11
|
+
add_field :units
|
12
|
+
add_field :references_range
|
13
|
+
add_field :abnormal_flags
|
14
|
+
add_field :probability
|
15
|
+
add_field :nature_of_abnormal_test
|
16
|
+
add_field :observation_result_status
|
17
|
+
add_field :effective_date_of_reference_range
|
18
|
+
add_field :user_defined_access_checks
|
19
|
+
add_field :observation_date
|
20
|
+
add_field :producer_id
|
21
|
+
add_field :responsible_observer
|
22
|
+
add_field :observation_method
|
23
|
+
add_field :equipment_instance_id
|
24
|
+
add_field :analysis_date
|
24
25
|
end
|
25
26
|
|
data/lib/segments/oru.rb
CHANGED
data/lib/segments/pid.rb
CHANGED
@@ -1,49 +1,49 @@
|
|
1
|
-
# $Id
|
1
|
+
# $Id$
|
2
2
|
require 'ruby-hl7'
|
3
3
|
class HL7::Message::Segment::PID < HL7::Message::Segment
|
4
4
|
weight 1
|
5
|
-
add_field :
|
6
|
-
add_field :
|
7
|
-
add_field :
|
8
|
-
add_field :
|
9
|
-
add_field :
|
10
|
-
add_field :
|
11
|
-
add_field :
|
12
|
-
add_field :
|
5
|
+
add_field :set_id
|
6
|
+
add_field :patient_id
|
7
|
+
add_field :patient_id_list
|
8
|
+
add_field :alt_patient_id
|
9
|
+
add_field :patient_name
|
10
|
+
add_field :mother_maiden_name
|
11
|
+
add_field :patient_dob
|
12
|
+
add_field :admin_sex do |sex|
|
13
13
|
unless /^[FMOUAN]$/.match(sex) || sex == nil || sex == ""
|
14
14
|
raise HL7::InvalidDataError.new( "bad administrative sex value (not F|M|O|U|A|N)" )
|
15
15
|
end
|
16
16
|
sex = "" unless sex
|
17
17
|
sex
|
18
18
|
end
|
19
|
-
add_field :
|
20
|
-
add_field :
|
21
|
-
add_field :
|
22
|
-
add_field :
|
23
|
-
add_field :
|
24
|
-
add_field :
|
25
|
-
add_field :
|
26
|
-
add_field :
|
27
|
-
add_field :
|
28
|
-
add_field :
|
29
|
-
add_field :
|
30
|
-
add_field :
|
31
|
-
add_field :
|
32
|
-
add_field :
|
33
|
-
add_field :
|
34
|
-
add_field :
|
35
|
-
add_field :
|
36
|
-
add_field :
|
37
|
-
add_field :
|
38
|
-
add_field :
|
39
|
-
add_field :
|
40
|
-
add_field :
|
41
|
-
add_field :
|
42
|
-
add_field :
|
43
|
-
add_field :
|
44
|
-
add_field :
|
45
|
-
add_field :
|
46
|
-
add_field :
|
47
|
-
add_field :
|
48
|
-
add_field :
|
19
|
+
add_field :patient_alias
|
20
|
+
add_field :race
|
21
|
+
add_field :address
|
22
|
+
add_field :country_code
|
23
|
+
add_field :phone_home
|
24
|
+
add_field :phone_business
|
25
|
+
add_field :primary_language
|
26
|
+
add_field :marital_status
|
27
|
+
add_field :religion
|
28
|
+
add_field :account_number
|
29
|
+
add_field :social_security_num
|
30
|
+
add_field :mothers_id
|
31
|
+
add_field :ethnic_group
|
32
|
+
add_field :birthplace
|
33
|
+
add_field :multi_birth
|
34
|
+
add_field :birth_order
|
35
|
+
add_field :citizenship
|
36
|
+
add_field :vet_status
|
37
|
+
add_field :nationality
|
38
|
+
add_field :death_date
|
39
|
+
add_field :death_indicator
|
40
|
+
add_field :id_unknown_indicator
|
41
|
+
add_field :id_readability_code
|
42
|
+
add_field :last_update_date
|
43
|
+
add_field :last_update_facility
|
44
|
+
add_field :species_code
|
45
|
+
add_field :breed_code
|
46
|
+
add_field :strain
|
47
|
+
add_field :production_class_code
|
48
|
+
add_field :tribal_citizenship
|
49
49
|
end
|
data/lib/segments/pv1.rb
CHANGED
@@ -1,57 +1,57 @@
|
|
1
|
-
# $Id
|
1
|
+
# $Id$
|
2
2
|
require 'ruby-hl7'
|
3
3
|
class HL7::Message::Segment::PV1 < HL7::Message::Segment
|
4
4
|
weight 2
|
5
|
-
add_field :
|
6
|
-
add_field :
|
7
|
-
add_field :
|
8
|
-
add_field :
|
9
|
-
add_field :
|
10
|
-
add_field :
|
11
|
-
add_field :
|
12
|
-
add_field :
|
13
|
-
add_field :
|
14
|
-
add_field :
|
15
|
-
add_field :
|
16
|
-
add_field :
|
17
|
-
add_field :
|
18
|
-
add_field :
|
19
|
-
add_field :
|
20
|
-
add_field :
|
21
|
-
add_field :
|
22
|
-
add_field :
|
23
|
-
add_field :
|
24
|
-
add_field :
|
25
|
-
add_field :
|
26
|
-
add_field :
|
27
|
-
add_field :
|
28
|
-
add_field :
|
29
|
-
add_field :
|
30
|
-
add_field :
|
31
|
-
add_field :
|
32
|
-
add_field :
|
33
|
-
add_field :
|
34
|
-
add_field :
|
35
|
-
add_field :
|
36
|
-
add_field :
|
37
|
-
add_field :
|
38
|
-
add_field :
|
39
|
-
add_field :
|
40
|
-
add_field :
|
41
|
-
add_field :
|
42
|
-
add_field :
|
43
|
-
add_field :
|
44
|
-
add_field :
|
45
|
-
add_field :
|
46
|
-
add_field :
|
47
|
-
add_field :
|
48
|
-
add_field :
|
49
|
-
add_field :
|
50
|
-
add_field :
|
51
|
-
add_field :
|
52
|
-
add_field :
|
53
|
-
add_field :
|
54
|
-
add_field :
|
55
|
-
add_field :
|
56
|
-
add_field :
|
5
|
+
add_field :set_id
|
6
|
+
add_field :patient_class
|
7
|
+
add_field :assigned_location
|
8
|
+
add_field :admission_type
|
9
|
+
add_field :preadmit_number
|
10
|
+
add_field :prior_location
|
11
|
+
add_field :attending_doctor
|
12
|
+
add_field :referring_doctor
|
13
|
+
add_field :consulting_doctor
|
14
|
+
add_field :hospital_service
|
15
|
+
add_field :temporary_location
|
16
|
+
add_field :preadmit_indicator
|
17
|
+
add_field :readmit_indicator
|
18
|
+
add_field :admit_source
|
19
|
+
add_field :ambulatory_status
|
20
|
+
add_field :vip_indicator
|
21
|
+
add_field :admitting_doctor
|
22
|
+
add_field :patient_type
|
23
|
+
add_field :visit_number
|
24
|
+
add_field :financial_class
|
25
|
+
add_field :charge_price_indicator
|
26
|
+
add_field :courtesy_code
|
27
|
+
add_field :credit_rating
|
28
|
+
add_field :contract_code
|
29
|
+
add_field :contract_effective_date
|
30
|
+
add_field :contract_amount
|
31
|
+
add_field :contract_period
|
32
|
+
add_field :interest_code
|
33
|
+
add_field :transfer_bad_debt_code
|
34
|
+
add_field :transfer_bad_debt_date
|
35
|
+
add_field :bad_debt_agency_code
|
36
|
+
add_field :bad_debt_transfer_amount
|
37
|
+
add_field :bad_debt_recovery_amount
|
38
|
+
add_field :delete_account_indicator
|
39
|
+
add_field :delete_account_date
|
40
|
+
add_field :discharge_disposition
|
41
|
+
add_field :discharge_to_location
|
42
|
+
add_field :diet_type
|
43
|
+
add_field :servicing_facility
|
44
|
+
add_field :bed_status
|
45
|
+
add_field :account_status
|
46
|
+
add_field :pending_location
|
47
|
+
add_field :prior_temporary_location
|
48
|
+
add_field :admit_date
|
49
|
+
add_field :discharge_date
|
50
|
+
add_field :current_patient_balance
|
51
|
+
add_field :total_charges
|
52
|
+
add_field :total_adjustments
|
53
|
+
add_field :total_payments
|
54
|
+
add_field :alternate_visit_id
|
55
|
+
add_field :visit_indicator
|
56
|
+
add_field :other_healthcare_provider
|
57
57
|
end
|