fhir_dstu2_models 1.0.7 → 1.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07653a36e5223df9b1a7378f40621c24b7494a08a195b6f85b713b8c93fa30da
4
- data.tar.gz: a17b3b533c51e62bd72d84aa7281e34cb1c3d7d768397bd1856f678da4da32f5
3
+ metadata.gz: 440c728fbf6cc0e7764c1b7cebce1864bb0dc15757b11bb87379b39c3f740c62
4
+ data.tar.gz: 50cd56593e64cc04d94c463e53068acd653750e8fb32990a23f4c8829dba6d87
5
5
  SHA512:
6
- metadata.gz: 7cd9c1c30d456db190949cf4a016040bb433c105481609f16b8f4aa08ae34dc96f0579a484bc92fbfeef114cbc9c8b8065f14858fa021c6c08513818f109c171
7
- data.tar.gz: fa373b2947abf8bdd06f7d653665902ded7a2424357cc3e1a577a6497443d0a0f4f549b9d202766b6a6362054485e07dda0081722ae7ccd44d9c31480c8dd0d1
6
+ metadata.gz: de740ab400448fd89ff07d835646f47adcb01708e479fb5b251c44991c3f965fa034472a8f6f08bbc70b0da39a4f04bc5c3029f5dcb34730c266b61b2eaef0bf
7
+ data.tar.gz: 43653566bda0db07b8a5c0275b2a85fab00d17c0172fe75ac9468e1dd702c194e3f74b09a1ee260d2be27d5b7e29ea6616e339efb456b0996cdcdf5b1179b6b1
@@ -1,6 +1,6 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
  AllCops:
3
- TargetRubyVersion: 2.2
3
+ TargetRubyVersion: 2.4
4
4
  Exclude:
5
5
  - 'test/**/*'
6
6
  - 'spec/**/*'
@@ -12,3 +12,6 @@ AllCops:
12
12
  - 'vendor/**/*'
13
13
  Metrics/LineLength:
14
14
  Enabled: false
15
+
16
+ Style/FrozenStringLiteralComment:
17
+ Enabled: false
@@ -1,38 +1,35 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-02-25 13:02:53 -0500 using RuboCop version 0.47.1.
3
+ # on 2019-03-28 10:35:44 -0400 using RuboCop version 0.52.1.
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
- Performance/Caller:
10
- Enabled: false
11
-
12
- # Offense count: 37
9
+ # Offense count: 40
13
10
  Metrics/AbcSize:
14
11
  Max: 423
15
12
 
16
- # Offense count: 10
13
+ # Offense count: 9
17
14
  # Configuration parameters: CountComments, ExcludedMethods.
18
15
  Metrics/BlockLength:
19
- Max: 150
16
+ Max: 108
20
17
 
21
- # Offense count: 1
18
+ # Offense count: 15
22
19
  # Configuration parameters: CountBlocks.
23
20
  Metrics/BlockNesting:
24
21
  Max: 5
25
22
 
26
- # Offense count: 5
23
+ # Offense count: 6
27
24
  # Configuration parameters: CountComments.
28
25
  Metrics/ClassLength:
29
- Max: 499
26
+ Max: 327
30
27
 
31
- # Offense count: 26
28
+ # Offense count: 27
32
29
  Metrics/CyclomaticComplexity:
33
30
  Max: 69
34
31
 
35
- # Offense count: 40
32
+ # Offense count: 46
36
33
  # Configuration parameters: CountComments.
37
34
  Metrics/MethodLength:
38
35
  Max: 120
@@ -40,19 +37,39 @@ Metrics/MethodLength:
40
37
  # Offense count: 1
41
38
  # Configuration parameters: CountComments.
42
39
  Metrics/ModuleLength:
43
- Max: 120
44
-
40
+ Max: 114
45
41
 
46
42
  # Offense count: 25
47
43
  Metrics/PerceivedComplexity:
48
44
  Max: 72
49
45
 
