pipehat 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rubocop.yml +18 -0
  4. data/.travis.yml +10 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +8 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +184 -0
  9. data/Rakefile +10 -0
  10. data/bin/console +10 -0
  11. data/bin/setup +8 -0
  12. data/lib/pipehat.rb +22 -0
  13. data/lib/pipehat/component/base.rb +30 -0
  14. data/lib/pipehat/define_type.rb +68 -0
  15. data/lib/pipehat/field/base.rb +59 -0
  16. data/lib/pipehat/message.rb +32 -0
  17. data/lib/pipehat/node.rb +53 -0
  18. data/lib/pipehat/parser.rb +149 -0
  19. data/lib/pipehat/repeat/base.rb +31 -0
  20. data/lib/pipehat/segment/aip.rb +21 -0
  21. data/lib/pipehat/segment/ais.rb +21 -0
  22. data/lib/pipehat/segment/al1.rb +15 -0
  23. data/lib/pipehat/segment/base.rb +124 -0
  24. data/lib/pipehat/segment/dg1.rb +30 -0
  25. data/lib/pipehat/segment/err.rb +21 -0
  26. data/lib/pipehat/segment/evn.rb +16 -0
  27. data/lib/pipehat/segment/in1.rb +64 -0
  28. data/lib/pipehat/segment/msa.rb +17 -0
  29. data/lib/pipehat/segment/msh.rb +52 -0
  30. data/lib/pipehat/segment/obr.rb +63 -0
  31. data/lib/pipehat/segment/obx.rb +37 -0
  32. data/lib/pipehat/segment/orc.rb +43 -0
  33. data/lib/pipehat/segment/pid.rb +49 -0
  34. data/lib/pipehat/segment/prd.rb +23 -0
  35. data/lib/pipehat/segment/pv1.rb +63 -0
  36. data/lib/pipehat/segment/rf1.rb +34 -0
  37. data/lib/pipehat/segment/rgs.rb +12 -0
  38. data/lib/pipehat/segment/sch.rb +36 -0
  39. data/lib/pipehat/subcomponent/base.rb +27 -0
  40. data/lib/pipehat/types/aui.rb +8 -0
  41. data/lib/pipehat/types/ce.rb +11 -0
  42. data/lib/pipehat/types/cne.rb +27 -0
  43. data/lib/pipehat/types/cnn.rb +16 -0
  44. data/lib/pipehat/types/cp.rb +11 -0
  45. data/lib/pipehat/types/cq.rb +7 -0
  46. data/lib/pipehat/types/cwe.rb +27 -0
  47. data/lib/pipehat/types/cx.rb +17 -0
  48. data/lib/pipehat/types/dld.rb +7 -0
  49. data/lib/pipehat/types/dt.rb +4 -0
  50. data/lib/pipehat/types/dtm.rb +4 -0
  51. data/lib/pipehat/types/ei.rb +9 -0
  52. data/lib/pipehat/types/eip.rb +7 -0
  53. data/lib/pipehat/types/erl.rb +11 -0
  54. data/lib/pipehat/types/fn.rb +10 -0
  55. data/lib/pipehat/types/hd.rb +8 -0
  56. data/lib/pipehat/types/id.rb +4 -0
  57. data/lib/pipehat/types/is.rb +4 -0
  58. data/lib/pipehat/types/mo.rb +7 -0
  59. data/lib/pipehat/types/moc.rb +7 -0
  60. data/lib/pipehat/types/msg.rb +8 -0
  61. data/lib/pipehat/types/ndl.rb +16 -0
  62. data/lib/pipehat/types/nm.rb +4 -0
  63. data/lib/pipehat/types/pl.rb +16 -0
  64. data/lib/pipehat/types/pln.rb +9 -0
  65. data/lib/pipehat/types/prl.rb +8 -0
  66. data/lib/pipehat/types/pt.rb +7 -0
  67. data/lib/pipehat/types/rc.rb +7 -0
  68. data/lib/pipehat/types/sad.rb +8 -0
  69. data/lib/pipehat/types/si.rb +4 -0
  70. data/lib/pipehat/types/snm.rb +4 -0
  71. data/lib/pipehat/types/st.rb +4 -0
  72. data/lib/pipehat/types/ts.rb +7 -0
  73. data/lib/pipehat/types/tx.rb +4 -0
  74. data/lib/pipehat/types/varies.rb +28 -0
  75. data/lib/pipehat/types/vid.rb +8 -0
  76. data/lib/pipehat/types/xad.rb +28 -0
  77. data/lib/pipehat/types/xcn.rb +30 -0
  78. data/lib/pipehat/types/xon.rb +15 -0
  79. data/lib/pipehat/types/xpn.rb +20 -0
  80. data/lib/pipehat/types/xtn.rb +22 -0
  81. data/lib/pipehat/version.rb +3 -0
  82. data/pipehat.gemspec +27 -0
  83. metadata +127 -0
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pipehat
4
+ module Segment
5
+ # Referral Information
6
+ class RF1 < Base
7
+ add_field :referral_status, :CWE
8
+ add_field :referral_priority, :CWE
9
+ add_field :referral_type, :CWE
10
+ add_field :referral_disposition, :CWE
11
+ add_field :referral_category, :CWE
12
+ add_field :originating_referral_identifier, :EI
13
+ add_field :effective_date, :DTM
14
+ add_field :expiration_date, :DTM
15
+ add_field :process_date, :DTM
16
+ add_field :referral_reason, :CWE
17
+ add_field :external_referral_identifier, :EI
18
+ add_field :referral_documentation_completion_status, :CWE
19
+ add_field :planned_treatment_stop_date, :DTM
20
+ add_field :referral_reason_text, :ST
21
+ add_field :number_of_authorized_treatments_units, :CQ
22
+ add_field :number_of_used_treatments_units, :CQ
23
+ add_field :number_of_schedule_treatments_units, :CQ
24
+ add_field :remaining_benefit_amount, :MO
25
+ add_field :authorized_provider, :XCN
26
+ add_field :authorized_health_professional, :XCN
27
+ add_field :source_text, :ST
28
+ add_field :source_date, :DTM
29
+ add_field :source_phone, :XTN
30
+ add_field :comment, :ST
31
+ add_field :action_code, :ID
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pipehat
4
+ module Segment
5
+ # Resource Group
6
+ class RGS < Base
7
+ add_field :set_id, :SI
8
+ add_field :segment_action_code, :ID
9
+ add_field :resource_group_id, :CWE
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Pipehat
4
+ module Segment
5
+ # Scheduling Activity Information
6
+ class SCH < Base
7
+ add_field :placer_appointment_id, :EI
8
+ add_field :filler_appointment_id, :EI
9
+ add_field :occurrence_number, :NM
10
+ add_field :placer_group_number, :EI
11
+ add_field :schedule_id, :CWE
12
+ add_field :event_reason, :CWE
13
+ add_field :appointment_reason, :CWE
14
+ add_field :appointment_type, :CWE
15
+ add_field :appointment_duration, :NM
16
+ add_field :appointment_duration_units, :CNE
17
+ add_field :appointment_timing_quantity, :ST
18
+ add_field :placer_contact_person, :XCN
19
+ add_field :placer_contact_phone_number, :XTN
20
+ add_field :placer_contact_address, :XAD
21
+ add_field :placer_contact_location, :PL
22
+ add_field :filler_contact_person, :XCN
23
+ add_field :filler_contact_phone_number, :XTN
24
+ add_field :filler_contact_address, :XAD
25
+ add_field :filler_contact_location, :PL
26
+ add_field :entered_by_person, :XCN
27
+ add_field :entered_by_phone_number, :XTN
28
+ add_field :entered_by_location, :PL
29
+ add_field :parent_placer_appointment_id, :EI
30
+ add_field :parent_filler_appointment_id, :EI
31
+ add_field :filler_status_code, :CWE
32
+ add_field :placer_order_number, :EI
33
+ add_field :filler_order_number, :EI
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,27 @@
1
+ module Pipehat
2
+ module Subcomponent
3
+ class Base < Pipehat::Node
4
+ def initialize(segment, fnum, rnum, cnum, snum)
5
+ @segment = segment
6
+ @fnum = fnum
7
+ @rnum = rnum
8
+ @cnum = cnum
9
+ @snum = snum
10
+ end
11
+
12
+ attr_reader :segment, :fnum, :rnum, :cnum, :snum
13
+
14
+ def set(value)
15
+ segment.set_subcomponent(fnum, rnum, cnum, snum, value)
16
+ end
17
+
18
+ def to_hl7
19
+ segment.tree(fnum, rnum, cnum, snum)
20
+ end
21
+
22
+ def inspect
23
+ inspect_node(fnum, rnum, cnum, snum)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Authorization Information
4
+ Pipehat.define_type :AUI do
5
+ add_component :authorization_number, :ST
6
+ add_component :date, :DT
7
+ add_component :source, :ST
8
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Coded Element
4
+ Pipehat.define_type :CE do
5
+ add_component :identifier, :ST
6
+ add_component :text, :ST
7
+ add_component :name_of_coding_system, :ID
8
+ add_component :alternate_identifier, :ST
9
+ add_component :alternate_text, :ST
10
+ add_component :name_of_alternate_coding_system, :ID
11
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Coded with No Exceptions
4
+ Pipehat.define_type :CNE do
5
+ add_component :identifier, :ST
6
+ add_component :text, :ST
7
+ add_component :name_of_coding_system, :ID
8
+ add_component :alternate_identifier, :ST
9
+ add_component :alternate_text, :ST
10
+ add_component :name_of_alternate_coding_system, :ID
11
+ add_component :coding_system_version_id, :ST
12
+ add_component :alternate_coding_system_version_id, :ST
13
+ add_component :original_text, :ST
14
+ add_component :second_alternate_identifier, :ST
15
+ add_component :second_alternate_text, :ST
16
+ add_component :name_of_second_alternate_coding_system, :ID
17
+ add_component :second_alternate_coding_system_version_id, :ST
18
+ add_component :coding_system_oid, :ST
19
+ add_component :value_set_oid, :ST
20
+ add_component :value_set_version_id, :DTM
21
+ add_component :alternate_coding_system_oid, :ST
22
+ add_component :alternate_value_set_oid, :ST
23
+ add_component :alternate_value_set_version_id, :DTM
24
+ add_component :second_alternate_coding_system_oid, :ST
25
+ add_component :second_alternate_value_set_oid, :ST
26
+ add_component :second_alternate_value_set_version_id, :DTM
27
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Composite ID Number and Name Simplified
4
+ Pipehat.define_type :CNN do
5
+ add_component :id_number, :ST
6
+ add_component :family_name, :ST
7
+ add_component :given_name, :ST
8
+ add_component :second_and_further_given_names_or_initials_thereof, :ST
9
+ add_component :suffix, :ST
10
+ add_component :prefix, :ST
11
+ add_component :degree, :IS
12
+ add_component :source_table, :IS
13
+ add_component :assigning_authority_namespace_id, :IS
14
+ add_component :assigning_authority_universal_id, :ST
15
+ add_component :assigning_authority_universal_id_type, :ID
16
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Composite Price
4
+ Pipehat.define_type :CP do
5
+ add_component :price, :MO
6
+ add_component :price_type, :ID
7
+ add_component :from_value, :NM
8
+ add_component :to_value, :NM
9
+ add_component :range_units, :CE
10
+ add_component :range_type, :ID
11
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Composite Quantity with Units
4
+ Pipehat.define_type :CQ do
5
+ add_component :quantity, :NM
6
+ add_component :units, :CWE
7
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Coded with Exceptions
4
+ Pipehat.define_type :CWE do
5
+ add_component :identifier, :ST
6
+ add_component :text, :ST
7
+ add_component :name_of_coding_system, :ID
8
+ add_component :alternate_identifier, :ST
9
+ add_component :alternate_text, :ST
10
+ add_component :name_of_alternate_coding_system, :ID
11
+ add_component :coding_system_version_id, :ST
12
+ add_component :alternate_coding_system_version_id, :ST
13
+ add_component :original_text, :ST
14
+ add_component :second_alternate_identifier, :ST
15
+ add_component :second_alternate_text, :ST
16
+ add_component :name_of_second_alternate_coding_system, :ID
17
+ add_component :second_alternate_coding_system_version_id, :ST
18
+ add_component :coding_system_oid, :ST
19
+ add_component :value_set_oid, :ST
20
+ add_component :value_set_version_id, :DTM
21
+ add_component :alternate_coding_system_oid, :ST
22
+ add_component :alternate_value_set_oid, :ST
23
+ add_component :alternate_value_set_version_id, :DTM
24
+ add_component :second_alternate_coding_system_oid, :ST
25
+ add_component :second_alternate_value_set_oid, :ST
26
+ add_component :second_alternate_value_set_version_id, :DTM
27
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Extended Composite ID with Check Digit
4
+ Pipehat.define_type :CX do
5
+ add_component :id_number, :ST
6
+ add_component :identifier_check_digit, :ST
7
+ add_component :check_digit_scheme, :ID
8
+ add_component :assigning_authority, :HD
9
+ add_component :identifier_type_code, :ID
10
+ add_component :assigning_facility, :HD
11
+ add_component :effective_date, :DT
12
+ add_component :expiration_date, :DT
13
+ add_component :assigning_jurisdiction, :CWE
14
+ add_component :assigning_agency_or_department, :CWE
15
+ add_component :security_check, :ST
16
+ add_component :security_check_scheme, :ID
17
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Discharge Location and Date
4
+ Pipehat.define_type :DLD do
5
+ add_component :discharge_to_location, :CWE
6
+ add_component :effective_date, :DTM
7
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Date
4
+ Pipehat.define_type :DT
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Date/time
4
+ Pipehat.define_type :DTM
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Entity Identifier
4
+ Pipehat.define_type :EI do
5
+ add_component :entity_identifier, :ST
6
+ add_component :namespace_id, :IS
7
+ add_component :universal_id, :ST
8
+ add_component :universal_id_type, :ID
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Entity Identifier Pair
4
+ Pipehat.define_type :EIP do
5
+ add_component :placer_assigned_identifier, :EI
6
+ add_component :filler_assigned_identifier, :EI
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Error Location
4
+ Pipehat.define_type :ERL do
5
+ add_component :segment_id, :ST
6
+ add_component :segment_sequence, :NM
7
+ add_component :field_position, :NM
8
+ add_component :field_repetition, :NM
9
+ add_component :component_number, :NM
10
+ add_component :subcomponent_number, :NM
11
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Family Name
4
+ Pipehat.define_type :FN do
5
+ add_component :surname, :ST
6
+ add_component :own_surname_prefix, :ST
7
+ add_component :own_surname, :ST
8
+ add_component :surname_prefix_from_partner, :ST
9
+ add_component :surname_from_partner, :ST
10
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Hierarchic Designator
4
+ Pipehat.define_type :HD do
5
+ add_component :namespace_id, :IS
6
+ add_component :universal_id, :ST
7
+ add_component :universal_id_type, :ID
8
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Coded Value for HL7 Defined Tables
4
+ Pipehat.define_type :ID
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Coded Value for User-defined Tables
4
+ Pipehat.define_type :IS
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Money
4
+ Pipehat.define_type :MO do
5
+ add_component :quantity, :NM
6
+ add_component :denomination, :ID
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Money and Code
4
+ Pipehat.define_type :MOC do
5
+ add_component :monetary_amount, :MO
6
+ add_component :charge_code, :CWE
7
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Message Type
4
+ Pipehat.define_type :MSG do
5
+ add_component :message_code, :ID
6
+ add_component :trigger_event, :ID
7
+ add_component :message_structure, :ID
8
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Name with Date and Location
4
+ Pipehat.define_type :NDL do
5
+ add_component :name, :CNN
6
+ add_component :start_date_time, :DTM
7
+ add_component :end_date_time, :DTM
8
+ add_component :point_of_care, :IS
9
+ add_component :room, :IS
10
+ add_component :bed, :IS
11
+ add_component :facility, :HD
12
+ add_component :location_status, :IS
13
+ add_component :patient_location_type, :IS
14
+ add_component :building, :IS
15
+ add_component :floor, :IS
16
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Numeric
4
+ Pipehat.define_type :NM
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Person Location
4
+ Pipehat.define_type :PL do
5
+ add_component :point_of_care, :HD
6
+ add_component :room, :HD
7
+ add_component :bed, :HD
8
+ add_component :facility, :HD
9
+ add_component :location_status, :IS
10
+ add_component :person_location_type, :IS
11
+ add_component :building, :HD
12
+ add_component :floor, :HD
13
+ add_component :location_description, :ST
14
+ add_component :comprehensive_location_identifier, :EI
15
+ add_component :assigning_authority_for_location, :HD
16
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Practitioner License or Other ID Number
4
+ Pipehat.define_type :PLN do
5
+ add_component :id_number, :ST
6
+ add_component :type_of_id_number, :CWE
7
+ add_component :state_other_qualifying_information, :ST
8
+ add_component :expiration_date, :DT
9
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Parent Result Link
4
+ Pipehat.define_type :PRL do
5
+ add_component :parent_observation_identifier, :CWE
6
+ add_component :parent_observation_sub_identifier, :ST
7
+ add_component :parent_observation_value_descriptor, :TX
8
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Processing Type
4
+ Pipehat.define_type :PT do
5
+ add_component :processing_id, :ID
6
+ add_component :processing_mode, :ID
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Financial Class
4
+ Pipehat.define_type :FC do
5
+ add_component :financial_class_code, :IS
6
+ add_component :effective_date, :DTM
7
+ end