fhir_stu3_models 3.1.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec8082e82ddef2263165e8d3e8bf8796a29f7f6e24933b0ef93103c00b39141c
4
- data.tar.gz: ae1ce9be9995968d47b52a2cde7761297112d53df13f3ae91458a03614b45669
3
+ metadata.gz: 5fad10495a24114dafe28e11c75994cfd4f724cdbeae5c52314a72fb92dcbcb1
4
+ data.tar.gz: fb2866760125408e5187f9bcb3b6ecfc0806b9fcd6ce9243713911985b7c20f3
5
5
  SHA512:
6
- metadata.gz: f01425bc7459c9a8b7444aad6bb354e7b82d6b086033a7d05c0c237fa24abb32b07cbd701fa3e5b368cb05719621eb864d2aca1413ad3945d6a5b4e40098333c
7
- data.tar.gz: 6423e8d4d0025bd9e4b9169b34de178116201e9bcbfce631e42fdd93422c4112c328bfb29f7f97da537f9136172896732a1088042c7cd55e213021546c015c9a
6
+ metadata.gz: 8a1e2967c6a837027428cd7b30f3bfefeb55a766bf434f7732c89cff3b3003ba5dc42ef845a171121400f92062c1d740467be86fb8e36a720b738bd0a8f9e832
7
+ data.tar.gz: 1582407356c083ef680a408b891f0c20d29bcd4f67a3579511acf0f0bf1cf758f63d8974a6c2bb07b810a5f598c71e52238c973882282d6cb8ba6c1be1f4ebcb
data/.codeclimate.yml CHANGED
@@ -9,7 +9,7 @@ engines:
9
9
  enabled: true
10
10
  rubocop:
11
11
  enabled: true
12
- channel: rubocop-0-80
12
+ channel: rubocop-1-23-0
13
13
  ratings:
14
14
  paths:
15
15
  - "**.inc"
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- ruby-version: ['2.6', '2.7']
14
+ ruby-version: ['3.0', '3.1', '3.2']
15
15
 
16
16
  steps:
17
17
  - uses: actions/checkout@v2
data/.gitignore CHANGED
@@ -2,7 +2,6 @@
2
2
  **/coverage/**
3
3
  fhir_stu3_models*log*
4
4
  invariants.txt
5
- .ruby-version
6
5
  .ruby-gemset
7
6
  tmp/
8
7
  .idea/
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
  AllCops:
3
- TargetRubyVersion: 2.7
3
+ TargetRubyVersion: 3.0
4
4
  Exclude:
5
5
  - 'test/**/*'
6
6
  - 'spec/**/*'
@@ -12,6 +12,8 @@ AllCops:
12
12
  - 'bin/*'
13
13
  Layout/LineLength:
14
14
  Enabled: false
15
+ Style/AccessorGrouping:
16
+ Enabled: false
15
17
  Style/FrozenStringLiteralComment:
16
18
  Enabled: false
17
19
  Style/HashEachMethods:
@@ -20,6 +22,8 @@ Style/HashTransformKeys:
20
22
  Enabled: true
21
23
  Style/HashTransformValues:
22
24
  Enabled: true
25
+ Style/WordArray:
26
+ EnforcedStyle: brackets
23
27
  inherit_mode:
24
28
  merge:
25
29
  - Exclude
