Sha256: 53aabab86aa7ba19eafe1daf450c994304adcfb56bd10d0744821ea63ab1067b

Contents?: true

Size: 1.01 KB

Versions: 12

Compression:

Stored size: 1.01 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')
        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
      rescue JSON::ParserError
        Inferno::Application['logger']
          .error("InvokeValidatorSession - error unexpected response format from validator: #{response_body}")
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
inferno_core-0.6.1 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.6.0 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.5.4 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.5.3 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.5.2 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.5.1 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.5.0 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.44 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.43 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.42 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.41 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.40 lib/inferno/jobs/invoke_validator_session.rb