Class: Inferno::DSL::FHIREvaluation::Evaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/inferno/dsl/fhir_evaluation/evaluator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ig) ⇒ Evaluator

rubocop:disable Naming/MethodParameterName



15
16
17
# File 'lib/inferno/dsl/fhir_evaluation/evaluator.rb', line 15

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

Instance Attribute Details

#igObject

Returns the value of attribute ig.



13
14
15
# File 'lib/inferno/dsl/fhir_evaluation/evaluator.rb', line 13

def ig
  @ig
end

Instance Method Details

#evaluate(data, config = Config.new) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/inferno/dsl/fhir_evaluation/evaluator.rb', line 19

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