From f363efcd7f592d7b268137b1807d2ad15fda4dea Mon Sep 17 00:00:00 2001 From: Jaehoon Lee Date: Tue, 19 Nov 2024 08:30:55 -0500 Subject: [PATCH] Removed internal valiadator method --- .../dsl/fhir_evaluator/evaluator_util.rb | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/lib/inferno/dsl/fhir_evaluator/evaluator_util.rb b/lib/inferno/dsl/fhir_evaluator/evaluator_util.rb index f661a2c3a..73257f247 100644 --- a/lib/inferno/dsl/fhir_evaluator/evaluator_util.rb +++ b/lib/inferno/dsl/fhir_evaluator/evaluator_util.rb @@ -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] = [] }