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.
@@ -57,6 +57,7 @@ module FHIR
57
57
  # generate warnings for missing fields (ignoring extensions)
58
58
  left_missing.each do |e|
59
59
  next if e.include? 'extension'
60
+
60
61
  elem = get_element_by_path(e, right_elements)
61
62
  if !elem.min.nil? && elem.min.positive?
62
63
  @errors << @finding.error(e, 'min', 'Missing REQUIRED element', 'Missing', elem.min.to_s)
@@ -68,6 +69,7 @@ module FHIR
68
69
  end
69
70
  right_missing.each do |e|
70
71
  next if e.include? 'extension'
72
+
71
73
  elem = get_element_by_path(e, left_elements)
72
74
  if !elem.min.nil? && elem.min.positive?
73
75
  @errors << @finding.error(e, 'min', 'Missing REQUIRED element', elem.min.to_s, 'Missing')
@@ -114,6 +116,7 @@ module FHIR
114
116
  end
115
117
  y = get_extension(x.type[0].profile, right_extensions)
116
118
  next unless !y.nil? && x.name != y.name
119
+
117
120
  # both profiles share the same extension definition but with a different name
118
121
  checked_extensions << x.name
119
122
  checked_extensions << y.name
@@ -121,6 +124,7 @@ module FHIR
121
124
  end
122
125
  right_extensions.each do |y|
123
126
  next if checked_extensions.include?(y.name)
127
+
124
128
  x = get_extension(y.name, left_extensions)
125
129
  unless x.nil?
126
130
  # both profiles share an extension with the same name
@@ -129,6 +133,7 @@ module FHIR
129
133
  end
130
134
  x = get_extension(y.type[0].profile, left_extensions)
131
135
  next unless !x.nil? && x.name != y.name && !checked_extensions.include?(x.name)
136
+
132
137
  # both profiles share the same extension definition but with a different name
133
138
  checked_extensions << x.name
134
139
  checked_extensions << y.name
@@ -180,13 +185,16 @@ module FHIR
180
185
  x = path.split('.')
181
186
  root = x.first(x.size - 1).join('.')
182
187
  next unless root.include? '.'
188
+
183
189
  # get the root element to fill in the details
184
190
  elem = get_element_by_path(root, elements)
185
191
  # get the data type definition to fill in the details
186
192
  # assume missing elements are from first data type (gross)
187
193
  next if elem.type.nil? || elem.type.empty?
194
+
188
195
  type_def = FHIR::STU3::Definitions.type_definition(elem.type[0].code)
189
196
  next if type_def.nil?
197
+
190
198
  type_elements = Array.new(type_def.snapshot.element)
191
199
  # _DEEP_ copy
192
200
  type_elements.map! do |e| # {|e| FHIR::STU3::ElementDefinition.from_fhir_json(e.to_fhir_json) }
@@ -200,6 +208,7 @@ module FHIR
200
208
  type_elements.each do |z|
201
209
  y = get_element_by_path(z.path, elements)
202
210
  next unless y.nil?
211
+
203
212
  elements << z
204
213
  # else
205
214
  # @warnings << "StructureDefinition #{name} already contains #{z.path}"
@@ -368,6 +377,7 @@ module FHIR
368
377
 
369
378
  # isModifier
370
379
  return unless x.isModifier != y.isModifier
380
+
371
381
  @errors << @finding.error(x.path.to_s, 'isModifier', 'Incompatible isModifier', (x.isModifier || false).to_s, (y.isModifier || false).to_s)
372
382
  end
373
383
 
@@ -16,7 +16,7 @@ module FHIR
16
16
  "#{resourceType},#{profileIdA},#{profileIdB},#{path},#{attribute},#{status},#{message},#{valueA},#{valueB}"
17
17
  end
18
18
 
19
- def to_json
19
+ def to_json(*_args)
20
20
  JSON.pretty_unparse(as_json)
21
21
  end
22
22
 
@@ -31,7 +31,7 @@ module FHIR
31
31
  hash.each do |key, value|
32
32
  obj.send("#{key}=".to_sym, value) if value
33
33
  end
34
- rescue => e
34
+ rescue StandardError => e
35
35
  FHIR.logger.error "Failed to parse JSON: #{e.message}"
36
36
  return nil
37
37
  end
@@ -18,7 +18,7 @@ module FluentPath
18
18
  def clone
19
19
  clone_tree = @tree.map do |x|
20
20
  x.clone
21
- rescue
21
+ rescue StandardError
22
22
  # TODO: This appears to be dead code
23
23
  x
24
24
  end
@@ -8,7 +8,7 @@ module FluentPath
8
8
 
9
9
  # This method tokenizes the expression into a flat array of tokens
10
10
  def self.tokenize(expression)