50
- # Offense count: 16
46
+ # Offense count: 3
47
+ Performance/Caller:
48
+ Exclude:
49
+ - 'lib/fhir_dstu2_models/bootstrap/model.rb'
50
+ - 'lib/fhir_dstu2_models/deprecate.rb'
51
+
52
+ # Offense count: 3
53
+ # Cop supports --auto-correct.
54
+ # Configuration parameters: AutoCorrect.
55
+ Performance/HashEachMethods:
56
+ Exclude:
57
+ - 'lib/fhir_dstu2_models/bootstrap/definitions.rb'
58
+ - 'lib/fhir_dstu2_models/bootstrap/model.rb'
59
+ - 'lib/fhir_dstu2_models/bootstrap/preprocess.rb'
60
+
61
+ # Offense count: 15
51
62
  Style/ClassVars:
52
63
  Exclude:
53
64
  - 'lib/fhir_dstu2_models/bootstrap/definitions.rb'
54
65
  - 'lib/fhir_dstu2_models/fluentpath/parse.rb'
55
66
 
67
+ # Offense count: 6
68
+ Style/CommentedKeyword:
69
+ Exclude:
70
+ - 'lib/fhir_dstu2_models/bootstrap/hashable.rb'
71
+ - 'lib/fhir_dstu2_models/bootstrap/model.rb'
72
+
56
73
  # Offense count: 14
57
74
  Style/Documentation:
58
75
  Exclude:
@@ -73,7 +90,88 @@ Style/Documentation:
73
90
  - 'lib/fhir_dstu2_models/fluentpath/expression.rb'
74
91
  - 'lib/fhir_dstu2_models/fluentpath/parse.rb'
75
92
 
93
+ # Offense count: 29
94
+ # Cop supports --auto-correct.
95
+ Style/IfUnlessModifier:
96
+ Exclude:
97
+ - 'lib/fhir_dstu2_models/bootstrap/generator.rb'
98
+ - 'lib/fhir_dstu2_models/bootstrap/hashable.rb'
99
+ - 'lib/fhir_dstu2_models/bootstrap/model.rb'
100
+ - 'lib/fhir_dstu2_models/bootstrap/template.rb'
101
+ - 'lib/fhir_dstu2_models/bootstrap/xml.rb'
102
+ - 'lib/fhir_dstu2_models/fhir_ext/structure_definition.rb'
103
+ - 'lib/fhir_dstu2_models/fhir_ext/structure_definition_compare.rb'
104
+
105
+ # Offense count: 1
106
+ # Cop supports --auto-correct.
107
+ # Configuration parameters: EnforcedStyle.
108
+ # SupportedStyles: line_count_dependent, lambda, literal
109
+ Style/Lambda:
110
+ Exclude:
111
+ - 'lib/fhir_dstu2_models/fhir_ext/structure_definition.rb'
112
+
113
+ # Offense count: 2
114
+ # Cop supports --auto-correct.
115
+ # Configuration parameters: EnforcedStyle.
116
+ # SupportedStyles: call, braces
117
+ Style/LambdaCall:
118
+ Exclude:
119
+ - 'lib/fhir_dstu2_models/fhir_ext/structure_definition.rb'
120
+
76
121
  # Offense count: 1
77
122
  Style/MethodMissing:
78
123
  Exclude:
79
124
  - 'lib/fhir_dstu2_models/bootstrap/model.rb'
