fhir_models 4.2.1 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.gitignore +0 -1
- data/.rubocop.yml +5 -1
- data/.rubocop_todo.yml +49 -116
- data/.ruby-version +1 -0
- data/.simplecov +1 -5
- data/.tool-versions +1 -0
- data/Gemfile.lock +29 -23
- data/Guardfile +1 -1
- data/fhir_models.gemspec +2 -1
- data/lib/fhir_models/bootstrap/definitions.rb +16 -3
- data/lib/fhir_models/bootstrap/field.rb +2 -2
- data/lib/fhir_models/bootstrap/generator.rb +9 -7
- data/lib/fhir_models/bootstrap/hashable.rb +23 -17
- data/lib/fhir_models/bootstrap/json.rb +1 -1
- data/lib/fhir_models/bootstrap/model.rb +43 -32
- data/lib/fhir_models/bootstrap/preprocess.rb +25 -17
- data/lib/fhir_models/bootstrap/xml.rb +9 -7
- data/lib/fhir_models/deprecate.rb +1 -0
- data/lib/fhir_models/fhir.rb +7 -6
- data/lib/fhir_models/fhir_ext/element_definition.rb +4 -1
- data/lib/fhir_models/fhir_ext/structure_definition.rb +24 -20
- data/lib/fhir_models/fhir_ext/structure_definition_compare.rb +12 -2
- data/lib/fhir_models/fhir_ext/structure_definition_finding.rb +2 -2
- data/lib/fhir_models/fhirpath/expression.rb +4 -6
- data/lib/fhir_models/fhirpath/parse.rb +10 -7
- data/lib/fhir_models/version.rb +1 -1
- metadata +11 -9
@@ -56,8 +56,9 @@ module FHIR
|
|
56
56
|
# generate warnings for missing fields (ignoring extensions)
|
57
57
|
left_missing.each do |e|
|
58
58
|
next if e.include? 'extension'
|
59
|
+
|
59
60
|
elem = get_element_by_path(e, right_elements)
|
60
|
-
if !elem.min.nil? && elem.min
|
61
|
+
if !elem.min.nil? && elem.min.positive?
|
61
62
|
@errors << @finding.error(e, 'min', 'Missing REQUIRED element', 'Missing', elem.min.to_s)
|
62
63
|
elsif elem.isModifier == true
|
63
64
|
@errors << @finding.error(e, 'isModifier', 'Missing MODIFIER element', 'Missing', elem.isModifier.to_s)
|
@@ -67,8 +68,9 @@ module FHIR
|
|
67
68
|
end
|
68
69
|
right_missing.each do |e|
|
69
70
|
next if e.include? 'extension'
|
71
|
+
|
70
72
|
elem = get_element_by_path(e, left_elements)
|
71
|
-
if !elem.min.nil? && elem.min
|
73
|
+
if !elem.min.nil? && elem.min.positive?
|
72
74
|
@errors << @finding.error(e, 'min', 'Missing REQUIRED element', elem.min.to_s, 'Missing')
|
73
75
|
elsif elem.isModifier == true
|
74
76
|
@errors << @finding.error(e, 'isModifier', 'Missing MODIFIER element', elem.isModifier.to_s, 'Missing')
|
@@ -113,6 +115,7 @@ module FHIR
|
|
113
115
|
end
|
114
116
|
y = get_extension(x.type[0].profile, right_extensions)
|
115
117
|
next unless !y.nil? && x.name != y.name
|
118
|
+
|
116
119
|
# both profiles share the same extension definition but with a different name
|
117
120
|
checked_extensions << x.name
|
118
121
|
checked_extensions << y.name
|
@@ -120,6 +123,7 @@ module FHIR
|
|
120
123
|
end
|
121
124
|
right_extensions.each do |y|
|
122
125
|
next if checked_extensions.include?(y.name)
|
126
|
+
|
123
127
|
x = get_extension(y.name, left_extensions)
|
124
128
|
unless x.nil?
|
125
129
|
# both profiles share an extension with the same name
|
@@ -128,6 +132,7 @@ module FHIR
|
|
128
132
|
end
|
129
133
|
x = get_extension(y.type[0].profile, left_extensions)
|
130
134
|
next unless !x.nil? && x.name != y.name && !checked_extensions.include?(x.name)
|
135
|
+
|
131
136
|
# both profiles share the same extension definition but with a different name
|
132
137
|
checked_extensions << x.name
|
133
138
|
checked_extensions << y.name
|
@@ -179,13 +184,16 @@ module FHIR
|
|
179
184
|
x = path.split('.')
|
180
185
|
root = x.first(x.size - 1).join('.')
|
181
186
|
next unless root.include? '.'
|
187
|
+
|
182
188
|
# get the root element to fill in the details
|
183
189
|
elem = get_element_by_path(root, elements)
|
184
190
|
# get the data type definition to fill in the details
|
185
191
|
# assume missing elements are from first data type (gross)
|
186
192
|
next if elem.type.nil? || elem.type.empty?
|
193
|
+
|
187
194
|
type_def = FHIR::Definitions.type_definition(elem.type[0].code)
|
188
195
|
next if type_def.nil?
|
196
|
+
|
189
197
|
type_elements = Array.new(type_def.snapshot.element)
|
190
198
|
# _DEEP_ copy
|
191
199
|
type_elements.map! do |e| # {|e| FHIR::ElementDefinition.from_fhir_json(e.to_fhir_json) }
|
@@ -199,6 +207,7 @@ module FHIR
|
|
199
207
|
type_elements.each do |z|
|
200
208
|
y = get_element_by_path(z.path, elements)
|
201
209
|
next unless y.nil?
|
210
|
+
|
202
211
|
elements << z
|
203
212
|
# else
|
204
213
|
# @warnings << "StructureDefinition #{name} already contains #{z.path}"
|
@@ -367,6 +376,7 @@ module FHIR
|
|
367
376
|
|
368
377
|
# isModifier
|
369
378
|
return unless x.isModifier != y.isModifier
|
379
|
+
|
370
380
|
@errors << @finding.error(x.path.to_s, 'isModifier', 'Incompatible isModifier', (x.isModifier || false).to_s, (y.isModifier || false).to_s)
|
371
381
|
end
|
372
382
|
|
@@ -15,7 +15,7 @@ module FHIR
|
|
15
15
|
"#{resourceType},#{profileIdA},#{profileIdB},#{path},#{attribute},#{status},#{message},#{valueA},#{valueB}"
|
16
16
|
end
|
17
17
|
|
18
|
-
def to_json
|
18
|
+
def to_json(*_args)
|
19
19
|
JSON.pretty_unparse(as_json)
|
20
20
|
end
|
21
21
|
|
@@ -30,7 +30,7 @@ module FHIR
|
|
30
30
|
hash.each do |key, value|
|
31
31
|
obj.send("#{key}=".to_sym, value) if value
|
32
32
|
end
|
33
|
-
rescue => e
|
33
|
+
rescue StandardError => e
|
34
34
|
FHIR.logger.error "Failed to parse JSON: #{e.message}"
|
35
35
|
return nil
|
36
36
|
end
|
@@ -16,12 +16,10 @@ module FHIRPath
|
|
16
16
|
|
17
17
|
def clone
|
18
18
|
clone_tree = @tree.map do |x|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
x
|
24
|
-
end
|
19
|
+
x.clone
|
20
|
+
rescue StandardError
|
21
|
+
# TODO: This appears to be dead code
|
22
|
+
x
|
25
23
|
end
|
26
24
|
FHIRPath::Expression.new(clone_tree)
|
27
25
|
end
|
@@ -7,7 +7,7 @@ module FHIRPath
|
|
7
7
|
|
8
8
|
# This method tokenizes the expression into a flat array of tokens
|
9
9
|
def self.tokenize(expression)
|
10
|
-
raw_tokens = expression.gsub('()', '').split(%r{(\(|\)|\s
|
10
|
+
raw_tokens = expression.gsub('()', '').split(%r{(\(|\)|\s|>=|<=|>|<|=|!=|\+|-|/|\*)})
|
11
11
|
# recreate strings if they were split
|
12
12
|
size = nil
|
13
13
|
while raw_tokens.include?("'") && size != raw_tokens.length
|
@@ -44,13 +44,15 @@ module FHIRPath
|
|
44
44
|
def self.reassemble_strings(tokens)
|
45
45
|
tokens.each_with_index do |token, index|
|
46
46
|
next unless token.is_a?(String)
|
47
|
+
|
47
48
|
e_index = nil
|
48
49
|
if token.start_with?('"') && !token.end_with?('"')
|
49
|
-
e_index = tokens[index
|
50
|
+
e_index = tokens[index..].index { |t| t.end_with?('"') }
|
50
51
|
elsif token.start_with?("'") && !token.end_with?("'")
|
51
|
-
e_index = tokens[index
|
52
|
+
e_index = tokens[index..].index { |t| t.end_with?("'") }
|
52
53
|
end
|
53
54
|
next unless e_index
|
55
|
+
|
54
56
|
i = index + 1
|
55
57
|
while i <= index + e_index
|
56
58
|
tokens[index] += tokens[i]
|
@@ -63,14 +65,15 @@ module FHIRPath
|
|
63
65
|
# This method builds an Abstract Syntax Tree (AST) from a flat list of tokens
|
64
66
|
def self.build_tree(tokens)
|
65
67
|
return if tokens.empty?
|
68
|
+
|
66
69
|
tree = []
|
67
70
|
until tokens.empty?
|
68
71
|
token = tokens.delete_at(0)
|
69
|
-
if '('
|
72
|
+
if token == '(' # sub expression
|
70
73
|
tree << FHIRPath::Expression.new(build_tree(tokens))
|
71
|
-
elsif ')'
|
74
|
+
elsif token == ')'
|
72
75
|
return tree
|
73
|
-
elsif '.'
|
76
|
+
elsif token != '.'
|
74
77
|
tree << atom(token)
|
75
78
|
end
|
76
79
|
end
|
@@ -91,7 +94,7 @@ module FHIRPath
|
|
91
94
|
value = token
|
92
95
|
begin
|
93
96
|
value = Float(token)
|
94
|
-
rescue
|
97
|
+
rescue StandardError
|
95
98
|
value = token
|
96
99
|
value = token.to_sym if @@reserved.include?(token)
|
97
100
|
value = true if token == 'true'
|
data/lib/fhir_models/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fhir_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Walonoski
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
- Michael O'Keefe
|
10
10
|
- Robert Scanlon
|
11
11
|
- Reece Adamson
|
12
|
-
autorequire:
|
12
|
+
autorequire:
|
13
13
|
bindir: exe
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2024-05-30 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: nokogiri
|
@@ -188,14 +188,14 @@ dependencies:
|
|
188
188
|
requirements:
|
189
189
|
- - '='
|
190
190
|
- !ruby/object:Gem::Version
|
191
|
-
version:
|
191
|
+
version: 1.23.0
|
192
192
|
type: :development
|
193
193
|
prerelease: false
|
194
194
|
version_requirements: !ruby/object:Gem::Requirement
|
195
195
|
requirements:
|
196
196
|
- - '='
|
197
197
|
- !ruby/object:Gem::Version
|
198
|
-
version:
|
198
|
+
version: 1.23.0
|
199
199
|
- !ruby/object:Gem::Dependency
|
200
200
|
name: guard-rspec
|
201
201
|
requirement: !ruby/object:Gem::Requirement
|
@@ -238,7 +238,9 @@ files:
|
|
238
238
|
- ".rspec"
|
239
239
|
- ".rubocop.yml"
|
240
240
|
- ".rubocop_todo.yml"
|
241
|
+
- ".ruby-version"
|
241
242
|
- ".simplecov"
|
243
|
+
- ".tool-versions"
|
242
244
|
- Gemfile
|
243
245
|
- Gemfile.lock
|
244
246
|
- Guardfile
|
@@ -3959,7 +3961,7 @@ homepage: https://github.com/fhir-crucible/fhir_models
|
|
3959
3961
|
licenses:
|
3960
3962
|
- Apache-2.0
|
3961
3963
|
metadata: {}
|
3962
|
-
post_install_message:
|
3964
|
+
post_install_message:
|
3963
3965
|
rdoc_options: []
|
3964
3966
|
require_paths:
|
3965
3967
|
- lib
|
@@ -3967,15 +3969,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
3967
3969
|
requirements:
|
3968
3970
|
- - ">="
|
3969
3971
|
- !ruby/object:Gem::Version
|
3970
|
-
version:
|
3972
|
+
version: 3.0.0
|
3971
3973
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
3972
3974
|
requirements:
|
3973
3975
|
- - ">="
|
3974
3976
|
- !ruby/object:Gem::Version
|
3975
3977
|
version: '0'
|
3976
3978
|
requirements: []
|
3977
|
-
rubygems_version: 3.
|
3978
|
-
signing_key:
|
3979
|
+
rubygems_version: 3.5.9
|
3980
|
+
signing_key:
|
3979
3981
|
specification_version: 4
|
3980
3982
|
summary: A Gem for handling FHIR models in ruby
|
3981
3983
|
test_files: []
|