Sha256: 6c088d03962b95165e058dcab908bde2f1e084de38ad13bd1109bd3853322a85

Contents?: true

Size: 992 Bytes

Versions: 6

Compression:

Stored size: 992 Bytes

Contents

module Inferno
  module Jobs
    class InvokeValidatorSession
      include Sidekiq::Worker

      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

6 entries across 6 versions & 1 rubygems

Version Path
inferno_core-0.4.35 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.34 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.33 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.32 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.31 lib/inferno/jobs/invoke_validator_session.rb
inferno_core-0.4.30 lib/inferno/jobs/invoke_validator_session.rb