data/.rubocop_todo.yml CHANGED
@@ -1,55 +1,21 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2021-03-30 17:30:14 -0400 using RuboCop version 0.80.0.
3
+ # on 2023-12-13 21:39:37 UTC using RuboCop version 1.23.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 49
10
- # Cop supports --auto-correct.
11
- Layout/EmptyLineAfterGuardClause:
12
- Exclude:
13
- - 'lib/fhir_stu3_models/bootstrap/definitions.rb'
14
- - 'lib/fhir_stu3_models/bootstrap/generator.rb'
15
- - 'lib/fhir_stu3_models/bootstrap/hashable.rb'
16
- - 'lib/fhir_stu3_models/bootstrap/model.rb'
17
- - 'lib/fhir_stu3_models/bootstrap/preprocess.rb'
18
- - 'lib/fhir_stu3_models/bootstrap/xml.rb'
19
- - 'lib/fhir_stu3_models/deprecate.rb'
20
- - 'lib/fhir_stu3_models/fhir_ext/element_definition.rb'
21
- - 'lib/fhir_stu3_models/fhir_ext/structure_definition.rb'
22
- - 'lib/fhir_stu3_models/fhir_ext/structure_definition_compare.rb'
23
- - 'lib/fhir_stu3_models/fluentpath/parse.rb'
24
-
25
- # Offense count: 1
26
- # Cop supports --auto-correct.
27
- Layout/RescueEnsureAlignment:
28
- Exclude:
29
- - 'lib/fhir_stu3_models/bootstrap/hashable.rb'
30
-
31
- # Offense count: 6
32
- # Cop supports --auto-correct.
33
- Lint/NonDeterministicRequireOrder:
34
- Exclude:
35
- - 'lib/fhir_stu3_models.rb'
36
-
37
- # Offense count: 2
38
- # Cop supports --auto-correct.
39
- Lint/ToJSON:
40
- Exclude:
41
- - 'lib/fhir_stu3_models/bootstrap/json.rb'
42
- - 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb'
43
-
44
- # Offense count: 38
9
+ # Offense count: 37
10
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
45
11
  Metrics/AbcSize:
46
- Max: 405
12
+ Max: 407
47
13
 
48
14
  # Offense count: 7
49
- # Configuration parameters: CountComments, ExcludedMethods.
50
- # ExcludedMethods: refine
15
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
16
+ # IgnoredMethods: refine
51
17
  Metrics/BlockLength:
52
- Max: 70
18
+ Max: 71
53
19
 
54
20
  # Offense count: 7
55
21
  # Configuration parameters: CountBlocks.
@@ -57,47 +23,51 @@ Metrics/BlockNesting:
57
23
  Max: 5
58
24
 
59
25
  # Offense count: 6
60
- # Configuration parameters: CountComments.
26
+ # Configuration parameters: CountComments, CountAsOne.
61
27
  Metrics/ClassLength:
62
28
  Max: 345
63
29
 
64
- # Offense count: 25
30
+ # Offense count: 32
31
+ # Configuration parameters: IgnoredMethods.
65
32
  Metrics/CyclomaticComplexity:
66
- Max: 69
33
+ Max: 77
67
34
 
68
- # Offense count: 43
69
- # Configuration parameters: CountComments, ExcludedMethods.
35
+ # Offense count: 44
36
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
70
37
  Metrics/MethodLength:
71
- Max: 127
38
+ Max: 126
72
39
 
73
40
  # Offense count: 1
74
- # Configuration parameters: CountComments.
41
+ # Configuration parameters: CountComments, CountAsOne.
75
42
  Metrics/ModuleLength:
76
- Max: 114
43
+ Max: 115
77
44
 
78
- # Offense count: 24
45
+ # Offense count: 29
46
+ # Configuration parameters: IgnoredMethods.
79
47
  Metrics/PerceivedComplexity:
80
- Max: 72
48
+ Max: 80
49
+
50
+ # Offense count: 5
51
+ # Configuration parameters: EnforcedStyle, IgnoredPatterns.
52
+ # SupportedStyles: snake_case, camelCase
53
+ Naming/MethodName:
54
+ Exclude:
55
+ - 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb'
81
56
 
82
57
  # Offense count: 4
83
58
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
84
- # AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
59
+ # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
85
60
  Naming/MethodParameterName:
86
61
  Exclude:
87
62
  - 'lib/fhir_stu3_models/fhir_ext/structure_definition_compare.rb'
88
63
 
89
- # Offense count: 2
64
+ # Offense count: 1
90
65
  # Cop supports --auto-correct.
