ruby-hl7 1.2.3 → 1.3.3

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 (59) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +7 -0
  3. data/.rubocop.yml +127 -0
  4. data/.travis.yml +20 -0
  5. data/Gemfile +3 -0
  6. data/Gemfile.lock +65 -0
  7. data/NOTES.md +151 -0
  8. data/README.rdoc +5 -0
  9. data/Rakefile +76 -0
  10. data/VERSION +1 -0
  11. data/VERSION.yml +4 -0
  12. data/examples/proxy_server.rb +26 -0
  13. data/lib/ruby-hl7.rb +1 -1
  14. data/lib/segments/ft1.rb +63 -0
  15. data/lib/segments/gt1.rb +75 -0
  16. data/lib/segments/pid.rb +13 -1
  17. data/lib/segments/txa.rb +28 -0
  18. data/ruby-hl7.gemspec +39 -0
  19. data/spec/ail_segment_spec.rb +28 -0
  20. data/spec/aip_segment_spec.rb +31 -0
  21. data/spec/basic_parsing_spec.rb +319 -0
  22. data/spec/batch_parsing_spec.rb +52 -0
  23. data/spec/child_segment_spec.rb +66 -0
  24. data/spec/core_ext/date_time_spec.rb +43 -0
  25. data/spec/default_segment_spec.rb +31 -0
  26. data/spec/dg1_spec.rb +42 -0
  27. data/spec/dynamic_segment_def_spec.rb +37 -0
  28. data/spec/err_segment_spec.rb +26 -0
  29. data/spec/evn_segment_spec.rb +23 -0
  30. data/spec/ft1_segment_spec.rb +35 -0
  31. data/spec/fts_segment_spec.rb +19 -0
  32. data/spec/gt1_segment_spec.rb +32 -0
  33. data/spec/in1_segment_spec.rb +34 -0
  34. data/spec/message_spec.rb +53 -0
  35. data/spec/messages_spec.rb +24 -0
  36. data/spec/mfe_segment_spec.rb +28 -0
  37. data/spec/mfi_segment_spec.rb +28 -0
  38. data/spec/msa_segment_spec.rb +27 -0
  39. data/spec/msh_segment_spec.rb +28 -0
  40. data/spec/nk1_segment_spec.rb +26 -0
  41. data/spec/obr_segment_spec.rb +45 -0
  42. data/spec/obx_segment_spec.rb +68 -0
  43. data/spec/orc_segment_spec.rb +27 -0
  44. data/spec/pid_segment_spec.rb +78 -0
  45. data/spec/prd_segment_spec.rb +29 -0
  46. data/spec/pv1_segment_spec.rb +23 -0
  47. data/spec/rf1_segment_spec.rb +29 -0
  48. data/spec/sch_segment_spec.rb +32 -0
  49. data/spec/segment_field_spec.rb +110 -0
  50. data/spec/segment_generator_spec.rb +32 -0
  51. data/spec/segment_list_storage_spec.rb +47 -0
  52. data/spec/segment_spec.rb +38 -0
  53. data/spec/sft_segment_spec.rb +26 -0
  54. data/spec/spec_helper.rb +13 -0
  55. data/spec/speed_parsing_spec.rb +19 -0
  56. data/spec/spm_segment_spec.rb +26 -0
  57. data/spec/txa_segment_spec.rb +72 -0
  58. metadata +155 -18
  59. data/lib/segments/zcf.rb +0 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f8f63eebddc15165ad878ecb3b78935ce3892131
4
- data.tar.gz: 134b5d4f57b5ff439921b3f4d8f509a49f7ec4d2
2
+ SHA256:
3
+ metadata.gz: e12909d9bf4258faa015ede7da03afce19e915640b8aa240c99c993bf938acd3
4
+ data.tar.gz: 54bea819722c67aab4342ad667dc54b141ea6ac0bbb180070f467c12fb45f893
5
5
  SHA512:
