inferno_core 0.6.15 → 0.6.16

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: be97c34b62bf28dc41266ecc22d01ccb2b8548a75150507ea72fff5aa76f6b17
4
- data.tar.gz: 2f4121330b353d2f425e1be20f3895a1f256b8f20a825cc5c26adc9aa85f0898
3
+ metadata.gz: bdded0041b27a81a8cedae003b073e738a719eda6671cb39b1556bd165a986c9
4
+ data.tar.gz: f9cb54ff76488ce34f8f9c9464bbc3588f67f3931d6eef284a78d1af32a0b78e
5
5
  SHA512:
6
- metadata.gz: eded37149214782930c42e8e672e768eaf0e07411fba2ad9e8f96fad282ff0ff31aee18cab668592ea355a6ddafdfd1c4128d1c04de639e24aa3968a79026ac7
7
- data.tar.gz: 4322a86fc7f289cfc3cc92e70d0926c7dd79a3ce6941f8479c6096ffdcd3718a7f59e17479031d50e2a0a24cbc0e6bd632e8c31ec9cf00fdad317351176524f4
6
+ metadata.gz: e53518c76be16a5cc631a503c84388b706d2030a30469048379f3b4d91d1525d5e1ee373cb454c191b97eb857c9682d821270c9c2a35cfe408b5fd7fa405a236
7
+ data.tar.gz: a078da89879d42f3cda28ebc8dca66feca2a85e9f735868bbcd4dbf70774ef268e613fd4aad4fe076002af1d3d7035bd02de8c2679d2ce17b8ee05a794f629ab
@@ -112,7 +112,7 @@ module Inferno
112
112
  Inferno::DSL::FHIRResourceValidation::Validator.new(:default, 'evaluator_cli') do
113
113
  igs(ig_path)
114
114
 
115
- cli_context do
115
+ validation_context do
116
116
  # For our purposes, code display mismatches should be warnings and not affect profile conformance
117
117
  displayWarnings(true)
118
118
  end
@@ -15,8 +15,6 @@ module Inferno
15
15
 
16
16
  require_relative '../../../inferno'
17
17
 
18
- Inferno::Application.start(:requirements)
19
-
20
18
  RequirementsExporter.new.run
21
19
  end
22
20
 
@@ -128,36 +128,36 @@ module Inferno
128
128
  @old_requirements_csv ||= File.read(requirements_output_file_path)
129
129
  end
130
130
 
131
- def missing_sub_requirements
132
- @missing_sub_requirements =
131
+ def missing_subrequirements
132
+ @missing_subrequirements =
133
133
  {}.tap do |missing_requirements|
134
134
  repo = Inferno::Repositories::Requirements.new
135
135
 
136
136
  input_requirement_sets
137
137
  .each do |requirement_set, requirements|
138
138
  requirements.each do |requirement_hash|
139
- missing_sub_requirements =
139
+ missing_subrequirements =
140
140
  Inferno::Entities::Requirement.expand_requirement_ids(requirement_hash['Sub-Requirement(s)'])
141
141
  .reject { |requirement_id| repo.exists? requirement_id }
142
142
 
143
- missing_sub_requirements += missing_actor_sub_requirements(requirement_hash['Sub-Requirement(s)'])
143
+ missing_subrequirements += missing_actor_subrequirements(requirement_hash['Sub-Requirement(s)'])
144
144
 
145
- next if missing_sub_requirements.blank?
145
+ next if missing_subrequirements.blank?
146
146
 
147
147
  id = "#{requirement_set}@#{requirement_hash['ID*']}"
148
148
 
149
- missing_requirements[id] = missing_sub_requirements
149
+ missing_requirements[id] = missing_subrequirements
150
150
  end
151
151
  end
152
152
  end
153
153
  end
154
154
 
155
- def missing_actor_sub_requirements(sub_requirement_string)
156
- return [] if sub_requirement_string.blank?
155
+ def missing_actor_subrequirements(subrequirement_string)
156
+ return [] if subrequirement_string.blank?
157
157
 
158
- return [] unless sub_requirement_string.include? '#'
158
+ return [] unless subrequirement_string.include? '#'
159
159
 