91
- # Configuration parameters: PreferredName.
92
- Naming/RescuedExceptionsVariableName:
66
+ # Configuration parameters: EnforcedStyle.
67
+ # SupportedStyles: nested, compact
68
+ Style/ClassAndModuleChildren:
93
69
  Exclude:
94
- - 'lib/fhir_stu3_models/bootstrap/hashable.rb'
95
-
96
- # Offense count: 1
97
- # Configuration parameters: .
98
- # SupportedStyles: inline, group
99
- Style/AccessModifierDeclarations:
100
- EnforcedStyle: inline
70
+ - '.simplecov'
101
71
 
102
72
  # Offense count: 17
103
73
  Style/ClassVars:
@@ -105,17 +75,23 @@ Style/ClassVars:
105
75
  - 'lib/fhir_stu3_models/bootstrap/definitions.rb'
106
76
  - 'lib/fhir_stu3_models/fluentpath/parse.rb'
107
77
 
78
+ # Offense count: 1
79
+ Style/CombinableLoops:
80
+ Exclude:
81
+ - 'lib/fhir_stu3_models/fhir_ext/structure_definition_compare.rb'
82
+
108
83
  # Offense count: 6
84
+ # Cop supports --auto-correct.
109
85
  Style/CommentedKeyword:
110
86
  Exclude:
111
87
  - 'lib/fhir_stu3_models/bootstrap/hashable.rb'
112
88
  - 'lib/fhir_stu3_models/bootstrap/model.rb'
113
89
 
114
- # Offense count: 14
90
+ # Offense count: 15
91
+ # Configuration parameters: AllowedConstants.
115
92
  Style/Documentation:
116
93
  Exclude:
117
- - 'spec/**/*'
118
- - 'test/**/*'
94
+ - '.simplecov'
119
95
  - 'lib/fhir_stu3_models/bootstrap/definitions.rb'
120
96
  - 'lib/fhir_stu3_models/bootstrap/field.rb'
121
97
  - 'lib/fhir_stu3_models/bootstrap/generator.rb'
@@ -131,13 +107,6 @@ Style/Documentation:
131
107
  - 'lib/fhir_stu3_models/fluentpath/expression.rb'
132
108
  - 'lib/fhir_stu3_models/fluentpath/parse.rb'
133
109
 
134
- # Offense count: 22
135
- # Cop supports --auto-correct.
136
- # Configuration parameters: EnforcedStyle.
137
- # SupportedStyles: always, always_true, never
138
- Style/FrozenStringLiteralComment:
139
- Enabled: false
140
-
141
110
  # Offense count: 29
142
111
  # Cop supports --auto-correct.
143
112
  Style/IfUnlessModifier:
@@ -150,61 +119,22 @@ Style/IfUnlessModifier:
150
119
  - 'lib/fhir_stu3_models/fhir_ext/structure_definition.rb'
151
120
  - 'lib/fhir_stu3_models/fhir_ext/structure_definition_compare.rb'
152
121
 
153
- # Offense count: 1
154
- Style/MethodMissingSuper:
155
- Exclude:
156
- - 'lib/fhir_stu3_models/bootstrap/model.rb'
157
-
158
122
  # Offense count: 1
159
123
  Style/MissingRespondToMissing:
160
124
  Exclude:
161
125
  - 'lib/fhir_stu3_models/bootstrap/model.rb'
162
126
 
163
- # Offense count: 9
164
- Style/MultipleComparison:
127
+ # Offense count: 2
128
+ # Configuration parameters: AllowedMethods.
129
+ # AllowedMethods: respond_to_missing?
130
+ Style/OptionalBooleanParameter:
165
131
  Exclude:
166
- - 'lib/fhir_stu3_models/bootstrap/definitions.rb'
167
132
  - 'lib/fhir_stu3_models/bootstrap/generator.rb'