125
+
126
+ # Offense count: 2
127
+ # Cop supports --auto-correct.
128
+ # Configuration parameters: AutoCorrect, EnforcedStyle.
129
+ # SupportedStyles: predicate, comparison
130
+ Style/NumericPredicate:
131
+ Exclude:
132
+ - 'spec/**/*'
133
+ - 'lib/fhir_dstu2_models/fhir_ext/structure_definition_compare.rb'
134
+
135
+ # Offense count: 1
136
+ # Cop supports --auto-correct.
137
+ Style/OrAssignment:
138
+ Exclude:
139
+ - 'lib/fhir_dstu2_models/bootstrap/generator.rb'
140
+
141
+ # Offense count: 17
142
+ # Cop supports --auto-correct.
143
+ # Configuration parameters: EnforcedStyle.
144
+ # SupportedStyles: implicit, explicit
145
+ Style/RescueStandardError:
146
+ Exclude:
147
+ - 'lib/fhir_dstu2_models/bootstrap/definitions.rb'
148
+ - 'lib/fhir_dstu2_models/bootstrap/hashable.rb'
149
+ - 'lib/fhir_dstu2_models/bootstrap/json.rb'
150
+ - 'lib/fhir_dstu2_models/bootstrap/model.rb'
151
+ - 'lib/fhir_dstu2_models/bootstrap/xml.rb'
152
+ - 'lib/fhir_dstu2_models/fhir.rb'
153
+ - 'lib/fhir_dstu2_models/fhir_ext/structure_definition.rb'
154
+ - 'lib/fhir_dstu2_models/fhir_ext/structure_definition_finding.rb'
155
+ - 'lib/fhir_dstu2_models/fluentpath/expression.rb'
156
+ - 'lib/fhir_dstu2_models/fluentpath/parse.rb'
157
+
158
+ # Offense count: 2
159
+ # Cop supports --auto-correct.
160
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil.
161
+ Style/SafeNavigation:
162
+ Exclude:
163
+ - 'lib/fhir_dstu2_models/bootstrap/definitions.rb'
164
+
165
+ # Offense count: 1
166
+ # Cop supports --auto-correct.
167
+ # Configuration parameters: EnforcedStyle.
168
+ # SupportedStyles: require_parentheses, require_no_parentheses
169
+ Style/StabbyLambdaParentheses:
170
+ Exclude:
171
+ - 'lib/fhir_dstu2_models/fhir_ext/structure_definition.rb'
172
+
173
+ # Offense count: 309
174
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
175
+ # URISchemes: http, https
176
+ Metrics/LineLength:
177
+ Max: 292
@@ -2,7 +2,6 @@ language: ruby
2
2
  env:
3
3
  - TESTMEMORY=0 GCDELAY=2.0
4
4
  rvm:
5
- - 2.3
6
5
  - 2.4
7
6
  - 2.5
8
7
  - 2.6
@@ -18,4 +17,5 @@ addons:
18
17
  code_climate:
19
18
  repo_token: 0230b3379581b30743b7b4355d7394e427648e604d19a2aba987956201eee290
20
19
  before_install:
20
+ - gem update --system
21
21
  - gem install bundler
@@ -41,6 +41,7 @@ GEM
41
41
  test-unit (~> 3.0)
42
42
  i18n (1.5.3)
43
43
  concurrent-ruby (~> 1.0)
44
+ jaro_winkler (1.5.2)
44
45
  json (2.1.0)
45
46
  listen (3.1.5)
46
47
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -59,16 +60,15 @@ GEM
59
60
  notiffany (0.1.1)
60
61
  nenv (~> 0.1)
61
62
  shellany (~> 0.0)
62
- parallel (1.12.1)
63
- parser (2.5.1.0)
63
+ parallel (1.14.0)
64
+ parser (2.6.2.0)
64
65
  ast (~> 2.4.0)
65
66
  power_assert (1.1.1)
66
- powerpack (0.1.1)
67
+ powerpack (0.1.2)
67
68
  pry (0.11.3)
68
69
  coderay (~> 1.1.0)
69
70
  method_source (~> 0.9.0)
70
- rainbow (2.2.2)
71
- rake
71
+ rainbow (3.0.0)
72
72
  rake (12.3.1)
73
73
  rb-fsevent (0.10.3)
74
74
  rb-inotify (0.9.10)
@@ -86,14 +86,14 @@ GEM
86
86
  diff-lcs (>= 1.2.0, < 2.0)
87
87
  rspec-support (~> 3.7.0)
88
88
  rspec-support (3.7.1)
89
- rubocop (0.49.0)
89
+ rubocop (0.52.1)
90
90
  parallel (~> 1.10)
91
- parser (>= 2.3.3.1, < 3.0)
91
+ parser (>= 2.4.0.2, < 3.0)
92
92
  powerpack (~> 0.1)
93
- rainbow (>= 1.99.1, < 3.0)
93
+ rainbow (>= 2.2.2, < 4.0)
94
94
  ruby-progressbar (~> 1.7)
95
95
  unicode-display_width (~> 1.0, >= 1.0.1)
96
- ruby-progressbar (1.9.0)
96
+ ruby-progressbar (1.10.0)
97
97
  ruby_dep (1.5.0)
98
98
  shellany (0.0.1)
