pipehat 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Street Address
4
+ Pipehat.define_type :SAD do
5
+ add_component :street_or_mailing_address, :ST
6
+ add_component :street_name, :ST
7
+ add_component :dwelling_number, :ST
8
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Sequence ID
4
+ Pipehat.define_type :SI
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # String of Telephone Number Digits
4
+ Pipehat.define_type :SNM
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # String Data
4
+ Pipehat.define_type :ST
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Time Stamp
4
+ Pipehat.define_type :TS do
5
+ add_component :time, :DTM
6
+ add_component :degree_of_precision, :ID
7
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Text Data
4
+ Pipehat.define_type :TX
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Varies - a type used in fields where the actual content is context specific
4
+ Pipehat.define_type :Varies do
5
+ end
6
+
7
+ Pipehat::Field::Varies.send(:define_method, :cast) do |cast_to|
8
+ Object.const_get("Pipehat::Field::#{cast_to}").new(segment, fnum)
9
+ end
10
+
11
+ Pipehat::Repeat::Varies.send(:define_method, :cast) do |cast_to|
12
+ Object.const_get("Pipehat::Repeat::#{cast_to}").new(segment, fnum, rnum)
13
+ end
14
+
15
+ Pipehat::Component::Varies.send(:define_method, :cast) do |cast_to|
16
+ Object.const_get("Pipehat::Component::#{cast_to}").new(segment, fnum, rnum, cnum)
17
+ end
18
+
19
+ # Subcomponent class has to be created as composite types don't normally have one
20
+ module Pipehat
21
+ module Subcomponent
22
+ class Varies < Base
23
+ def cast(cast_to)
24
+ Object.const_get("Pipehat::Subcomponent::#{cast_to}").new(segment, fnum, rnum, cnum, snum)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Version Identifier
4
+ Pipehat.define_type :VID do
5
+ add_component :version_id, :ID
6
+ add_component :internationalization_code, :CWE
7
+ add_component :international_version_id, :CWE
8
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Extended Address
4
+ Pipehat.define_type :XAD do
5
+ add_component :street_address, :SAD
6
+ add_component :other_designation, :ST
7
+ add_component :city, :ST
8
+ add_component :state_or_province, :ST
9
+ add_component :zip_or_postal_code, :ST
10
+ add_component :country, :ID
11
+ add_component :address_type, :ID
12
+ add_component :other_geographic_designation, :ST
13
+ add_component :county_parish_code, :CWE
14
+ add_component :census_tract, :CWE
15
+ add_component :address_representation_code, :ID
16
+ add_component :address_validity_range, :ST
17
+ add_component :effective_date, :DTM
18
+ add_component :expiration_date, :DTM
19
+ add_component :expiration_reason, :CWE
20
+ add_component :temporary_indicator, :ID
21
+ add_component :bad_address_indicator, :ID
22
+ add_component :address_usage, :ID
23
+ add_component :addressee, :ST
24
+ add_component :comment, :ST
25
+ add_component :preference_order, :NM
26
+ add_component :protection_code, :CWE
27
+ add_component :address_identifier, :EI
28
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Extended Composite ID Number and Name for Persons
4
+ Pipehat.define_type :XCN do
5
+ add_component :person_identifier, :ST
6
+ add_component :family_name, :FN
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, :ST
12
+ add_component :source_table, :CWE
13
+ add_component :assigning_authority, :HD
14
+ add_component :name_type_code, :ID
15
+ add_component :identifier_check_digit, :ST
16
+ add_component :check_digit_scheme, :ID
17
+ add_component :identifier_type_code, :ID
18
+ add_component :assigning_facility, :HD
19
+ add_component :name_representation_code, :ID
20
+ add_component :name_context, :CWE
21
+ add_component :name_validity_range, :ST
22
+ add_component :name_assembly_order, :ID
23
+ add_component :effective_date, :DTM
24
+ add_component :expiration_date, :DTM
25
+ add_component :professional_suffix, :ST
26
+ add_component :assigning_jurisdiction, :CWE
27
+ add_component :assigning_agency_or_department, :CWE
28
+ add_component :security_check, :ST
29
+ add_component :security_check_scheme, :ID
30
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Extended Composite Name and Identification Number for Organizations
4
+ Pipehat.define_type :XON do
5
+ add_component :organization_name, :ST
6
+ add_component :organization_name_type_code, :CWE
7
+ add_component :id_number, :ST
8
+ add_component :identifier_check_digit, :ST
9
+ add_component :check_digit_scheme, :ST
10
+ add_component :assigning_authority, :HD
11
+ add_component :identifier_type_code, :ID
12
+ add_component :assigning_facility, :HD
13
+ add_component :name_representation_code, :ID
14
+ add_component :organization_identifier, :ST
15
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Extended Person Name
4
+ Pipehat.define_type :XPN do
5
+ add_component :family_name, :FN
6
+ add_component :given_name, :ST
7
+ add_component :second_and_further_given_names_or_initials_thereof, :ST
8
+ add_component :suffix, :ST
9
+ add_component :prefix, :ST
10
+ add_component :degree, :ST
11
+ add_component :name_type_code, :ID
12
+ add_component :name_representation_code, :ID
13
+ add_component :name_context, :CWE
14
+ add_component :name_validity_range, :ID
15
+ add_component :name_assembly_order, :DTM
16
+ add_component :effective_date, :DTM
17
+ add_component :expiration_date, :DTM
18
+ add_component :professional_suffix, :ST
19
+ add_component :called_by, :ST
20
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ Pipehat.define_type :XTN do
4
+ add_component :telephone_number, :ST
5
+ add_component :telecommunication_use_code, :ID
6
+ add_component :telecommunication_equipment_type, :ID
7
+ add_component :communication_address, :ST
8
+ add_component :country_code, :SNM
9
+ add_component :area_city_code, :SNM
10
+ add_component :local_number, :SNM
11
+ add_component :extension, :SNM
12
+ add_component :any_text, :ST
13
+ add_component :extension_prefix, :ST
14
+ add_component :speed_dial_code, :ST
15
+ add_component :unformatted_telephone_number, :ST
16
+ add_component :effective_start_date, :DTM
17
+ add_component :expiration_date, :DTM
18
+ add_component :expiration_reason, :CWE
19
+ add_component :protection_code, :CWE
20
+ add_component :shared_telecommunication_identifier, :EI
21
+ add_component :preference_order, :NM
22
+ end
@@ -0,0 +1,3 @@
1
+ module Pipehat
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,27 @@
1
+ require_relative 'lib/pipehat/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "pipehat"
5
+ spec.version = Pipehat::VERSION
6
+ spec.authors = ["Tim Peters"]
7
+ spec.email = ["tim@catminion.net"]
8
+
9
+ spec.summary = "A library for reading and writing HL7 v2 messages."
10
+ spec.description = "A library for reading and writing HL7 v2 messages."
11
+ spec.homepage = "https://github.com/timocp/pipehat"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
+
15
+ spec.metadata["homepage_uri"] = spec.homepage
16
+ spec.metadata["source_code_uri"] = "https://github.com/timocp/pipehat"
17
+ spec.metadata["changelog_uri"] = "https://github.com/timocp/pipehat/blob/master/CHANGELOG.md"
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
+ end
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
+ spec.require_paths = ["lib"]
27
+ end
metadata ADDED
@@ -0,0 +1,127 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pipehat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tim Peters
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-09-27 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A library for reading and writing HL7 v2 messages.
14
+ email:
15
+ - tim@catminion.net
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - ".rubocop.yml"
22
+ - ".travis.yml"
23
+ - CODE_OF_CONDUCT.md
24
+ - Gemfile
25
+ - LICENSE.txt
26
+ - README.md
27
+ - Rakefile
28
+ - bin/console
29
+ - bin/setup
30
+ - lib/pipehat.rb
31
+ - lib/pipehat/component/base.rb
32
+ - lib/pipehat/define_type.rb
33
+ - lib/pipehat/field/base.rb
34
+ - lib/pipehat/message.rb
35
+ - lib/pipehat/node.rb
36
+ - lib/pipehat/parser.rb
37
+ - lib/pipehat/repeat/base.rb
38
+ - lib/pipehat/segment/aip.rb
39
+ - lib/pipehat/segment/ais.rb
40
+ - lib/pipehat/segment/al1.rb
41
+ - lib/pipehat/segment/base.rb
42
+ - lib/pipehat/segment/dg1.rb
43
+ - lib/pipehat/segment/err.rb
44
+ - lib/pipehat/segment/evn.rb
45
+ - lib/pipehat/segment/in1.rb
46
+ - lib/pipehat/segment/msa.rb
47
+ - lib/pipehat/segment/msh.rb
48
+ - lib/pipehat/segment/obr.rb
49
+ - lib/pipehat/segment/obx.rb
50
+ - lib/pipehat/segment/orc.rb
51
+ - lib/pipehat/segment/pid.rb
52
+ - lib/pipehat/segment/prd.rb
53
+ - lib/pipehat/segment/pv1.rb
54
+ - lib/pipehat/segment/rf1.rb
55
+ - lib/pipehat/segment/rgs.rb
56
+ - lib/pipehat/segment/sch.rb
57
+ - lib/pipehat/subcomponent/base.rb
58
+ - lib/pipehat/types/aui.rb
59
+ - lib/pipehat/types/ce.rb
60
+ - lib/pipehat/types/cne.rb
61
+ - lib/pipehat/types/cnn.rb
62
+ - lib/pipehat/types/cp.rb
63
+ - lib/pipehat/types/cq.rb
64
+ - lib/pipehat/types/cwe.rb
65
+ - lib/pipehat/types/cx.rb
66
+ - lib/pipehat/types/dld.rb
67
+ - lib/pipehat/types/dt.rb
68
+ - lib/pipehat/types/dtm.rb
69
+ - lib/pipehat/types/ei.rb
70
+ - lib/pipehat/types/eip.rb
71
+ - lib/pipehat/types/erl.rb
72
+ - lib/pipehat/types/fn.rb
73
+ - lib/pipehat/types/hd.rb
74
+ - lib/pipehat/types/id.rb
75
+ - lib/pipehat/types/is.rb
76
+ - lib/pipehat/types/mo.rb
77
+ - lib/pipehat/types/moc.rb
78
+ - lib/pipehat/types/msg.rb
79
+ - lib/pipehat/types/ndl.rb
80
+ - lib/pipehat/types/nm.rb
81
+ - lib/pipehat/types/pl.rb
82
+ - lib/pipehat/types/pln.rb
83
+ - lib/pipehat/types/prl.rb
84
+ - lib/pipehat/types/pt.rb
85
+ - lib/pipehat/types/rc.rb
86
+ - lib/pipehat/types/sad.rb
87
+ - lib/pipehat/types/si.rb
88
+ - lib/pipehat/types/snm.rb
89
+ - lib/pipehat/types/st.rb
90
+ - lib/pipehat/types/ts.rb
91
+ - lib/pipehat/types/tx.rb
92
+ - lib/pipehat/types/varies.rb
93
+ - lib/pipehat/types/vid.rb
94
+ - lib/pipehat/types/xad.rb
95
+ - lib/pipehat/types/xcn.rb
96
+ - lib/pipehat/types/xon.rb
97
+ - lib/pipehat/types/xpn.rb
98
+ - lib/pipehat/types/xtn.rb
99
+ - lib/pipehat/version.rb
100
+ - pipehat.gemspec
101
+ homepage: https://github.com/timocp/pipehat
102
+ licenses:
103
+ - MIT
104
+ metadata:
105
+ homepage_uri: https://github.com/timocp/pipehat
106
+ source_code_uri: https://github.com/timocp/pipehat
107
+ changelog_uri: https://github.com/timocp/pipehat/blob/master/CHANGELOG.md
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 2.3.0
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubygems_version: 3.1.2
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: A library for reading and writing HL7 v2 messages.
127
+ test_files: []