168
- - 'lib/fhir_stu3_models/bootstrap/model.rb'
169
- - 'lib/fhir_stu3_models/fhir_ext/structure_definition.rb'
133
+ - 'lib/fhir_stu3_models/bootstrap/template.rb'
170
134
 
171
135
  # Offense count: 1
172
136
  # Cop supports --auto-correct.
173
- Style/OrAssignment:
174
- Exclude:
175
- - 'lib/fhir_stu3_models/bootstrap/generator.rb'
176
-
177
- # Offense count: 16
178
- # Cop supports --auto-correct.
179
- # Configuration parameters: EnforcedStyle.
180
- # SupportedStyles: implicit, explicit
181
- Style/RescueStandardError:
137
+ # Configuration parameters: AllowModifier.
138
+ Style/SoleNestedConditional:
182
139
  Exclude:
183
- - 'lib/fhir_stu3_models/bootstrap/definitions.rb'
184
- - 'lib/fhir_stu3_models/bootstrap/hashable.rb'
185
- - 'lib/fhir_stu3_models/bootstrap/json.rb'
186
- - 'lib/fhir_stu3_models/bootstrap/model.rb'
187
- - 'lib/fhir_stu3_models/bootstrap/xml.rb'
188
- - 'lib/fhir_stu3_models/fhir.rb'
189
- - 'lib/fhir_stu3_models/fhir_ext/structure_definition.rb'
190
- - 'lib/fhir_stu3_models/fhir_ext/structure_definition_finding.rb'
191
- - 'lib/fhir_stu3_models/fluentpath/expression.rb'
192
- - 'lib/fhir_stu3_models/fluentpath/parse.rb'
193
-
194
- # Offense count: 4
195
- # Cop supports --auto-correct.
196
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
197
- # AllowedMethods: present?, blank?, presence, try, try!
198
- Style/SafeNavigation:
199
- Exclude:
200
- - 'lib/fhir_stu3_models/bootstrap/xml.rb'
201
- - 'lib/fhir_stu3_models/fhir_ext/structure_definition.rb'
202
-
203
- # Offense count: 7
204
- # Cop supports --auto-correct.
205
- # Configuration parameters: EnforcedStyle.
206
- # SupportedStyles: forbid_for_all_comparison_operators, forbid_for_equality_operators_only, require_for_all_comparison_operators, require_for_equality_operators_only
207
- Style/YodaCondition:
208
- Exclude:
209
- - 'lib/fhir_stu3_models/bootstrap/preprocess.rb'
210
- - 'lib/fhir_stu3_models/fluentpath/parse.rb'
140
+ - 'lib/fhir_stu3_models/fhir_ext/structure_definition_compare.rb'
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.2
data/.simplecov CHANGED
@@ -1,14 +1,10 @@
1
1
  require 'simplecov'
2
2
  SimpleCov.command_name 'Unit Tests'
3
- SimpleCov.start do
4
- add_filter "test/"
5
- add_group "Library", "lib"
6
- end
7
3
 
8
4
  class SimpleCov::Formatter::QualityFormatter
9
5
  def format(result)
10
6
  SimpleCov::Formatter::HTMLFormatter.new.format(result)
11
- File.open("coverage/covered_percent", "w") do |f|
7
+ File.open('coverage/covered_percent', 'w') do |f|
12
8
  f.puts result.source_files.covered_percent.to_f
13
9
  end
14
10
  end
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.1.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fhir_stu3_models (3.1.1)
4
+ fhir_stu3_models (3.2.0)
5
5
  bcp47 (>= 0.3)
6
6
  date_time_precision (>= 0.8)
7
7
  mime-types (>= 3.0)
@@ -13,12 +13,12 @@ GEM
13
13
  ast (2.4.2)
14
14
  bcp47 (0.3.3)
15
15
  i18n
16
- coderay (1.1.2)
16
+ coderay (1.1.3)
17
17
  concurrent-ruby (1.1.9)