11
- raw_tokens = expression.gsub('()', '').split(%r{(\(|\)|\s|>=|<=|>|<|=|!=|\+|-|\/|\*)})
11
+ raw_tokens = expression.gsub('()', '').split(%r{(\(|\)|\s|>=|<=|>|<|=|!=|\+|-|/|\*)})
12
12
  # recreate strings if they were split
13
13
  size = nil
14
14
  while raw_tokens.include?("'") && size != raw_tokens.length
@@ -45,13 +45,15 @@ module FluentPath
45
45
  def self.reassemble_strings(tokens)
46
46
  tokens.each_with_index do |token, index|
47
47
  next unless token.is_a?(String)
48
+
48
49
  e_index = nil
49
50
  if token.start_with?('"') && !token.end_with?('"')
50
- e_index = tokens[index..-1].index { |t| t.end_with?('"') }
51
+ e_index = tokens[index..].index { |t| t.end_with?('"') }
51
52
  elsif token.start_with?("'") && !token.end_with?("'")
52
- e_index = tokens[index..-1].index { |t| t.end_with?("'") }
53
+ e_index = tokens[index..].index { |t| t.end_with?("'") }
53
54
  end
54
55
  next unless e_index
56
+
55
57
  i = index + 1
56
58
  while i <= index + e_index
57
59
  tokens[index] += tokens[i]
@@ -64,14 +66,15 @@ module FluentPath
64
66
  # This method builds an Abstract Syntax Tree (AST) from a flat list of tokens
65
67
  def self.build_tree(tokens)
66
68
  return if tokens.empty?
69
+
67
70
  tree = []
68
71
  until tokens.empty?
69
72
  token = tokens.delete_at(0)
70
- if '(' == token # sub expression
73
+ if token == '(' # sub expression
71
74
  tree << FluentPath::STU3::Expression.new(build_tree(tokens))
72
- elsif ')' == token
75
+ elsif token == ')'
73
76
  return tree
74
- elsif '.' != token
77
+ elsif token != '.'
75
78
  tree << atom(token)
76
79
  end
77
80
  end
@@ -92,7 +95,7 @@ module FluentPath
92
95
  value = token
93
96
  begin
94
97
  value = Float(token)
95
- rescue
98
+ rescue StandardError
96
99
  value = token
97
100
  value = token.to_sym if @@reserved.include?(token)
98
101
  value = true if token == 'true'
@@ -1,7 +1,7 @@
1
1
  module FHIR
2
2
  module STU3
3
3
  module Models
4
- VERSION = '3.1.1'.freeze
4
+ VERSION = '3.2.0'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fhir_stu3_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Walonoski
8
8
  - Robert Scanlon
9
9
  - Reece Adamson
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-09-23 00:00:00.000000000 Z
13
+ date: 2024-05-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
@@ -172,14 +172,14 @@ dependencies:
172
172
  requirements:
173
173
  - - '='
174
174
  - !ruby/object:Gem::Version
175
- version: '0.80'
175
+ version: 1.23.0
176
176
  type: :development
177
177
  prerelease: false
178
178
  version_requirements: !ruby/object:Gem::Requirement
179
179
  requirements:
180
180
  - - '='
181
181
  - !ruby/object:Gem::Version
182
- version: '0.80'
182
+ version: 1.23.0
183
183
  - !ruby/object:Gem::Dependency
184
184
  name: guard-rspec
185
185
  requirement: !ruby/object:Gem::Requirement
@@ -221,7 +221,9 @@ files:
221
221
  - ".rspec"
222
222
  - ".rubocop.yml"
223
223
  - ".rubocop_todo.yml"
224
+ - ".ruby-version"
224
225
  - ".simplecov"
226
+ - ".tool-versions"
225
227
  - Gemfile
226
228
  - Gemfile.lock
227
229
  - Guardfile
@@ -1600,7 +1602,7 @@ homepage: https://github.com/fhir-crucible/fhir_stu3_models
1600
1602
  licenses:
1601
1603
  - Apache-2.0
1602
1604
  metadata: {}
1603
- post_install_message:
1605
+ post_install_message:
1604
1606
  rdoc_options: []
1605
1607
  require_paths:
1606
1608
  - lib
@@ -1608,15 +1610,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
1608
1610
  requirements:
1609
1611
  - - ">="
1610
1612
  - !ruby/object:Gem::Version
1611
- version: '0'
1613
+ version: 3.0.0
1612
1614
  required_rubygems_version: !ruby/object:Gem::Requirement
1613
1615
  requirements:
1614
1616
  - - ">="
1615
1617
  - !ruby/object:Gem::Version
1616
1618
  version: '0'
1617
1619
  requirements: []
1618
- rubygems_version: 3.1.6
1619
- signing_key:
1620
+ rubygems_version: 3.5.9
1621
+ signing_key:
1620
1622
  specification_version: 4
1621
1623
  summary: A Gem for handling FHIR STU3 models in ruby
1622
1624
  test_files: []