Skip to content

Commit

Permalink
Removed internal valiadator method
Browse files Browse the repository at this point in the history
  • Loading branch information
jhlee-mitre committed Nov 19, 2024
1 parent 57b6e0c commit f363efc
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions lib/inferno/dsl/fhir_evaluator/evaluator_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,6 @@ def self.extract_ids_references(resources)
extractor.extract_ids_references(resources)
end

def self.validate_resource(resource)
wrapped_resource = {
# IG in cliContext is optional, since HL7 Validator automatically
# finds matching profiles for the resource in the loaded IGs
# If the valiator doesn't find its matching profile, the operation will fail.
cliContext: {
sv: '4.0.1',
# ig: [
# "hl7.fhir.us.core#4.0.0"
# ],
locale: 'en'
},
filesToValidate: [
{
fileName: "#{resource.resourceType}/#{resource.id}.json",
fileContent: resource.to_json,
fileType: 'json'
}
],
# sessionId may reuse Inferno's or be autogenerated by the validator.
sessionId: '32fc25cf-020e-4492-ace5-03fe904d22e0'
}
request_body = wrapped_resource.to_json

response = Faraday.new(
ENV.fetch('FHIR_RESOURCE_VALIDATOR_URL'),
request: { timeout: 600 }
).post('validate', request_body, content_type: 'application/json')

unless response.status == 200
raise StandardError,
"Error occurred in the validator. Http response: #{response.status}"
end

err_flg = false
JSON.parse(response.body)['outcomes'].any? do |outcome|
outcome['issues'].any? do |issue|
err_flg = true if %w[ERROR FATAL].include?(issue['level'])
end
end

err_flg
end

class ReferenceExtractor
def initialize
@resource_type_ids = Hash.new { |h, k| h[k] = [] }
Expand Down

0 comments on commit f363efc

Please sign in to comment.