18
18
  date_time_precision (0.8.1)
19
19
  diff-lcs (1.3)
20
20
  docile (1.1.5)
21
- ffi (1.11.1)
21
+ ffi (1.16.3)
22
22
  formatador (0.2.5)
23
23
  guard (2.15.0)
24
24
  formatador (>= 0.2.4)
@@ -39,21 +39,19 @@ GEM
39
39
  test-unit (~> 3.0)
40
40
  i18n (1.8.10)
41
41
  concurrent-ruby (~> 1.0)
42
- jaro_winkler (1.5.4)
43
42
  json (2.5.1)
44
- listen (3.1.5)
45
- rb-fsevent (~> 0.9, >= 0.9.4)
46
- rb-inotify (~> 0.9, >= 0.9.7)
47
- ruby_dep (~> 1.2)
43
+ listen (3.8.0)
44
+ rb-fsevent (~> 0.10, >= 0.10.3)
45
+ rb-inotify (~> 0.9, >= 0.9.10)
48
46
  lumberjack (1.0.13)
49
- method_source (0.9.2)
47
+ method_source (1.0.0)
50
48
  mime-types (3.3.1)
51
49
  mime-types-data (~> 3.2015)
52
50
  mime-types-data (3.2021.0901)
53
- mini_portile2 (2.5.3)
51
+ mini_portile2 (2.8.6)
54
52
  nenv (0.3.0)
55
- nokogiri (1.11.7)
56
- mini_portile2 (~> 2.5.0)
53
+ nokogiri (1.16.5)
54
+ mini_portile2 (~> 2.8.2)
57
55
  racc (~> 1.4)
58
56
  nokogiri-diff (0.2.0)
59
57
  nokogiri (~> 1.5)
@@ -61,20 +59,23 @@ GEM
61
59
  notiffany (0.1.3)
62
60
  nenv (~> 0.1)
63
61
  shellany (~> 0.0)
64
- parallel (1.20.1)
65
- parser (3.0.0.0)
62
+ parallel (1.23.0)
63
+ parser (3.2.2.4)
66
64
  ast (~> 2.4.1)
65
+ racc
67
66
  power_assert (1.1.5)
68
- pry (0.12.2)
69
- coderay (~> 1.1.0)
70
- method_source (~> 0.9.0)
71
- racc (1.5.2)
72
- rainbow (3.0.0)
67
+ pry (0.14.2)
68
+ coderay (~> 1.1)
69
+ method_source (~> 1.0)
70
+ racc (1.8.0)
71
+ rainbow (3.1.1)
73
72
  rake (12.3.3)
74
- rb-fsevent (0.10.3)
75
- rb-inotify (0.10.0)
73
+ rb-fsevent (0.11.2)
74
+ rb-inotify (0.10.1)
76
75
  ffi (~> 1.0)
77
- rexml (3.2.5)
76
+ regexp_parser (2.8.3)
77
+ rexml (3.2.8)
78
+ strscan (>= 3.0.9)
78
79
  rspec (3.8.0)
79
80
  rspec-core (~> 3.8.0)
80
81
  rspec-expectations (~> 3.8.0)
@@ -88,27 +89,30 @@ GEM
88
89
  diff-lcs (>= 1.2.0, < 2.0)
89
90
  rspec-support (~> 3.8.0)
90
91
  rspec-support (3.8.2)
91
- rubocop (0.80.0)
92
- jaro_winkler (~> 1.5.1)
92
+ rubocop (1.23.0)
93
93
  parallel (~> 1.10)
94
- parser (>= 2.7.0.1)
94
+ parser (>= 3.0.0.0)
95
95
  rainbow (>= 2.2.2, < 4.0)
96
+ regexp_parser (>= 1.8, < 3.0)
96
97
  rexml
98
+ rubocop-ast (>= 1.12.0, < 2.0)
97
99
  ruby-progressbar (~> 1.7)
