fhir_dstu2_models 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -0
  3. data/lib/fhir_dstu2_models/bootstrap/hashable.rb +3 -3
  4. data/lib/fhir_dstu2_models/bootstrap/model.rb +2 -2
  5. data/lib/fhir_dstu2_models/examples/json/appointment-example-request.json +1 -1
  6. data/lib/fhir_dstu2_models/examples/json/appointment-example.json +1 -1
  7. data/lib/fhir_dstu2_models/examples/json/claim-example-institutional.json +1 -1
  8. data/lib/fhir_dstu2_models/examples/json/claim-example-oral-average.json +5 -5
  9. data/lib/fhir_dstu2_models/examples/json/claim-example-oral-contained.json +1 -1
  10. data/lib/fhir_dstu2_models/examples/json/claim-example-oral-orthoplan.json +4 -4
  11. data/lib/fhir_dstu2_models/examples/json/claim-example-pharmacy.json +1 -1
  12. data/lib/fhir_dstu2_models/examples/json/claim-example-professional.json +1 -1
  13. data/lib/fhir_dstu2_models/examples/json/claim-example-vision-glasses.json +4 -4
  14. data/lib/fhir_dstu2_models/examples/json/claim-example-vision.json +1 -1
  15. data/lib/fhir_dstu2_models/examples/json/claim-example.json +1 -1
  16. data/lib/fhir_dstu2_models/examples/xml/appointment-example(example).xml +1 -1
  17. data/lib/fhir_dstu2_models/examples/xml/appointment-example-request(examplereq).xml +1 -1
  18. data/lib/fhir_dstu2_models/examples/xml/claim-example(100150).xml +1 -1
  19. data/lib/fhir_dstu2_models/examples/xml/claim-example-institutional(960150).xml +1 -1
  20. data/lib/fhir_dstu2_models/examples/xml/claim-example-oral-average(100151).xml +5 -5
  21. data/lib/fhir_dstu2_models/examples/xml/claim-example-oral-contained(100152).xml +1 -1
  22. data/lib/fhir_dstu2_models/examples/xml/claim-example-oral-orthoplan(100153).xml +4 -4
  23. data/lib/fhir_dstu2_models/examples/xml/claim-example-pharmacy(760150).xml +1 -1
  24. data/lib/fhir_dstu2_models/examples/xml/claim-example-professional(860150).xml +1 -1
  25. data/lib/fhir_dstu2_models/examples/xml/claim-example-vision(660150).xml +1 -1
  26. data/lib/fhir_dstu2_models/examples/xml/claim-example-vision-glasses(660151).xml +4 -4
  27. data/lib/fhir_dstu2_models/examples/xml/dataelement-sdc-profile-example(dataelement-sdc-profile-example).xml +0 -1
  28. data/lib/fhir_dstu2_models/fhir_ext/structure_definition.rb +17 -4
  29. data/lib/fhir_dstu2_models/version.rb +1 -1
  30. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b2edac98e094284cc3ac76ad78200622695cffa5440ddb5e440fa11478754bd
4
- data.tar.gz: 1f2a5f79cc61a938753b0a6824557ed615bf5188e991176f9f216cd44f15f9e1
3
+ metadata.gz: 6c22d19c33c6fd72cefbe2aea9b999e17ebd054d5126bbdbb9ce2b4b8b4a49b5
4
+ data.tar.gz: f0f268df74f53918d47e8781ef48eb4b5f5b967668363aaa2cdab1eaba9afe6b
5
5
  SHA512:
6
- metadata.gz: 22dd05a458a4fa6be2983ce891e2abfccf4d7788249aaf733be24ac9a1b054ff8441247078880a765c0bdef27f0a594c81dc264015a75fab425b7a86b2f2fc3d
7
- data.tar.gz: 65f0ee9430f85a0e88f82b6dca5641f2c402b3705d521cbe5f06bd50df1dc7855ac120f6909437a234c2064380e12f8c1f3483b5b5dd7016779d8b04045dd3d9
6
+ metadata.gz: cbe3ed2a3c9164617dac497b0e0b04fcbe8041300b2833a6edcbf317b7a81c0e4acff8339187502dd83a0f9000110bb7dca742d353519f190e4d9cc004f867be
7
+ data.tar.gz: a618f6baf40efd7e9d3a94f52280f7238dfcffa0595577c8e4b753ffd5064d2e1be21bc09695fa76b19ccf1b3ed47e5ac00010cde00d1eccd93b3da5e39ed6e4
@@ -5,6 +5,7 @@ rvm:
5
5
  - 2.3
