fhir_dstu2_models 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +0 -1
- data/Gemfile.lock +5 -5
- data/lib/fhir_dstu2_models/fhir_ext/structure_definition.rb +34 -0
- data/lib/fhir_dstu2_models/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0b2edac98e094284cc3ac76ad78200622695cffa5440ddb5e440fa11478754bd
|
4
|
+
data.tar.gz: 1f2a5f79cc61a938753b0a6824557ed615bf5188e991176f9f216cd44f15f9e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22dd05a458a4fa6be2983ce891e2abfccf4d7788249aaf733be24ac9a1b054ff8441247078880a765c0bdef27f0a594c81dc264015a75fab425b7a86b2f2fc3d
|
7
|
+
data.tar.gz: 65f0ee9430f85a0e88f82b6dca5641f2c402b3705d521cbe5f06bd50df1dc7855ac120f6909437a234c2064380e12f8c1f3483b5b5dd7016779d8b04045dd3d9
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fhir_dstu2_models (1.0.
|
4
|
+
fhir_dstu2_models (1.0.5)
|
5
5
|
bcp47 (>= 0.3)
|
6
6
|
date_time_precision (>= 0.8)
|
7
7
|
mime-types (>= 1.16, < 3)
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
codeclimate-test-reporter (1.0.8)
|
17
17
|
simplecov (<= 0.13)
|
18
18
|
coderay (1.1.2)
|
19
|
-
concurrent-ruby (1.
|
19
|
+
concurrent-ruby (1.1.4)
|
20
20
|
date_time_precision (0.8.1)
|
21
21
|
diff-lcs (1.3)
|
22
22
|
docile (1.1.5)
|
@@ -39,7 +39,7 @@ GEM
|
|
39
39
|
guard-test (2.0.8)
|
40
40
|
guard-compat (~> 1.2)
|
41
41
|
test-unit (~> 3.0)
|
42
|
-
i18n (1.
|
42
|
+
i18n (1.5.3)
|
43
43
|
concurrent-ruby (~> 1.0)
|
44
44
|
json (2.1.0)
|
45
45
|
listen (3.1.5)
|
@@ -125,7 +125,7 @@ DEPENDENCIES
|
|
125
125
|
test-unit
|
126
126
|
|
127
127
|
RUBY VERSION
|
128
|
-
ruby 2.
|
128
|
+
ruby 2.5.1p57
|
129
129
|
|
130
130
|
BUNDLED WITH
|
131
|
-
1.16.
|
131
|
+
1.16.2
|
@@ -16,6 +16,16 @@ module FHIR
|
|
16
16
|
# Profile Validation
|
17
17
|
# -------------------------------------------------------------------------
|
18
18
|
|
19
|
+
class << self; attr_accessor :vs_validators end
|
20
|
+
@vs_validators = {}
|
21
|
+
def self.validates_vs(valueset_uri, &validator_fn)
|
22
|
+
@vs_validators[valueset_uri] = validator_fn
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.clear_validates_vs(valueset_uri)
|
26
|
+
@vs_validators.delete valueset_uri
|
27
|
+
end
|
28
|
+
|
19
29
|
def validates_resource?(resource)
|
20
30
|
validate_resource(resource).empty?
|
21
31
|
end
|
@@ -28,6 +38,7 @@ module FHIR
|
|
28
38
|
else
|
29
39
|
@errors << "#{resource.class} is not a resource."
|
30
40
|
end
|
41
|
+
# TODO: return warnings too!
|
31
42
|
@errors
|
32
43
|
end
|
33
44
|
|
@@ -153,6 +164,7 @@ module FHIR
|
|
153
164
|
# Check the datatype for each node, only if the element has one declared, and it isn't the root element
|
154
165
|
if !element.type.empty? && element.path != id
|
155
166
|
codeable_concept_pattern = element.pattern && element.pattern.is_a?(FHIR::DSTU2::CodeableConcept)
|
167
|
+
codeable_concept_binding = element.binding
|
156
168
|
matching_pattern = false
|
157
169
|
nodes.each do |value|
|
158
170
|
matching_type = 0
|
@@ -189,6 +201,28 @@ module FHIR
|
|
189
201
|
matching_pattern = true if vcoding.system == pcoding.system && vcoding.code == pcoding.code
|
190
202
|
end
|
191
203
|
end
|
204
|
+
elsif data_type_found == 'CodeableConcept' && codeable_concept_binding
|
205
|
+
binding_issues =
|
206
|
+
if element.binding.strength == 'extensible'
|
207
|
+
# TODO: make this @warnings, once we have a way to return warnings
|
208
|
+
@errors
|
209
|
+
elsif element.binding.strength == 'required'
|
210
|
+
@errors
|
211
|
+
else # e.g., example-strength or unspecified
|
212
|
+
[] # Drop issues errors on the floor, in throwaway array
|
213
|
+
end
|
214
|
+
|
215
|
+
valueset_uri = element.binding && element.binding.valueSetReference && element.binding.valueSetReference.reference
|
216
|
+
if valueset_uri && self.class.vs_validators[valueset_uri]
|
217
|
+
check_fn = self.class.vs_validators[valueset_uri]
|
218
|
+
vcc = FHIR::DSTU2::CodeableConcept.new(value)
|
219
|
+
|
220
|
+
has_valid_code = vcc.coding && vcc.coding.any? { |c| check_fn.call(c) }
|
221
|
+
|
222
|
+
unless has_valid_code
|
223
|
+
binding_issues << "#{describe_element(element)} has no codings from #{valueset_uri}. Codings evaluated: #{vcc.to_json}"
|
224
|
+
end
|
225
|
+
end
|
192
226
|
elsif data_type_found == 'String' && !element.maxLength.nil? && (value.size > element.maxLength)
|
193
227
|
@errors << "#{describe_element(element)} exceed maximum length of #{element.maxLength}: #{value}"
|
194
228
|
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.
|
4
|
+
version: 1.0.5
|
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:
|
14
|
+
date: 2019-02-06 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: nokogiri
|
@@ -2143,7 +2143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
2143
2143
|
version: '0'
|
2144
2144
|
requirements: []
|
2145
2145
|
rubyforge_project:
|
2146
|
-
rubygems_version: 2.
|
2146
|
+
rubygems_version: 2.7.7
|
2147
2147
|
signing_key:
|
2148
2148
|
specification_version: 4
|
2149
2149
|
summary: A Gem for handling FHIR DSTU2 models in ruby
|