98
- unicode-display_width (>= 1.4.0, < 1.7)
99
- ruby-progressbar (1.11.0)
100
- ruby_dep (1.5.0)
100
+ unicode-display_width (>= 1.4.0, < 3.0)
101
+ rubocop-ast (1.30.0)
102
+ parser (>= 3.2.1.0)
103
+ ruby-progressbar (1.13.0)
101
104
  shellany (0.0.1)
102
105
  simplecov (0.13.0)
103
106
  docile (~> 1.1.0)
104
107
  json (>= 1.8, < 3)
105
108
  simplecov-html (~> 0.10.0)
106
109
  simplecov-html (0.10.2)
110
+ strscan (3.1.0)
107
111
  tdiff (0.3.4)
108
112
  test-unit (3.3.3)
109
113
  power_assert
110
114
  thor (0.20.3)
111
- unicode-display_width (1.6.1)
115
+ unicode-display_width (2.5.0)
112
116
 
113
117
  PLATFORMS
114
118
  ruby
@@ -122,12 +126,12 @@ DEPENDENCIES
122
126
  pry
123
127
  rake
124
128
  rspec
125
- rubocop (= 0.80)
129
+ rubocop (= 1.23.0)
126
130
  simplecov
127
131
  test-unit
128
132
 
129
133
  RUBY VERSION
130
- ruby 2.7.2p137
134
+ ruby 3.1.2p20
131
135
 
132
136
  BUNDLED WITH
133
- 2.1.4
137
+ 2.2.21
data/Guardfile CHANGED
@@ -15,7 +15,7 @@
15
15
  #
16
16
  # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
17
 
18
- # Note: The cmd option is now required due to the increasing number of ways
18
+ # NOTE: The cmd option is now required due to the increasing number of ways
19
19
  # rspec may be run, below are examples of the most common uses.
20
20
  # * bundler: 'bundle exec rspec'
21
21
  # * bundler binstubs: 'bin/rspec'
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
+ spec.required_ruby_version = '>= 3.0.0'
24
25
  spec.add_dependency 'nokogiri', '>= 1.11.4'
25
26
  spec.add_dependency 'date_time_precision', '>= 0.8'
26
27
  spec.add_dependency 'bcp47', '>= 0.3'
@@ -33,7 +34,7 @@ Gem::Specification.new do |spec|
33
34
  spec.add_development_dependency 'rspec'
34
35
  spec.add_development_dependency 'simplecov'
35
36
  spec.add_development_dependency 'nokogiri-diff'
36
- spec.add_development_dependency 'rubocop', '0.80'
37
+ spec.add_development_dependency 'rubocop', '1.23.0'
37
38
  spec.add_development_dependency 'guard-rspec'
38
39
  spec.add_development_dependency 'guard-test'
39
40
  end
@@ -45,6 +45,7 @@ module FHIR
45
45
  def self.type_definition(type_name)
46
46
  return nil if type_name.nil?
47
47
  return @@cache[type_name] if @@cache[type_name]
48
+
48
49
  definition = types.find { |x| x['xmlId'] == type_name || x['name'] == type_name || x['url'] == type_name }
49
50
  @@cache[type_name] = FHIR::STU3::StructureDefinition.new(definition) if definition
50
51
  @@cache[type_name]
@@ -74,6 +75,7 @@ module FHIR
74
75
  def self.resource_definition(resource_name)
75
76
  return nil if resource_name.nil?
76
77
  return @@cache[resource_name] if @@cache[resource_name]
78
+
77
79
  definition = resources.find { |x| x['xmlId'] == resource_name || x['name'] == resource_name || x['url'] == resource_name }
78
80
  @@cache[resource_name] = FHIR::STU3::StructureDefinition.new(definition) if definition
79
81
  @@cache[resource_name]
@@ -104,8 +106,10 @@ module FHIR
104
106
 
105
107
  def self.extension_definition(extension_name)
106
108
  return nil if extension_name.nil?