6
6
  - 2.4
7
7
  - 2.5
8
+ - 2.6
8
9
  script:
9
10
  - bundle exec rake
10
11
  - bundle exec codeclimate-test-reporter
@@ -52,7 +52,7 @@ module FHIR
52
52
  if !klass.nil? && !value.nil?
53
53
  # handle array of objects
54
54
  if value.is_a?(Array)
55
- value.map! do |child|
55
+ value = value.map do |child|
56
56
  obj = child
57
57
  unless [FHIR::DSTU2::RESOURCES, FHIR::DSTU2::TYPES].flatten.include? child.class.name.gsub('FHIR::DSTU2::', '')
58
58
  obj = make_child(child, klass)
@@ -69,7 +69,7 @@ module FHIR
69
69
  FHIR::DSTU2.logger.error("Unhandled and unrecognized class/type: #{meta['type']}")
70
70
  elsif value.is_a?(Array)
71
71
  # array of primitives
72
- value.map! { |child| convert_primitive(child, meta) }
72
+ value = value.map { |child| convert_primitive(child, meta) }
73
73
  instance_variable_set("@#{local_name}", value)
74
74
  else
75
75
  # single primitive
@@ -110,7 +110,7 @@ module FHIR
110
110
  elsif FHIR::DSTU2::PRIMITIVES.include?(meta['type'])
111
111
  primitive_meta = FHIR::DSTU2::PRIMITIVES[meta['type']]
112
112
  if primitive_meta['type'] == 'number'
113
- rval = BigDecimal.new(value.to_s)
113
+ rval = BigDecimal(value.to_s)
114
114
  rval = rval.frac.zero? ? rval.to_i : rval.to_f
115
115
  end # primitive is number
116
116
  end # boolean else
@@ -209,8 +209,8 @@ module FHIR
209
209
  else
210
210
  errors[field] << "#{meta['path']}: expected Reference, found #{klassname}"
211
211
  end
212
- # if the data type is a particular resource or complex type
213
- elsif FHIR::DSTU2::RESOURCES.include?(datatype) || FHIR::DSTU2::TYPES.include?(datatype)
212
+ # if the data type is a particular resource or complex type or BackBone element within this resource
213
+ elsif FHIR::DSTU2::RESOURCES.include?(datatype) || FHIR::DSTU2::TYPES.include?(datatype) || v.class.name.start_with?(self.class.name)
214
214
  if datatype == klassname
215
215
  validation = v.validate(contained_here)
216
216
  errors[field] << validation unless validation.empty?
@@ -43,7 +43,7 @@
43
43
  {
44
44
  "coding": [
45
45
  {
46
- "code": "attending"
46
+ "code": "ATND"
47
47
  }
48
48
  ]
49
49
  }
@@ -33,7 +33,7 @@
33
33
  {
34
34
  "coding": [
35
35
  {
36
- "code": "attending"
36
+ "code": "ATND"
37
37
  }
38
38
  ]
39
39
  }