6
- metadata.gz: 0a72a3aebd6f19860238bb8bd9a60c09dedcf5dc54dc0a40812eaed0598cfd38c339432b20b6f09a51cf758f03440e086bc24ca72ca2dfefd3b962f3191487cc
7
- data.tar.gz: f254e4d43d6696bd135e01a6415d856b4e4f58ec4bcedeeb51f0afe21335f33a4fe9e88019ac2c82220d50ce0c0be945c14054811676773351dfe7b9957b45ab
6
+ metadata.gz: 119f5c5c4bb3063d3a6e6abcc50309590e677be55f2f75fd91c69a7907a9adbac247462573fe9e5973fc37cf8416c8ba0aabcc87ca81709cf56a557773d27429
7
+ data.tar.gz: 427934f749b5dde398e4e6c236472ad8e2cb514380945ed6f35bf99dd9b41448a9572ef438ddc247e229d7df82055f289c8a2966a06ee9087d82d0f2c20d0fee
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .bundle
2
+ coverage
3
+ doc
4
+ pkg
5
+ .rspec
6
+ .DS_Store
7
+ .rspec
data/.rubocop.yml ADDED
@@ -0,0 +1,127 @@
1
+ # Copied from bundler :)
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 1.9
5
+ Exclude:
6
+ - tmp/**/*
7
+ DisplayCopNames: true
8
+
9
+ # They are idiomatic
10
+ Lint/AssignmentInCondition:
11
+ Enabled: false
12
+
13
+ Lint/EndAlignment:
14
+ EnforcedStyleAlignWith: variable
15
+ AutoCorrect: true
16
+
17
+ Lint/UnusedMethodArgument:
18
+ Enabled: false
19
+
20
+ # Style
21
+
22
+ Style/AccessModifierIndentation:
23
+ EnforcedStyle: outdent
24
+
25
+ Style/Alias:
26
+ EnforcedStyle: prefer_alias_method
27
+
28
+ Style/AlignParameters:
29
+ EnforcedStyle: with_fixed_indentation
30
+
31
+ Style/FrozenStringLiteralComment:
32
+ EnforcedStyle: always
33
+
34
+ Style/MultilineBlockChain:
35
+ Enabled: false
36
+
37
+ Style/MultilineOperationIndentation:
38
+ EnforcedStyle: indented
39
+
40
+ Style/PerlBackrefs:
41
+ Enabled: false
42
+
43
+ Style/SingleLineBlockParams:
44
+ Enabled: false
45
+
46
+ Style/SpaceInsideBlockBraces:
47
+ SpaceBeforeBlockParameters: false
48
+
49
+ Style/TrivialAccessors:
50
+ Enabled: false
51
+
52
+ # We adopted raise instead of fail.
53
+ Style/SignalException:
54
+ EnforcedStyle: only_raise
55
+
56
+ Style/StringLiterals:
57
+ EnforcedStyle: double_quotes
58
+
59
+ Style/StringLiteralsInInterpolation:
60
+ EnforcedStyle: double_quotes
61
+
62
+ # Having these make it easier to *not* forget to add one when adding a new
63
+ # value and you can simply copy the previous line.
64
+ Style/TrailingCommaInLiteral:
65
+ EnforcedStyleForMultiline: comma
66
+
67
+ Style/TrailingUnderscoreVariable:
68
+ Enabled: false
69
+
70
+ # `String.new` is preferred style with enabled frozen string literal
71
+ Style/EmptyLiteral:
72
+ Enabled: false
73
+
74
+ # 1.8.7 support
75
+
76
+ Style/HashSyntax:
77
+ EnforcedStyle: hash_rockets
78
+
79
+ Style/Lambda:
80
+ Enabled: false
81
+
82
+ Style/DotPosition:
83
+ EnforcedStyle: trailing
84
+
85
+ Style/EachWithObject:
86
+ Enabled: false
87
+
88
+ Style/SpecialGlobalVars:
89
+ Enabled: false
90
+
91
+ Style/TrailingCommaInArguments:
92
+ Enabled: false
93
+
94
+ Performance/FlatMap:
95
+ Enabled: false
96
+
97
+ # Metrics
98
+
99
+ # We've chosen to use Rubocop only for style, and not for complexity or quality checks.
100
+ Metrics/ClassLength:
101
+ Enabled: false
102
+
103
+ Metrics/ModuleLength:
104
+ Enabled: false
105
+
106
+ Metrics/MethodLength:
107
+ Enabled: false
108
+
109
+ Metrics/BlockNesting:
110
+ Enabled: false
111
+
112
+ Metrics/AbcSize:
113
+ Enabled: false
114
+
115
+ Metrics/CyclomaticComplexity:
116
+ Enabled: false
117
+
118
+ Metrics/ParameterLists:
119
+ Enabled: false
120
+
121
+ Metrics/BlockLength:
122
+ Enabled: false
123
+
124
+ # It will be obvious which code is complex, Rubocop should only lint simple
125
+ # rules for us.
126
+ Metrics/PerceivedComplexity:
127
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,20 @@
1
+ branches:
2
+ only:
3
+ - master
4
+ language: ruby
5
+ matrix:
6
+ allow_failures:
7
+ - rvm:
8
+ - ruby-head
9
+ - 1.9.3
10
+ sudo: required
11
+ dist: trusty
12
+ addons:
13
+ apt:
14
+ packages:
15
+ - haveged
16
+ rvm:
17
+ - 2.4
18
+ - 2.3
19
+ - 2.2
20
+ - jruby-9.1.5.0
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,65 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby-hl7 (1.3.3)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ coderay (1.1.2)
10
+ diff-lcs (1.3)
11
+ docile (1.3.2)
12
+ ffi (1.12.2-java)
13
+ json (2.5.1)
14
+ json (2.5.1-java)
15
+ method_source (0.9.2)
16
+ pry (0.12.2)
17
+ coderay (~> 1.1.0)
18
+ method_source (~> 0.9.0)
19
+ pry (0.12.2-java)
20
+ coderay (~> 1.1.0)
21
+ method_source (~> 0.9.0)
22
+ spoon (~> 0.0)
23
+ rake (13.0.1)
24
+ rake-contrib (1.0.0)
25
+ rake
26
+ rdoc (6.3.1)
27
+ rspec (3.9.0)
28
+ rspec-core (~> 3.9.0)
29
+ rspec-expectations (~> 3.9.0)
30
+ rspec-mocks (~> 3.9.0)
31
+ rspec-core (3.9.1)
32
+ rspec-support (~> 3.9.1)
33
+ rspec-expectations (3.9.0)
34
+ diff-lcs (>= 1.2.0, < 2.0)
35
+ rspec-support (~> 3.9.0)
36
+ rspec-mocks (3.9.1)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.9.0)
39
+ rspec-support (3.9.2)
40
+ simplecov (0.16.1)
41
+ docile (~> 1.1)
42
+ json (>= 1.8, < 3)
43
+ simplecov-html (~> 0.10.0)
44
+ simplecov-html (0.10.2)
45
+ spoon (0.0.6)
46
+ ffi
47
+
48
+ PLATFORMS
49
+ java
50
+ ruby
51
+ x86-mingw32
52
+
53
+ DEPENDENCIES
54
+ bundler (~> 1.17)
55
+ pry
56
+ rake (>= 12.3.3)
57
+ rake-contrib
58
+ rdoc (~> 6.3)
59
+ rspec (>= 3.9.0)
60
+ ruby-hl7!
61
+ simplecov (= 0.16.1)
62
+ simplecov-html (~> 0.10.0)
63
+
64
+ BUNDLED WITH
65
+ 1.17.2
data/NOTES.md ADDED
@@ -0,0 +1,151 @@
1
+ ## Overview
2
+
3
+ **Version 1.3.3**
4
+ Update RDoc
5
+ Added TXA segment
6
+
7
+ https://github.com/ruby-hl7/ruby-hl7/pull/118
8
+ https://github.com/ruby-hl7/ruby-hl7/pull/117
9
+
10
+ Thanks to:
11
+ @Stratus3D and @rodrigofhm
12
+
13
+ **Version 1.3.2**
14
+ Added GT1 segment
15
+ Updated dependencies
16
+
17
+ https://github.com/ruby-hl7/ruby-hl7/pull/111
18
+ https://github.com/ruby-hl7/ruby-hl7/pull/108
19
+
20
+ Thanks to:
21
+ @gusIreland
22
+
23
+ **Version 1.3.1**
24
+ Added FT1 segment
25
+ Updated gemspec dependencies
26
+
27
+ https://github.com/ruby-hl7/ruby-hl7/pull/102
28
+ https://github.com/ruby-hl7/ruby-hl7/pull/94
29
+
30
+ Thanks to:
31
+ @raulperezalejo @anujbiyani
32
+
33
+ **Version 1.3.0**
34
+ Removed ZCF segment
35
+ Renamed PID-12 from country_code to county_code (deprecation warnings)
36
+ Bumped gem dependency versions
37
+
38
+ https://github.com/ruby-hl7/ruby-hl7/pull/90
39
+ https://github.com/ruby-hl7/ruby-hl7/pull/91
40
+ https://github.com/ruby-hl7/ruby-hl7/pull/93
41
+ https://github.com/ruby-hl7/ruby-hl7/pull/95
42
+ https://github.com/ruby-hl7/ruby-hl7/pull/97
43
+
44
+ Thanks to:
45
+ @mogox @rclavel @mullican
46
+
47
+ **Version 1.2.3**
48
+ New Segments:
49
+ AIG
50
+ AIS
51
+ MRG
52
+ RGS
53
+ TQ1
54
+ IN1
55
+
56
+ https://github.com/ruby-hl7/ruby-hl7/pull/86
57
+ https://github.com/ruby-hl7/ruby-hl7/pull/87
58
+
59
+
60
+ Thanks to:
61
+ @finnhowell, @rclavel
62
+
63
+ **Version 1.2.2**
64
+ New segments:
65
+ AIL
66
+ AIP
67
+ SCH
68
+
69
+ Feature Updates
70
+ https://github.com/ruby-hl7/ruby-hl7/pull/69
71
+ https://github.com/ruby-hl7/ruby-hl7/pull/79
72
+ https://github.com/ruby-hl7/ruby-hl7/pull/81
73
+ https://github.com/ruby-hl7/ruby-hl7/pull/82
74
+ https://github.com/ruby-hl7/ruby-hl7/pull/83
75
+
76
+ Thanks to @finnhowell, @myokoym, and @mogox for contributions.
77
+
78
+ **Version 1.2.1**
79
+ New segments:
80
+ DG1
81
+
82
+ https://github.com/ruby-hl7/ruby-hl7/pull/61
83
+ https://github.com/ruby-hl7/ruby-hl7/pull/66
84
+ https://github.com/ruby-hl7/ruby-hl7/pull/68
85
+ https://github.com/ruby-hl7/ruby-hl7/pull/72
86
+ https://github.com/ruby-hl7/ruby-hl7/pull/74
87
+
88
+ Thanks to:
89
+ @caseyprovost, @adamjubert, @vadeolu
90
+
91
+ **Version 1.2.0**
92
+ Included in this release:
93
+ https://github.com/ruby-hl7/ruby-hl7/pull/52
94
+ https://github.com/ruby-hl7/ruby-hl7/pull/56
95
+ https://github.com/ruby-hl7/ruby-hl7/pull/58
96
+ https://github.com/ruby-hl7/ruby-hl7/pull/59
97
+
98
+ Thanks to:
99
+ @adamstegman, @clausti, @evanmthw, @mitch-lindsay
100
+
101
+ **Version 1.1.1**
102
+ Included in this release:
103
+
104
+ - https://github.com/ruby-hl7/ruby-hl7/pull/48
105
+ - https://github.com/ruby-hl7/ruby-hl7/pull/44
106
+
107
+ **Version 1.1.0**
108
+ Included in this release:
109
+ - https://github.com/ruby-hl7/ruby-hl7/pull/7
110
+ - https://github.com/ruby-hl7/ruby-hl7/pull/9
111
+ - https://github.com/ruby-hl7/ruby-hl7/pull/10
112
+ - https://github.com/ruby-hl7/ruby-hl7/pull/13
113
+ - https://github.com/ruby-hl7/ruby-hl7/pull/17
114
+ - https://github.com/ruby-hl7/ruby-hl7/pull/18
115
+ - https://github.com/ruby-hl7/ruby-hl7/pull/19
116
+ - https://github.com/ruby-hl7/ruby-hl7/pull/20
117
+ - https://github.com/ruby-hl7/ruby-hl7/pull/21
118
+ - https://github.com/ruby-hl7/ruby-hl7/pull/22
119
+ - https://github.com/ruby-hl7/ruby-hl7/pull/23
120
+ - https://github.com/ruby-hl7/ruby-hl7/pull/24
121
+ - https://github.com/ruby-hl7/ruby-hl7/pull/25
122
+ - https://github.com/ruby-hl7/ruby-hl7/pull/27
123
+ - https://github.com/ruby-hl7/ruby-hl7/pull/28
124
+ - https://github.com/ruby-hl7/ruby-hl7/pull/33
125
+ - https://github.com/ruby-hl7/ruby-hl7/pull/34
126
+ - https://github.com/ruby-hl7/ruby-hl7/pull/35
127
+ - https://github.com/ruby-hl7/ruby-hl7/pull/41
128
+
129
+ Thanks to:
130
+ @untoldone, @tomsabin, @patricksrobertson, @rojotek, @calebwoods and @jdee
131
+
132
+
133
+ **Version 1.0.3**
134
+ The ruby-hl7 gem removes some sample messages.
135
+
136
+ ## Release Date
137
+
138
+ January 25, 2011
139
+
140
+ ## In this release
141
+
142
+ * Sample messages from Cerner were removed.
143
+ * Some gem dependencies were updated.
144
+
145
+ ### Bug fixes
146
+
147
+ There are no bug fixes in this release.
148
+
149
+ ## Known Issues
150
+
151
+ There are currently no known open issues with the ruby-hl7 gem.
data/README.rdoc CHANGED
@@ -38,5 +38,10 @@ In your Gemfile:
38
38
 