109
+
107
110
  extension = extensions.find { |x| x['xmlId'] == extension_name || x['name'] == extension_name || x['url'] == extension_name }
108
111
  return nil if extension.nil?
112
+
109
113
  FHIR::STU3::StructureDefinition.new(extension)
110
114
  end
111
115
  deprecate :get_extension_definition, :extension_definition
@@ -113,8 +117,10 @@ module FHIR
113
117
  # Get the basetype (String) for a given profile or extension.
114
118
  def self.basetype(uri)
115
119
  return nil if uri.nil?
120
+
116
121
  defn = profiles.detect { |x| x['url'] == uri } || extensions.detect { |x| x['url'] == uri }
117
122
  return nil if defn.nil?
123
+
118
124
  defn['baseType']
119
125
  end
120
126
  deprecate :get_basetype, :basetype
@@ -122,14 +128,17 @@ module FHIR
122
128
  # Get the StructureDefinition for a given profile.
123
129
  def self.profile(uri)
124
130
  return nil if uri.nil?
131
+
125
132
  defn = profiles.detect { |x| x['url'] == uri } || extensions.detect { |x| x['url'] == uri }
126
133
  return nil if defn.nil?
134
+
127
135
  FHIR::STU3::StructureDefinition.new(defn)
128
136
  end
129
137
  deprecate :get_profile, :profile
130
138
 
131
139
  def self.profiles_for_resource(resource_name)
132
140
  return nil if resource_name.nil?
141
+
133
142
  profiles.select { |x| x['baseType'] == resource_name }.map { |x| FHIR::STU3::StructureDefinition.new(x) }
134
143
  end
135
144
  deprecate :get_profiles_for_resource, :profile_for_resource
@@ -137,6 +146,7 @@ module FHIR
137
146
  # Get a dynamically generated class for a given profile.
138
147
  def self.get_profile_class(uri)
139
148
  return nil if uri.nil?
149
+
140
150
  load_profiles
141
151
  load_extensions
142
152
 
@@ -162,7 +172,7 @@ module FHIR
162
172
  load f
163
173
  # set the return class type
164
174
  klass = Object.const_get("FHIR::STU3::Profile::#{id}::#{type}")
165
- rescue
175
+ rescue StandardError
166
176
  FHIR::STU3.logger.error "Failed to generate class for profile #{uri}"
167
177
  end
168
178
  # unlink the file so it can be garbage collected
@@ -198,6 +208,7 @@ module FHIR
198
208
  def self.get_codes(uri)
199
209
  return nil if uri.nil?
200
210
  return @@cache[uri] if @@cache[uri]
211
+
201
212
  valueset = expansions.find { |x| x['url'] == uri } || valuesets.find { |x| x['url'] == uri && x['resourceType'] == 'ValueSet' }
202
213
  unless valueset.nil?
203
214
  @@cache[uri] = {}
@@ -230,6 +241,7 @@ module FHIR
230
241
  # If one can't be found, return nil
231
242
  def self.get_display(uri, code)
232
243
  return nil if uri.nil? || code.nil?
244
+
233
245
  valuesets_and_expansions = expansions.select { |ex| ex['compose']['include'].detect { |i| i['system'] == uri } }
234
246
  valuesets_and_expansions += valuesets.select { |vs| vs['url'] == uri }
235
247
  code_hash = nil
@@ -269,6 +281,7 @@ module FHIR
269
281
 
270
282
  def self.search_parameters(type_name)
271
283
  return nil if type_name.nil?
284
+
272
285
  search_params.select { |p| p['base'].include?(type_name) && p['xpath'] && !p['xpath'].include?('extension') }.map { |p| p['code'] }
273
286
  end
274
287
  deprecate :get_search_parameters, :search_parameters
@@ -23,7 +23,7 @@ module FHIR
23
23
  def serialize
24
24
  hash = {}
25
25
  instance_variables.each do |v|