@@ -55,7 +55,7 @@
55
55
  {
56
56
  "sequence": 1,
57
57
  "type": {
58
- "code": "service"
58
+ "code": "CSINV"
59
59
  },
60
60
  "provider": {
61
61
  "reference": "Practitioner/example"
@@ -55,7 +55,7 @@
55
55
  {
56
56
  "sequence": 1,
57
57
  "type": {
58
- "code": "service"
58
+ "code": "CSINV"
59
59
  },
60
60
  "provider": {
61
61
  "reference": "Practitioner/example"
@@ -79,7 +79,7 @@
79
79
  {
80
80
  "sequence": 2,
81
81
  "type": {
82
- "code": "service"
82
+ "code": "CSINV"
83
83
  },
84
84
  "provider": {
85
85
  "reference": "Practitioner/example"
@@ -113,7 +113,7 @@
113
113
  {
114
114
  "sequence": 3,
115
115
  "type": {
116
- "code": "group"
116
+ "code": "CPNDDRGING"
117
117
  },
118
118
  "provider": {
119
119
  "reference": "Practitioner/example"
@@ -141,7 +141,7 @@
141
141
  {
142
142
  "sequence": 1,
143
143
  "type": {
144
- "code": "service"
144
+ "code": "CSINV"
145
145
  },
146
146
  "service": {
147
147
  "system": "http://hl7.org/fhir/oralservicecodes",
@@ -161,7 +161,7 @@
161
161
  {
162
162
  "sequence": 2,
163
163
  "type": {
164
- "code": "service"
164
+ "code": "CSINV"
165
165
  },
166
166
  "service": {
167
167
  "system": "http://hl7.org/fhir/oralservicecodes",
@@ -139,7 +139,7 @@
139
139
  {
140
140
  "sequence": 1,
141
141
  "type": {
142
- "code": "service"
142
+ "code": "CSINV"
143
143
  },
144
144
  "provider": {
145
145
  "reference": "#practitioner-1"
@@ -213,7 +213,7 @@
213
213
  {
214
214
  "sequence": 2,
215
215
  "type": {
216
- "code": "service"
216
+ "code": "CSINV"
217
217
  },
218
218
  "provider": {
219
219
  "reference": "Practitioner/example"
@@ -247,7 +247,7 @@
247
247
  {
248
248
  "sequence": 3,
249
249
  "type": {
250
- "code": "group"
250
+ "code": "CPNDDRGING"
251
251
  },
252
252
  "provider": {
253
253
  "reference": "Practitioner/example"
@@ -275,7 +275,7 @@
275
275
  {
276
276
  "sequence": 1,
277
277
  "type": {
278
- "code": "service"
278
+ "code": "CSINV"
279
279
  },
280
280
  "service": {
281
281
  "system": "http://hl7.org/fhir/oralservicecodes",
@@ -295,7 +295,7 @@
295
295
  {
296
296
  "sequence": 2,
297
297
  "type": {
298
- "code": "service"
298
+ "code": "CSINV"
299
299
  },
300
300
  "service": {
301
301
  "system": "http://hl7.org/fhir/oralservicecodes",
@@ -55,7 +55,7 @@
55
55
  {
56
56
  "sequence": 1,
57
57
  "type": {
58
- "code": "service"
58
+ "code": "CSINV"
59
59
  },
60
60
  "provider": {
61
61
  "reference": "Practitioner/example"
@@ -55,7 +55,7 @@
55
55
  {
56
56
  "sequence": 1,
57
57
  "type": {
58
- "code": "service"
58
+ "code": "CSINV"
59
59
  },
60
60
  "provider": {
61
61
  "reference": "Practitioner/example"
@@ -58,7 +58,7 @@
58
58
  {
59
59
  "sequence": 1,
60
60
  "type": {
61
- "code": "group"
61
+ "code": "CPNDDRGING"
62
62
  },
63
63
  "provider": {
64
64
  "reference": "Practitioner/example"
@@ -82,7 +82,7 @@
82
82
  {
83
83
  "sequence": 1,
84
84
  "type": {
85
- "code": "product"
85
+ "code": "CPINV"
86
86
  },
87
87
  "service": {
88
88
  "system": "http://hl7.org/fhir/ex-visionservice",
@@ -102,7 +102,7 @@
102
102
  {
103
103
  "sequence": 2,
104
104
  "type": {
105
- "code": "product"
105
+ "code": "CPINV"
106
106
  },
107
107
  "service": {
108
108
  "system": "http://hl7.org/fhir/ex-visionservice",
@@ -125,7 +125,7 @@
125
125
  {
126
126
  "sequence": 3,
127
127
  "type": {
128
- "code": "tax"
128
+ "code": "VRXINV"
129
129
  },
130
130
  "service": {
131
131
  "system": "http://hl7.org/fhir/ex-visionservice",
@@ -55,7 +55,7 @@
55
55
  {
56
56
  "sequence": 1,
57
57
  "type": {
58
- "code": "service"
58
+ "code": "CSINV"
59
59
  },
60
60
  "provider": {
61
61
  "reference": "Practitioner/example"
@@ -55,7 +55,7 @@
55
55
  {
56
56
  "sequence": 1,
57
57
  "type": {
58
- "code": "service"
58
+ "code": "CSINV"
59
59
  },
60
60
  "provider": {
61
61
  "reference": "Practitioner/example"
@@ -27,7 +27,7 @@
27
27
  <participant>
28
28
  <type>
29
29
  <coding>
30
- <code value="attending"/>
30
+ <code value="ATND"/>
31
31
  </coding>
32
32
  </type>
33
33
  <actor>
@@ -33,7 +33,7 @@
33
33
  <participant>
34
34
  <type>
35
35
  <coding>
36
- <code value="attending"/>
36
+ <code value="ATND"/>
37
37
  </coding>
38
38
  </type>
39
39
  <required value="required"/>
@@ -61,7 +61,7 @@
61
61
  <item>
62
62
  <sequence value="1"/>
63
63
  <type>
64
- <code value="service"/>
64
+ <code value="CSINV"/>
65
65
  </type>
66
66
  <provider>
67
67
  <reference value="Practitioner/example"/>
@@ -60,7 +60,7 @@
60
60
  <item>
61
61
  <sequence value="1"/>
62
62
  <type>
63
- <code value="service"/>
63
+ <code value="CSINV"/>
64
64
  </type>
65
65
  <provider>
66
66
  <reference value="Practitioner/example"/>
@@ -60,7 +60,7 @@
60
60
  <item>
61
61
  <sequence value="1"/>
62
62
  <type>
63
- <code value="service"/>
63
+ <code value="CSINV"/>
64
64
  </type>
65
65
  <provider>
66
66
  <reference value="Practitioner/example"/>
@@ -85,7 +85,7 @@
85
85
  <item>
86
86
  <sequence value="2"/>
87
87
  <type>
88
- <code value="service"/>
88
+ <code value="CSINV"/>
89
89
  </type>
90
90
  <provider>
91
91
  <reference value="Practitioner/example"/>
@@ -118,7 +118,7 @@
118
118
  <item>
119
119
  <sequence value="3"/>
120
120
  <type>
121
- <code value="group"/>
121
+ <code value="DRUGING"/>
122
122
  </type>
123
123
  <provider>
124
124
  <reference value="Practitioner/example"/>
@@ -145,7 +145,7 @@
145
145
  <detail>
146
146
  <sequence value="1"/>
147
147
  <type>
148
- <code value="service"/>
148
+ <code value="CSINV"/>
149
149
  </type>
150
150
  <service>
151
151
  <system value="http://hl7.org/fhir/oralservicecodes"/>
@@ -165,7 +165,7 @@
165
165
  <detail>
166
166
  <sequence value="2"/>
167
167
  <type>
168
- <code value="service"/>
168
+ <code value="CSINV"/>
169
169
  </type>
170
170
  <service>
171
171
  <system value="http://hl7.org/fhir/oralservicecodes"/>
@@ -116,7 +116,7 @@
116
116
  <item>
117
117
  <sequence value="1"/>
118
118
  <type>
119
- <code value="service"/>
119
+ <code value="CSINV"/>
120
120
  </type>
121
121
  <provider>
122
122
  <reference value="#practitioner-1"/>
@@ -189,7 +189,7 @@
189
189
  <item>
190
190
  <sequence value="2"/>
191
191
  <type>
192
- <code value="service"/>
192
+ <code value="CSINV"/>
193
193
  </type>
194
194
  <provider>
195
195
  <reference value="Practitioner/example"/>
@@ -222,7 +222,7 @@
222
222
  <item>
223
223
  <sequence value="3"/>
224
224
  <type>
225
- <code value="group"/>
225
+ <code value="DRUGING"/>
226
226
  </type>
227
227
  <provider>
228
228
  <reference value="Practitioner/example"/>
@@ -249,7 +249,7 @@
249
249
  <detail>
250
250
  <sequence value="1"/>
251
251
  <type>
252
- <code value="service"/>
252
+ <code value="CSINV"/>
253
253
  </type>
254
254
  <service>
255
255
  <system value="http://hl7.org/fhir/oralservicecodes"/>
@@ -269,7 +269,7 @@
269
269
  <detail>
270
270
  <sequence value="2"/>
271
271
  <type>
272
- <code value="service"/>
272
+ <code value="CSINV"/>
273
273
  </type>
274
274
  <service>
275
275
  <system value="http://hl7.org/fhir/oralservicecodes"/>
@@ -60,7 +60,7 @@
60
60
  <item>
61
61
  <sequence value="1"/>
62
62
  <type>
63
- <code value="service"/>
63
+ <code value="CSINV"/>
64
64
  </type>
65
65
  <provider>
66
66
  <reference value="Practitioner/example"/>
@@ -60,7 +60,7 @@
60
60
  <item>
61
61
  <sequence value="1"/>
62
62
  <type>
63
- <code value="service"/>
63
+ <code value="CSINV"/>
64
64
  </type>
65
65
  <provider>
66
66
  <reference value="Practitioner/example"/>
@@ -60,7 +60,7 @@
60
60
  <item>
61
61
  <sequence value="1"/>
62
62
  <type>
63
- <code value="service"/>
63
+ <code value="CSINV"/>
64
64
  </type>
65
65
  <provider>
66
66
  <reference value="Practitioner/example"/>
@@ -64,7 +64,7 @@
64
64
  <item>
65
65
  <sequence value="1"/>
66
66
  <type>
67
- <code value="group"/>
67
+ <code value="DRUGING"/>
68
68
  </type>
69
69
  <provider>
70
70
  <reference value="Practitioner/example"/>
@@ -87,7 +87,7 @@
87
87
  <detail>
88
88
  <sequence value="1"/>
89
89
  <type>
90
- <code value="product"/>
90
+ <code value="CPINV"/>
91
91
  </type>
92
92
  <service>
93
93
  <system value="http://hl7.org/fhir/ex-visionservice"/>
@@ -107,7 +107,7 @@
107
107
  <detail>
108
108
  <sequence value="2"/>
109
109
  <type>
110
- <code value="product"/>
110
+ <code value="CPINV"/>
111
111
  </type>
112
112
  <service>
113
113
  <system value="http://hl7.org/fhir/ex-visionservice"/>
@@ -130,7 +130,7 @@
130
130
  <detail>
131
131
  <sequence value="3"/>
132
132
  <type>
133
- <code value="tax"/>
133
+ <code value="CPINV"/>
134
134
  </type>
135
135
  <service>
136
136
  <system value="http://hl7.org/fhir/ex-visionservice"/>
@@ -37,7 +37,6 @@
37
37
  </binding>
38
38
  <mapping>
39
39
  <identity value="c-cda"/>
40
- <language value="xpath"/>
41
40
  <map value="/ClinicalDocument/recordTarget/patientRole/patient/administrativeGender"/>
42
41
  </mapping>
43
42
  </element>
@@ -26,6 +26,10 @@ module FHIR
26
26
  @vs_validators.delete valueset_uri
27
27
  end
28
28
 
29
+ def self.clear_all_validates_vs
30
+ @vs_validators = {}
31
+ end
32
+
29
33
  def validates_resource?(resource)
30
34
  validate_resource(resource).empty?
31
35
  end
@@ -204,8 +208,7 @@ module FHIR
204
208
  elsif data_type_found == 'CodeableConcept' && codeable_concept_binding
205
209
  binding_issues =
206
210
  if element.binding.strength == 'extensible'
207
- # TODO: make this @warnings, once we have a way to return warnings
208
- @errors
211
+ @warnings
209
212
  elsif element.binding.strength == 'required'
210
213
  @errors
211
214
  else # e.g., example-strength or unspecified
@@ -213,16 +216,26 @@ module FHIR
213
216
  end
214
217
 
215
218
  valueset_uri = element.binding && element.binding.valueSetReference && element.binding.valueSetReference.reference
219
+ vcc = FHIR::DSTU2::CodeableConcept.new(value)
216
220
  if valueset_uri && self.class.vs_validators[valueset_uri]
217
221
  check_fn = self.class.vs_validators[valueset_uri]
218
- vcc = FHIR::DSTU2::CodeableConcept.new(value)
219
-
220
222
  has_valid_code = vcc.coding && vcc.coding.any? { |c| check_fn.call(c) }
221
223
 
222
224
  unless has_valid_code
223
225
  binding_issues << "#{describe_element(element)} has no codings from #{valueset_uri}. Codings evaluated: #{vcc.to_json}"
224
226
  end
225
227
  end
228
+
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
236
+ end
237
+ end
238
+
226
239
  elsif data_type_found == 'String' && !element.maxLength.nil? && (value.size > element.maxLength)
227
240
  @errors << "#{describe_element(element)} exceed maximum length of #{element.maxLength}: #{value}"
228
241
  end
@@ -1,7 +1,7 @@
1
1
  module FHIR
2
2
  module DSTU2
3
3
  module Models
4
- VERSION = '1.0.5'.freeze
4
+ VERSION = '1.0.6'.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.5
4
+ version: 1.0.6
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-06 00:00:00.000000000 Z
14
+ date: 2019-02-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: nokogiri