99
99
  simplecov (0.13.0)
@@ -105,7 +105,7 @@ GEM
105
105
  test-unit (3.2.7)
106
106
  power_assert
107
107
  thor (0.20.0)
108
- unicode-display_width (1.3.2)
108
+ unicode-display_width (1.5.0)
109
109
 
110
110
  PLATFORMS
111
111
  ruby
@@ -120,7 +120,7 @@ DEPENDENCIES
120
120
  pry
121
121
  rake
122
122
  rspec
123
- rubocop (= 0.49)
123
+ rubocop (= 0.52.1)
124
124
  simplecov
125
125
  test-unit
126
126
 
@@ -128,4 +128,4 @@ RUBY VERSION
128
128
  ruby 2.5.1p57
129
129
 
130
130
  BUNDLED WITH
131
- 1.16.2
131
+ 2.0.1
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'rspec'
33
33
  spec.add_development_dependency 'simplecov'
34
34
  spec.add_development_dependency 'nokogiri-diff'
35
- spec.add_development_dependency 'rubocop', '0.49'
35
+ spec.add_development_dependency 'rubocop', '0.52.1'
36
36
  spec.add_development_dependency 'codeclimate-test-reporter'
37
37
  spec.add_development_dependency 'guard-rspec'
38
38
  spec.add_development_dependency 'guard-test'
@@ -168,7 +168,6 @@ module FHIR
168
168
  # Check the datatype for each node, only if the element has one declared, and it isn't the root element
169
169
  if !element.type.empty? && element.path != id
170
170
  codeable_concept_pattern = element.pattern && element.pattern.is_a?(FHIR::DSTU2::CodeableConcept)
171
- codeable_concept_binding = element.binding
172
171
  matching_pattern = false
173
172
  nodes.each do |value|
174
173
  matching_type = 0
@@ -205,35 +204,45 @@ module FHIR
205
204
  matching_pattern = true if vcoding.system == pcoding.system && vcoding.code == pcoding.code
206
205
  end
207
206
  end
208
- elsif data_type_found == 'CodeableConcept' && codeable_concept_binding
209
- binding_issues =
210
- if element.binding.strength == 'extensible'
211
- @warnings
212
- elsif element.binding.strength == 'required'
213
- @errors
214
- else # e.g., example-strength or unspecified
215
- [] # Drop issues errors on the floor, in throwaway array
207
+ elsif %w[CodeableConcept Coding Quantity].include? data_type_found
208
+ required_strength = element&.binding&.strength == 'required'
209
+ binding_issues = required_strength ? @errors : @warnings
210
+
211
+ valueset_uri = element&.binding&.valueSetReference&.reference
212
+ check_code = ->coding do
213
+ # Can't validate if both code and system are not given
214
+ if coding['code'].nil? || coding['system'].nil?
215
+ binding_issues << "#{describe_element(element)} code: #{coding.to_json} missing code" if coding['code'].nil?
216
+ binding_issues << "#{describe_element(element)} code: #{coding.to_json} missing system" if coding['system'].nil?
217
+ return
216
218
  end
217
219
 
218
- valueset_uri = element.binding && element.binding.valueSetReference && element.binding.valueSetReference.reference
219
- vcc = FHIR::DSTU2::CodeableConcept.new(value)
220
- if valueset_uri && self.class.vs_validators[valueset_uri]
220
+ # ValueSet Validation
221
221
  check_fn = self.class.vs_validators[valueset_uri]
222
- has_valid_code = vcc.coding && vcc.coding.any? { |c| check_fn.call(c) }
222
+ has_valid_code = false
223
+ if check_fn
224
+ has_valid_code = check_fn.call(coding)
225
+ binding_issues << "#{describe_element(element)} has no codings from #{valueset_uri}. Codings evaluated: #{coding.to_json}" unless has_valid_code
226
+ end
223
227
 
228
+ # CodeSystem Validation
224
229
  unless has_valid_code
225
- binding_issues << "#{describe_element(element)} has no codings from #{valueset_uri}. Codings evaluated: #{vcc.to_json}"
230
+ check_fn = self.class.vs_validators[coding['system']]
231
+ if check_fn && !check_fn.call(coding)
232
+ binding_issues << "#{describe_element(element)} has no codings from it's specified system: #{coding['system']}. "\
233
+ "Codings evaluated: #{coding.to_json}"
234
+ end
226
235
  end