160
- sub_requirement_string
160
+ subrequirement_string
161
161
  .split(',')
162
162
  .map(&:strip)
163
163
  .select { |requirement_string| requirement_string.include? '#' }
@@ -166,11 +166,11 @@ module Inferno
166
166
  end
167
167
  end
168
168
 
169
- def check_sub_requirements
170
- return if missing_sub_requirements.blank?
169
+ def check_subrequirements
170
+ return if missing_subrequirements.blank?
171
171
 
172
- missing_sub_requirements.each do |id, sub_requirement_ids|
173
- puts "#{id} is missing the following sub-requirements:\n #{sub_requirement_ids.join(', ')}"
172
+ missing_subrequirements.each do |id, subrequirement_ids|
173
+ puts "#{id} is missing the following sub-requirements:\n #{subrequirement_ids.join(', ')}"
174
174
  end
175
175
  end
176
176
 
@@ -196,7 +196,9 @@ module Inferno
196
196
  File.write(requirements_output_file_path, new_requirements_csv, encoding: Encoding::UTF_8)
197
197
  end
198
198
 
199
- check_sub_requirements
199
+ Inferno::Application.start(:requirements)
200
+
201
+ check_subrequirements
200
202
 
201
203
  puts 'Done.'
202
204
  end
@@ -228,9 +230,9 @@ module Inferno
228
230
  exit(1)
229
231
  end
230
232
 
231
- check_sub_requirements
233
+ check_subrequirements
232
234
 
233
- return if missing_sub_requirements.blank?
235
+ return if missing_subrequirements.blank?
234
236
 
235
237
  exit(1)
236
238
  end
@@ -9,7 +9,7 @@ module Inferno
9
9
  field :requirement
10
10
  field :conformance
11
11
  field :actors
12
- field :sub_requirements
12
+ field :subrequirements
13
13
  field :conditionality
14
14
  field :url, if: :field_present?
15
15
  field :not_tested_reason, if: :field_present?
@@ -147,7 +147,7 @@ module Inferno
147
147
  end
148
148
 
149
149
  def matching_pattern_identifier_slice?(slice, discriminator)
150
- slice.identifier.system == discriminator[:system]
150
+ slice.system == discriminator[:system]
151
151
  end
152
152
 
153
153
  def matching_value_slice?(slice, discriminator)
@@ -1,4 +1,5 @@
1
1
  require_relative '../ext/fhir_models'
2
+ require_relative '../feature'
2
3
  module Inferno
3
4
  module DSL
4
5
  # This module contains the methods needed to configure a validator to
@@ -19,7 +20,7 @@ module Inferno
19
20
  # { type: 'info', message: 'everything is ok' }
20
21
  # end
21
22
  # end
22
- # cli_context do
23
+ # validation_context do
23
24
  # noExtensibleBindingMessages true
24
25
  # allowExampleUrls true
25
26
  # txServer nil
@@ -74,12 +75,12 @@ module Inferno
74
75
  # igs("hl7.fhir.us.core#3.1.1", "hl7.fhir.us.core#6.0.0")
75
76
  # @param validator_igs [Array<String>]
76
77
  def igs(*validator_igs)
77
- cli_context(igs: validator_igs) if validator_igs.any?
78
+ validation_context(igs: validator_igs) if validator_igs.any?
78
79
 
79
- cli_context.igs
80
+ validation_context.igs
80
81
  end
81
82
 
82
- # Set the cliContext used as part of each validation request.
83
+ # Set the validationContext used as part of each validation request.
83
84
  # Fields may be passed as either a Hash or block.
84
85
  # Note that all fields included here will be sent directly in requests,
85
86
  # there is no check that the fields are correct.
@@ -88,7 +89,7 @@ module Inferno
88
89
  # # Passing fields in a block
89
90
  # fhir_resource_validator do
90
91
  # url 'http://example.com/validator'
91
- # cli_context do
92
+ # validation_context do
92
93
  # noExtensibleBindingMessages true
93
94
  # allowExampleUrls true
94
95
  # txServer nil
@@ -99,7 +100,7 @@ module Inferno
99
100
  # # Passing fields in a Hash