26
- hash[v.to_s[1..-1]] = instance_variable_get(v)
26
+ hash[v.to_s[1..]] = instance_variable_get(v)
27
27
  end
28
28
  hash.delete('name')
29
29
  hash.keep_if do |_key, value|
@@ -37,7 +37,7 @@ module FHIR
37
37
 
38
38
  def fix_name(name)
39
39
  fix = nil
40
- fix = "local_#{name}" if %w[class method resourceType].include?(name)
40
+ fix = "local_#{name}" if ['class', 'method', 'resourceType'].include?(name)
41
41
  fix
42
42
  end
43
43
  end
@@ -119,6 +119,7 @@ module FHIR
119
119
  # skip the first element
120
120
  next if element['path'] == path_type
121
121
  next unless element['type']
122
+
122
123
  unique_types = element['type'].map { |t| t['code'] }.uniq
123
124
  if unique_types.include?('Element') || unique_types.include?('BackboneElement')
124
125
  child_templates << element['path']
@@ -128,6 +129,7 @@ module FHIR
128
129
  child_templates.each do |child_name|
129
130
  child_fixed_name = cap_first(child_name.gsub("#{type_name}.", ''))
130
131
  next if child_fixed_name.include?('.')
132
+
131
133
  child_def = { 'id' => child_fixed_name, 'snapshot' => { 'element' => [] } }
132
134
  # Copy the element definitions for the child structure
133
135
  structure_def['snapshot']['element'].each do |element|
@@ -182,13 +184,13 @@ module FHIR
182
184
  field.path = element['path'].gsub(path_type, type_name)
183
185
  field.type = data_type
184
186
  field.type = 'Extension' if field.path.end_with?('extension')
185
- field.type_profiles = profiles if data_type == 'Reference' || data_type == 'Extension'
187
+ field.type_profiles = profiles if ['Reference', 'Extension'].include?(data_type)
186
188
  field.min = element['min']
187
189
  field.max = element['max']
188
190
  field.max = field.max.to_i
189
191
  field.max = '*' if element['max'] == '*'
190
192
 
191
- if %w[code Coding CodeableConcept].include?(data_type) && element['binding']
193
+ if ['code', 'Coding', 'CodeableConcept'].include?(data_type) && element['binding']
192
194
  field.binding = element['binding']
193
195
  field.binding['uri'] = field.binding['valueSetUri']
194
196
  field.binding['uri'] = field.binding['valueSetReference'] if field.binding['uri'].nil?
@@ -203,9 +205,9 @@ module FHIR
203
205
  if field.valid_codes.empty? && field.binding['uri'] && !field.binding['uri'].end_with?('bcp47') && !field.binding['uri'].end_with?('bcp13.txt')
204
206
  FHIR::STU3.logger.warn " MISSING EXPANSION -- #{field.path} #{field.min}..#{field.max}: #{field.binding['uri']} (#{field.binding['strength']})"
205
207
  @missing_expansions = true
206
- @missing_required_expansion = (field.binding['strength'] == 'required') unless @missing_required_expansion
208
+ @missing_required_expansion ||= (field.binding['strength'] == 'required')
207
209
  end
208
- elsif %w[Element BackboneElement].include?(data_type)
210
+ elsif ['Element', 'BackboneElement'].include?(data_type)
209
211
  # This is a nested structure or class
210
212
  field.type = "#{hierarchy.join('::')}::#{cap_first(field.name)}"
211
213
  end
@@ -216,7 +218,7 @@ module FHIR
216
218
  field = FHIR::STU3::Field.new(field_base_name)
217
219
  field.path = element['path'].gsub(path_type, type_name)
218
220
  field.type = element['contentReference']
219
- field.type = field.type[1..-1] if field.type[0] == '#'
221
+ field.type = field.type[1..] if field.type[0] == '#'
220
222
  if hierarchy.last == field.type
221
223
  # reference to self
222
224
  field.type = hierarchy.join('::').to_s