227
236
  end
228
237
 
229
- unless has_valid_code
230
- vcc.coding.each do |c|
231
- check_fn = self.class.vs_validators[c.system]
232
- if check_fn && !check_fn.call(c)
233
- binding_issues << "#{describe_element(element)} has no codings from it's specified system: #{c.system}. "\
234
- "Codings evaluated: #{vcc.to_json}"
235
- end
238
+ if data_type_found == 'CodeableConcept'
239
+ value['coding']&.each do |coding|
240
+ check_code.(coding)
236
241
  end
242
+ else
243
+ # avoid checking Codings twice if they are already checked as part of a CodeableConcept
244
+ # The CodeableConcept should contain the binding for the children Codings
245
+ check_code.(value) unless element.path == 'CodeableConcept.coding'
237
246
  end
238
247
 
239
248
  elsif data_type_found == 'String' && !element.maxLength.nil? && (value.size > element.maxLength)
@@ -284,13 +293,9 @@ module FHIR
284
293
  unless definition.nil?
285
294
  ret_val = false
286
295
  begin
287
- # klass = Module.const_get("FHIR::DSTU2::#{data_type_code}")
288
- # ret_val = definition.validates_resource?(klass.new(deep_copy(value)))
289
296
  ret_val = definition.validates_hash?(value)
290
- unless ret_val
291
- @errors += definition.errors
292
- @warnings += definition.warnings
293
- end
297
+ @errors += definition.errors
298
+ @warnings += definition.warnings
294
299
  rescue
295
300
  @errors << "Unable to verify #{data_type_code} as a FHIR::DSTU2 Resource."
296
301
  end
@@ -308,13 +313,9 @@ module FHIR
308
313
  if !definition.nil?
309
314
  ret_val = false
310
315
  begin
311
- # klass = Module.const_get("FHIR::DSTU2::#{resource_type}")
312
- # ret_val = definition.validates_resource?(klass.new(deep_copy(value)))
313
316
  ret_val = definition.validates_hash?(value)
314
- unless ret_val
315
- @errors += definition.errors
316
- @warnings += definition.warnings
317
- end
317
+ @errors += definition.errors
318
+ @warnings += definition.warnings
318
319
  rescue
319
320
  @errors << "Unable to verify #{resource_type} as a FHIR::DSTU2 Resource."
320
321
  end
@@ -334,13 +335,9 @@ module FHIR
334
335
  if !definition.nil?
335
336
  ret_val = false
336
337
  begin
337
- # klass = Module.const_get("FHIR::DSTU2::#{data_type_code}")
338
- # ret_val = definition.validates_resource?(klass.new(deep_copy(value)))
339
338
  ret_val = definition.validates_hash?(value)
340
- unless ret_val
341
- @errors += definition.errors
342
- @warnings += definition.warnings
343
- end
339
+ @errors += definition.errors
340
+ @warnings += definition.warnings
344
341
  rescue
345
342
  @errors << "Unable to verify #{data_type_code} as a FHIR::DSTU2 type."
346
343
  end
@@ -1,7 +1,7 @@
1
1
  module FHIR
2
2
  module DSTU2
3
3
  module Models
4
- VERSION = '1.0.7'.freeze
4
+ VERSION = '1.0.8'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fhir_dstu2_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Walonoski
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2019-02-26 00:00:00.000000000 Z
14
+ date: 2019-03-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: nokogiri
@@ -179,14 +179,14 @@ dependencies:
179
179
  requirements:
180
180
  - - '='
181
181
  - !ruby/object:Gem::Version
182
- version: '0.49'
182
+ version: 0.52.1
183
183
  type: :development
184
184
  prerelease: false
185
185
  version_requirements: !ruby/object:Gem::Requirement
186
186
  requirements:
187
187
  - - '='
188
188
  - !ruby/object:Gem::Version
189
- version: '0.49'
189
+ version: 0.52.1
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: codeclimate-test-reporter
192
192
  requirement: !ruby/object:Gem::Requirement