100
101
  # fhir_resource_validator do
101
102
  # url 'http://example.org/validator'
102
- # cli_context({
103
+ # validation_context({
103
104
  # noExtensibleBindingMessages: true,
104
105
  # allowExampleUrls: true,
105
106
  # txServer: nil
@@ -107,19 +108,21 @@ module Inferno
107
108
  # end
108
109
  #
109
110
  # @param definition [Hash] raw fields to set, optional
110
- def cli_context(definition = nil, &)
111
- if @cli_context
111
+ def validation_context(definition = nil, &)
112
+ if @validation_context
112
113
  if definition
113
- @cli_context.definition.merge!(definition.deep_symbolize_keys)
114
+ @validation_context.definition.merge!(definition.deep_symbolize_keys)
114
115
  elsif block_given?
115
- @cli_context.instance_eval(&)
116
+ @validation_context.instance_eval(&)
116
117
  end
117
118
  else
118
- @cli_context = CliContext.new(definition || {}, &)
119
+ @validation_context = ValidationContext.new(definition || {}, &)
119
120
  end
120
- @cli_context
121
+ @validation_context
121
122
  end
122
123
 
124
+ alias cli_context validation_context
125
+
123
126
  # @private
124
127
  def additional_validations
125
128
  @additional_validations ||= []
@@ -268,9 +271,13 @@ module Inferno
268
271
 
269
272
  @session_id = validator_session_id if validator_session_id
270
273
 
