Class: Inferno::DSL::FHIREvaluation::EvaluationResult
- Inherits:
-
Object
- Object
- Inferno::DSL::FHIREvaluation::EvaluationResult
- Defined in:
- lib/inferno/dsl/fhir_evaluation/evaluation_result.rb
Overview
The result of a Rule evaluating a data set.
Instance Attribute Summary collapse
-
#issue_type ⇒ Object
Returns the value of attribute issue_type.
-
#message ⇒ Object
Returns the value of attribute message.
-
#rule ⇒ Object
Returns the value of attribute rule.
-
#severity ⇒ Object
Returns the value of attribute severity.
-
#threshold ⇒ Object
Returns the value of attribute threshold.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, severity: 'warning', issue_type: 'business-rule', threshold: nil, value: nil, rule: nil) ⇒ EvaluationResult
constructor
A new instance of EvaluationResult.
-
#to_oo_issue ⇒ Object
-
#to_s ⇒ Object
Constructor Details
#initialize(message, severity: 'warning', issue_type: 'business-rule', threshold: nil, value: nil, rule: nil) ⇒ EvaluationResult
Returns a new instance of EvaluationResult.
13 14 15 16 17 18 19 20 |
# File 'lib/inferno/dsl/fhir_evaluation/evaluation_result.rb', line 13 def initialize(, severity: 'warning', issue_type: 'business-rule', threshold: nil, value: nil, rule: nil) @message = @severity = severity @issue_type = issue_type @threshold = threshold @value = value @rule = rule end |
Instance Attribute Details
#issue_type ⇒ Object
Returns the value of attribute issue_type.
6 7 8 |
# File 'lib/inferno/dsl/fhir_evaluation/evaluation_result.rb', line 6 def issue_type @issue_type end |
#message ⇒ Object
Returns the value of attribute message.
6 7 8 |
# File 'lib/inferno/dsl/fhir_evaluation/evaluation_result.rb', line 6 def @message end |
#rule ⇒ Object
Returns the value of attribute rule.
6 7 8 |
# File 'lib/inferno/dsl/fhir_evaluation/evaluation_result.rb', line 6 def rule @rule end |
#severity ⇒ Object
Returns the value of attribute severity.
6 7 8 |
# File 'lib/inferno/dsl/fhir_evaluation/evaluation_result.rb', line 6 def severity @severity end |
#threshold ⇒ Object
Returns the value of attribute threshold.
6 7 8 |
# File 'lib/inferno/dsl/fhir_evaluation/evaluation_result.rb', line 6 def threshold @threshold end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/inferno/dsl/fhir_evaluation/evaluation_result.rb', line 6 def value @value end |
Class Method Details
.to_operation_outcome(results) ⇒ Object
54 55 56 57 58 |
# File 'lib/inferno/dsl/fhir_evaluation/evaluation_result.rb', line 54 def self.to_operation_outcome(results) FHIR::OperationOutcome.new({ issue: results.map(&:to_oo_issue) }) end |
Instance Method Details
#to_oo_issue ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/inferno/dsl/fhir_evaluation/evaluation_result.rb', line 26 def to_oo_issue issue = { severity:, code: issue_type, details: { text: } } if threshold issue[:extension] ||= [] issue[:extension].push({ # TODO: pick real extension for this url: 'https://inferno-framework.github.io/fhir_evaluator/StructureDefinition/operationoutcome-issue-threshold', valueDecimal: threshold }) end if value issue[:extension] ||= [] issue[:extension].push({ # TODO: pick real extension for this url: 'https://inferno-framework.github.io/fhir_evaluator/StructureDefinition/operationoutcome-issue-value', valueDecimal: value }) end issue end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/inferno/dsl/fhir_evaluation/evaluation_result.rb', line 22 def to_s "#{severity.upcase}: #{}" end |