inferno_core 0.6.6 → 0.6.7
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48f096486362742aa31ed9f7edec9df07786be3ac7e4f5dfdf121c65b61da1e5
|
4
|
+
data.tar.gz: d6edfd6063f0ba5b83708b86ee5ccc9e0302a32e9a1f96473bbabeabc2d18184
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e065c783d7def8ca873e964f61b9ab4cfcf01a352c99e63157d11eb5ca909f617ee031d5421e26b244caa4f36831ae6574160ac59e2d99647aa2d6d99a152fa0
|
7
|
+
data.tar.gz: 68c8b17c1c635fc4e2986d1e56b06225aa858cf0c049447957c33982f16d0587a0f0407f24c4164ca8b9c08fdbbe6adae693f7a6b1abf0fd9ca258efc50c7db1
|
@@ -1,6 +1,7 @@
|
|
1
|
-
require_relative '
|
2
|
-
require_relative '
|
3
|
-
require_relative '
|
1
|
+
require_relative '../../dsl/fhir_evaluation/evaluator'
|
2
|
+
require_relative '../../dsl/fhir_evaluation/config'
|
3
|
+
require_relative '../../entities'
|
4
|
+
require_relative '../../repositories'
|
4
5
|
require_relative '../../utils/ig_downloader'
|
5
6
|
|
6
7
|
require 'tempfile'
|
@@ -21,7 +22,9 @@ module Inferno
|
|
21
22
|
ig.examples
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
+
validator = setup_validator(ig_path)
|
26
|
+
|
27
|
+
evaluator = Inferno::DSL::FHIREvaluation::Evaluator.new(ig, validator)
|
25
28
|
|
26
29
|
config = Inferno::DSL::FHIREvaluation::Config.new
|
27
30
|
results = evaluator.evaluate(data, config)
|
@@ -44,6 +47,24 @@ module Inferno
|
|
44
47
|
puts '**WARNING** The selected IG targets a FHIR version higher than 4.0.1, which is not supported by Inferno.'
|
45
48
|
end
|
46
49
|
|
50
|
+
def setup_validator(ig_path)
|
51
|
+
igs_directory = File.join(Dir.pwd, 'data', 'igs')
|
52
|
+
if File.exist?(ig_path) && !File.realpath(ig_path).start_with?(igs_directory)
|
53
|
+
puts "Copying #{File.basename(ig_path)} to data/igs so it is accessible to validator"
|
54
|
+
destination_file_path = File.join(igs_directory, File.basename(ig_path))
|
55
|
+
FileUtils.copy_file(ig_path, destination_file_path, true)
|
56
|
+
ig_path = "igs/#{File.basename(ig_path)}"
|
57
|
+
end
|
58
|
+
Inferno::DSL::FHIRResourceValidation::Validator.new(:default, 'evaluator_cli') do
|
59
|
+
igs(ig_path)
|
60
|
+
|
61
|
+
cli_context do
|
62
|
+
# For our purposes, code display mismatches should be warnings and not affect profile conformance
|
63
|
+
displayWarnings(true)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
47
68
|
def output_results(results, output)
|
48
69
|
if output&.end_with?('json')
|
49
70
|
oo = FhirEvaluator::EvaluationResult.to_operation_outcome(results)
|
@@ -132,7 +132,7 @@ module Inferno
|
|
132
132
|
# @!attribute [rw] name
|
133
133
|
|
134
134
|
# @private
|
135
|
-
def initialize(raw_attributes_hash)
|
135
|
+
def initialize(raw_attributes_hash) # rubocop:disable Metrics/CyclomaticComplexity
|
136
136
|
attributes_hash = raw_attributes_hash.symbolize_keys
|
137
137
|
|
138
138
|
invalid_keys = attributes_hash.keys - ATTRIBUTES
|
@@ -143,6 +143,8 @@ module Inferno
|
|
143
143
|
value = DateTime.parse(value) if name == :issue_time && value.is_a?(String)
|
144
144
|
|
145
145
|
instance_variable_set(:"@#{name}", value)
|
146
|
+
rescue Date::Error
|
147
|
+
Inferno::Application['logger'].error("Received invalid date: #{value.inspect}")
|
146
148
|
end
|
147
149
|
|
148
150
|
self.issue_time = DateTime.now if access_token.present? && issue_time.blank?
|
@@ -55,10 +55,16 @@ module Inferno
|
|
55
55
|
declared_profiles.include?(profile_url) || declared_profiles.include?(versioned_url)
|
56
56
|
end
|
57
57
|
|
58
|
-
#
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
# Check if the given resource validates against the given profile.
|
59
|
+
# "Validates" means the provided Validator instance returns no fatal or error messages.
|
60
|
+
# @param resource [FHIR::Resource]
|
61
|
+
# @param profile [FHIR::StructureDefinition]
|
62
|
+
# @param validator [Inferno::DSL::FHIRResourceValidation::Validator]
|
63
|
+
def validates_profile?(resource, profile, validator)
|
64
|
+
return false if validator.nil?
|
65
|
+
|
66
|
+
runnable = Inferno::Entities::Test.new
|
67
|
+
validator.resource_is_valid?(resource, profile.url, runnable, add_messages_to_runnable: false)
|
62
68
|
end
|
63
69
|
end
|
64
70
|
end
|