274
+ # HL7 Validator Core 6.5.19+ renamed `cliContext` to `validationContext`.
275
+ # This allows backward compatibility until the validator-wrapper is updated.
276
+ context_key = Feature.use_validation_context_key? ? :validationContext : :cliContext
277
+
271
278
  wrapped_resource = {
272
- cliContext: {
273
- **cli_context.definition,
279
+ context_key => {
280
+ **validation_context.definition,
274
281
  profiles: [profile_url]
275
282
  },
276
283
  filesToValidate: [
@@ -365,10 +372,10 @@ module Inferno
365
372
  end
366
373
 
367
374
  # @private
368
- class CliContext
375
+ class ValidationContext
369
376
  attr_reader :definition
370
377
 
371
- CLICONTEXT_DEFAULTS = {
378
+ VALIDATIONCONTEXT_DEFAULTS = {
372
379
  sv: '4.0.1',
373
380
  doNative: false,
374
381
  extensions: ['any'],
@@ -377,13 +384,13 @@ module Inferno
377
384
 
378
385
  # @private
379
386
  def initialize(definition, &)
380
- @definition = CLICONTEXT_DEFAULTS.merge(definition.deep_symbolize_keys)
387
+ @definition = VALIDATIONCONTEXT_DEFAULTS.merge(definition.deep_symbolize_keys)
381
388
  instance_eval(&) if block_given?
382
389
  end
383
390
 
384
391
  # @private
385
392
  def method_missing(method_name, *args)
386
- # Interpret any other method as setting a field on cliContext.
393
+ # Interpret any other method as setting a field on validationContext.
387
394
  # Follow the same format as `Validator.url` here:
388
395
  # only set the value if one is provided.
389
396
  # args will be an empty array if no value is provided.
@@ -12,7 +12,8 @@ module Inferno
12
12
  :requirement,
13
13
  :conformance,
14
14
  :actors,
15
- :sub_requirements,
15
+ :subrequirements,
16
+ :subrequirements_string,
16
17
  :conditionality,
17
18
  :not_tested_reason,
18
19
  :not_tested_details
@@ -28,6 +29,10 @@ module Inferno
28
29
  self.requirement_set = id.split(/[@#]/).first
29
30
  end
30
31
 
32
+ def subrequirements
33
+ @subrequirements ||= self.class.expand_requirement_ids(subrequirements_string, requirement_set)
34
+ end
35
+
31
36
  # Expand a comma-delimited list of requirement id references into an Array
32
37
  # of full requirement ids
33
38
  #
@@ -62,7 +67,7 @@ module Inferno
62
67
  requirement_ids =
63
68
  if actor.present?
64
69
  return Repositories::Requirements.new.requirements_for_actor(current_set, actor).map(&:id)
65
- elsif requirement_string.include? '-'
70
+ elsif requirement_string.include?('-') && !requirement_string.match?(/[^\d\-]/)
66
71
  start_id, end_id = requirement_string.split('-')
67
72
  if start_id.match?(/^\d+$/) && end_id.match?(/^\d+$/)
68
73
  (start_id..end_id).to_a
@@ -4,6 +4,10 @@ module Inferno
4
4
  def requirements_enabled?
5
5
  ENV.fetch('ENABLE_REQUIREMENTS', 'false')&.casecmp?('true')
6
6
  end
7
+
8
+ def use_validation_context_key?
9
+ ENV.fetch('USE_VALIDATION_CONTEXT', 'false')&.casecmp?('true')
10
+ end
7
11
  end
8
12
  end
9
13
  end
@@ -14,13 +14,9 @@ module Inferno
14
14
 
15
15
  req_set = row[:req_set]
16
16
  id = row[:id]
17
- sub_requirements_field = row[:subrequirements]
18
17
 
19
18
  combined_id = "#{req_set}@#{id}"
20
19
 
21
- # Processing sub requirements: e.g. "170.315(g)(31)_hti-2-proposal@5,17,23,26,27,32,35,38-41"
22
- sub_requirements = Inferno::Entities::Requirement.expand_requirement_ids(sub_requirements_field)
23
-
24
20
  result << {
25
21
  requirement_set: req_set,
26
22
  id: combined_id,
@@ -28,7 +24,7 @@ module Inferno
28
24
  requirement: row[:requirement],
29
25
  conformance: row[:conformance],
30
26
  actors: row[:actors]&.split(',')&.map(&:strip) || [],
31
- sub_requirements: sub_requirements,
27
+ subrequirements_string: row[:subrequirements],
32
28
  conditionality: row[:conditionality]&.downcase,
33
29
  not_tested_reason: row[:not_tested_reason],
34
30
  not_tested_details: row[:not_tested_details]
@@ -108,7 +104,7 @@ module Inferno
108
104
 
109
105
  referenced_requirement_ids =
110
106
  requirements_to_process
111
- .flat_map(&:sub_requirements)
107
+ .flat_map(&:subrequirements)
112
108
  .select do |requirement_id|
113
109
  referenced_requirement_sets.any? do |set|
114
110
  requirement_id.start_with?("#{set.identifier}@") && find(requirement_id)&.actor?(set.actor)
@@ -1,4 +1,4 @@
1
1
  module Inferno
2
2
  # Standard patterns for gem versions: https://guides.rubygems.org/patterns/
3
- VERSION = '0.6.15'.freeze
3
+ VERSION = '0.6.16'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inferno_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.15
4
+ version: 0.6.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-06-25 00:00:00.000000000 Z
13
+ date: 2025-06-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -68,6 +68,20 @@ dependencies:
68
68
  - - '='
69
69
  - !ruby/object:Gem::Version
70
70
  version: 1.3.4
71
+ - !ruby/object:Gem::Dependency
72
+ name: csv
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: 3.3.5
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: 3.3.5
71
85
  - !ruby/object:Gem::Dependency
72
86
  name: dotenv
73
87
  requirement: !ruby/object:Gem::Requirement
@@ -236,6 +250,20 @@ dependencies:
236
250
  - - '='
237
251
  - !ruby/object:Gem::Version
238
252
  version: 2.0.0
253
+ - !ruby/object:Gem::Dependency
254
+ name: mutex_m
255
+ requirement: !ruby/object:Gem::Requirement
256
+ requirements:
257
+ - - "~>"
258
+ - !ruby/object:Gem::Version
259
+ version: 0.3.0
260
+ type: :runtime
261
+ prerelease: false
262
+ version_requirements: !ruby/object:Gem::Requirement
263
+ requirements:
264
+ - - "~>"
265
+ - !ruby/object:Gem::Version
266
+ version: 0.3.0
239
267
  - !ruby/object:Gem::Dependency
240
268
  name: oj
241
269
  requirement: !ruby/object:Gem::Requirement