39
39
  gem 'ruby-hl7'
40
40
 
41
+ === Migrating from 1.2.3 to 1.3.0
42
+
43
+ The ZCF segment has been removed, as it is not standard.
44
+ To continue using it, please use the {ruby-hl7-zcf gem}[https://github.com/doctolib/ruby-hl7-zcf].
45
+
41
46
  == License
42
47
  See the LICENSE file.
data/Rakefile ADDED
@@ -0,0 +1,76 @@
1
+ # $Id$
2
+ require 'rubygems'
3
+ require 'rake'
4
+ require 'rdoc/task'
5
+ require 'rubygems/package_task'
6
+ require 'rbconfig'
7
+ require 'rspec'
8
+ require 'rspec/core/rake_task'
9
+ require 'simplecov'
10
+
11
+ $: << './lib'
12
+ require 'ruby-hl7'
13
+ require 'message_parser'
14
+ require 'message'
15
+ require 'segment_list_storage'
16
+ require 'segment_generator'
17
+ require 'segment'
18
+
19
+ full_name = "Ruby-HL7"
20
+ RAKEVERSION = "12.3.3"
21
+
22
+ # Many of these tasks were garnered from zenspider's Hoe
23
+ # just forced to work my way
24
+
25
+ desc 'Default: Run all examples'
26
+ task :default => :spec
27
+
28
+ spec = Gem::Specification.new do |s|
29
+ s.homepage = "https://github.com/ruby-hl7/ruby-hl7"
30
+ s.platform = Gem::Platform::RUBY
31
+ s.summary = "Ruby HL7 Library"
32
+ s.description = "A simple library to parse and generate HL7 2.x messages"
33
+ s.files = FileList["{bin,lib,test_data}/**/*"].to_a
34
+ s.require_path = "lib"
35
+ s.test_files = FileList["{test}/**/test*.rb"].to_a
36
+ s.has_rdoc = true
37
+ s.required_ruby_version = '>= 1.8.6'
38
+ s.extra_rdoc_files = %w[README.rdoc LICENSE]
39
+ s.add_dependency("rake", ">= #{RAKEVERSION}")
40
+ end
41
+
42
+ desc "Run all examples"
43
+ RSpec::Core::RakeTask.new(:spec) do |spec|
44
+ spec.pattern = 'spec/**/*.rb'
45
+ spec.ruby_opts = '-w'
46
+ end
47
+
48
+ desc "Run all examples with SimpleCov"
49
+ RSpec::Core::RakeTask.new(:spec_with_simplecov) do |spec|
50
+ ENV['COVERAGE'] = 'true'
51
+ spec.pattern = 'spec/**/*.rb'
52
+ end
53
+
54
+ RDoc::Task.new do |rd|
55
+ rd.main = "README.rdoc"
56
+ rd.rdoc_files.include("README.rdoc", "LICENSE", "lib/**/*.rb")
57
+ rd.title = "%s (%s) Documentation" % [ full_name, spec.version ]
58
+ rd.rdoc_dir = 'doc'
59
+ end
60
+
61
+ Gem::PackageTask.new(spec) do |pkg|
62
+ pkg.need_tar = true
63
+ end
64
+
65
+ desc 'Clean up all the extras'
66
+ task :clean => [ :clobber_rdoc, :clobber_package ] do
67
+ %w[*.gem ri coverage*].each do |pattern|
68
+ files = Dir[pattern]
69
+ rm_rf files unless files.empty?
70
+ end
71
+ end
72
+
73
+ desc 'Install the package as a gem'
74
+ task :install_gem => [:clean, :package] do
75
+ sh "sudo gem install pkg/*.gem"
76
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.3.3
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 1
3
+ :minor: 3
4
+ :patch: 0
@@ -0,0 +1,26 @@
1
+ # $Id$
2
+ # Ruby-HL7 Proxy Server Example
3
+ require 'rubygems'
4
+ require 'ruby-hl7'
5
+ require 'thread'
6
+ require 'socket'
7
+
8
+ PORT = 2402
9
+ target_ip = "127.0.0.1"
10
+ target_port = 5900
11
+
12
+ srv = TCPServer.new(PORT)
13
+ puts "proxy_server listening on port: %i" % PORT
14
+ puts "proxying for: %s:%i" % [ target_ip, target_port ]
15
+ while true
16
+ sok = srv.accept
17
+ Thread.new( sok ) do |my_socket|
18
+ raw_inp = my_socket.readlines
19
+ msg = HL7::Message.new( raw_input )
20
+ puts "forwarding message:\n%s" % msg.to_s
21
+ soc = TCPSocket.open( target_ip, target_port )
22
+ soc.write msg.to_mllp
23
+ soc.close
24
+ end
25
+ end
26
+
data/lib/ruby-hl7.rb CHANGED
@@ -21,7 +21,7 @@ require 'stringio'
21
21
  require 'date'
22
22
 
23
23
  module HL7 # :nodoc:
24
- VERSION = '1.2.3'
24
+ VERSION = '1.3.3'
25
25
  def self.ParserConfig
26
26
  @parser_cfg ||= { :empty_segment_is_error => true }
27
27
  end
@@ -0,0 +1,63 @@
1
+ module HL7
2
+ class Message::Segment::FT1 < HL7::Message::Segment
3
+ weight 10
4
+ add_field :set_id
5
+ add_field :transaction_id
6
+ add_field :transaction_batch_id
7
+ add_field :date_of_service do |value|
8
+ convert_to_ts(value)
9
+ end
10
+ add_field :transaction_posting_date do |value|
11
+ convert_to_ts(value)
12
+ end
13
+ add_field :transaction_type
14
+ add_field :transaction_code
15
+ add_field :transaction_description
16
+ add_field :transaction_description_alt
17
+ add_field :transaction_quantity
18
+ add_field :transaction_amount_extended
19
+ add_field :transaction_amount_unit
20
+ add_field :department_code
21
+ add_field :insurance_plan_id
22
+ add_field :insurance_amount
23
+ add_field :assigned_patient_location
24
+ add_field :fees_schedule
25
+ add_field :patient_type
26
+
27
+ # https://www.findacode.com/icd-9/icd-9-cm-diagnosis-codes.html
28
+ # http://www.icd10data.com/ICD10CM/Codes
29
+ add_field :diagnosis_code
30
+
31
+ # https://en.wikipedia.org/wiki/National_Provider_Identifier
32
+ add_field :performed_by_provider
33
+
34
+ add_field :ordering_provider
35
+ add_field :unit_cost
36
+ add_field :filler_order_number
37
+ add_field :entered_by
38
+
39
+ # https://en.wikipedia.org/wiki/Current_Procedural_Terminology (CPT)
40
+ add_field :procedure_code
41
+
42
+ add_field :procedure_code_modifier
43
+ add_field :advanced_beneficiary_notice_code
44
+ add_field :medically_necessary_duplicate_procedure_reason
45
+ add_field :ndc_code
46
+ add_field :payment_reference_id
47
+ add_field :transaction_reference_key
48
+ add_field :performing_facility
49
+ add_field :ordering_facility
50
+ add_field :item_number
51
+ add_field :model_number
52
+ add_field :special_processing_code
53
+ add_field :clinic_code
54
+ add_field :referral_number
55
+ add_field :authorization_number
56
+ add_field :service_provider_taxonomy_code
57
+ add_field :revenue_code
58
+ add_field :prescription_number
59
+ add_field :ndc_qty_and_uom
60
+
61
+
62
+ end
63
+ end
@@ -0,0 +1,75 @@
1
+ module HL7
2
+ class Message::Segment::GT1 < HL7::Message::Segment
3
+ add_field :set_id
4
+ add_field :guarantor_number
5
+ add_field :guarantor_name
6
+ add_field :guarantor_spouse_name
7
+ add_field :guarantor_address
8
+ add_field :guarantor_home_phone
9
+ add_field :guarantor_business_phone
10
+ add_field :guarantor_date_of_birth
11
+ add_field :guarantor_sex do |sex|
12
+ unless /^[FMOUANC]$/.match(sex) || sex == nil || sex == ""
13
+ raise HL7::InvalidDataError.new( "bad administrative sex value (not F|M|O|U|A|N|C)" )
14
+ end
15
+ sex = "" unless sex
16
+ sex
17
+ end
18
+ add_field :guarantor_type
19
+ add_field :guarantor_relationship
20
+ add_field :guarantor_ssn
21
+ add_field :guarantor_begin_date do |value|
22
+ convert_to_ts(value)
23
+ end
24
+ add_field :guarantor_end_date do |value|
25
+ convert_to_ts(value)
26
+ end
27
+ add_field :guarantor_priority
28
+ add_field :guarantor_employer_name
29
+ add_field :guarantor_employer_address
30
+ add_field :guarantor_employer_phone
31
+ add_field :guarantor_employee_id
32
+ add_field :guarantor_employment_status
33
+ add_field :guarantor_billing_hold_flag
34
+ add_field :guarantor_date_of_death do |value|
35
+ convert_to_ts(value)
36
+ end
37
+ add_field :guarantor_death_flag
38
+ add_field :guarantor_charge_adjustment_code
39
+ add_field :guarantor_household_annual_income
40
+ add_field :guarantor_household_size
41
+ add_field :guarantor_employer_id_number
42
+ add_field :guarantor_marital_status_code
43
+ add_field :guarantor_hire_effective_date do |value|
44
+ convert_to_ts(value)
45
+ end
46
+ add_field :employment_stop_date do |value|
47
+ convert_to_ts(value)
48
+ end
49
+ add_field :living_dependency
50
+ add_field :ambulatory_status
51
+ add_field :citizenship
52
+ add_field :primary_language
53
+ add_field :living_arrangement
54
+ add_field :publicity_indicator
55
+ add_field :protection_indicator
56
+ add_field :student_indicator
57
+ add_field :religion
58
+ add_field :mothers_maiden_name
59
+ add_field :nationality
60
+ add_field :ethnic_group
61
+ add_field :contact_persons_name
62
+ add_field :contact_persons_phone_number
63
+ add_field :contact_reason
64
+ add_field :contact_relationship
65
+ add_field :contact_job_title
66
+ add_field :job_code
67
+ add_field :guarantor_employers_organization
68
+ add_field :handicap
69
+ add_field :job_status
70
+ add_field :guarantor_financial_class
71
+ add_field :guarantor_race
72
+ add_field :guarantor_birth_place
73
+ add_field :vip_indicator
74
+ end
75
+ end
data/lib/segments/pid.rb CHANGED
@@ -21,7 +21,7 @@ class HL7::Message::Segment::PID < HL7::Message::Segment
21
21
  add_field :patient_alias
22
22
  add_field :race
23
23
  add_field :address
24
- add_field :country_code
24
+ add_field :county_code
25
25
  add_field :phone_home
26
26
  add_field :phone_business
27
27
  add_field :primary_language
@@ -53,4 +53,16 @@ class HL7::Message::Segment::PID < HL7::Message::Segment
53
53
  add_field :strain
54
54
  add_field :production_class_code
55
55
  add_field :tribal_citizenship
56
+
57
+ def country_code
58
+ warn "DEPRECATION WARNING: PID-12 is defined as 'county_code'; "+
59
+ "the 'country_code' alias is retained for backwards compatibility only."
60
+ county_code
61
+ end
62
+
63
+ def country_code=(country_code)
64
+ warn "DEPRECATION WARNING: PID-12 is defined as 'county_code'; "+
65
+ "the 'country_code' alias is retained for backwards compatibility only."
66
+ self.county_code = country_code
67
+ end
56
68
  end