Sha256: 21fdfb58c33e55474c4ddd37347845f2eb3abab20dcc0cc963312df8ac7bce9b

Contents?: true

Size: 884 Bytes

Versions: 4

Compression:

Stored size: 884 Bytes

Contents

# frozen_string_literal: true

require_relative 'config'
require_relative 'rule'
require_relative 'evaluation_context'
require_relative 'evaluation_result'
require_relative 'dataset_loader'

module Inferno
  module DSL
    module FHIREvaluation
      class Evaluator
        attr_accessor :ig

        def initialize(ig) # rubocop:disable Naming/MethodParameterName
          @ig = ig
        end

        def evaluate(data, config = Config.new)
          context = EvaluationContext.new(@ig, data, config)

          active_rules = []
          config.data['Rule'].each do |rulename, rule_details|
            active_rules << rulename if rule_details['Enabled']
          end

          Rule.descendants.each do |rule|
            rule.new.check(context) if active_rules.include?(rule.name.demodulize)
          end

          context.results
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inferno_core-0.6.1 lib/inferno/dsl/fhir_evaluation/evaluator.rb
inferno_core-0.6.0 lib/inferno/dsl/fhir_evaluation/evaluator.rb
inferno_core-0.5.4 lib/inferno/dsl/fhir_evaluation/evaluator.rb
inferno_core-0.5.3 lib/inferno/dsl/fhir_evaluation/evaluator.rb