Sha256: 0d1d0354275e3bdeaacc02a48f8a71f2737954ea25b914151a8b814926cc6a45

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

module Inferno
  module Jobs
    class InvokeValidatorSession
      include Sidekiq::Worker
      sidekiq_options queue: 'validator_sessions'

      def perform(suite_id, validator_name, validator_index)
        suite = Inferno::Repositories::TestSuites.new.find suite_id
        validator = suite.fhir_validators[validator_name.to_sym][validator_index]
        response_body = validator.validate(FHIR::Patient.new, 'http://hl7.org/fhir/StructureDefinition/Patient')
        if response_body.start_with? '{'
          res = JSON.parse(response_body)
          session_id = res['sessionId']
          session_repo = Inferno::Repositories::ValidatorSessions.new
          session_repo.save(test_suite_id: suite_id, validator_session_id: session_id,
                            validator_name:, suite_options: validator.requirements)
          validator.session_id = session_id
        else
          Inferno::Application['logger'].error("InvokeValidatorSession - error from validator: #{response_body}")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inferno_core-0.4.39 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.38 lib/inferno/jobs/invoke_validator_session.rb