Class: SimpleXml::PopulationCriteria
- Inherits:
-
Object
- Object
- SimpleXml::PopulationCriteria
- Includes:
- Utilities
- Defined in:
- lib/model/population_criteria.rb
Overview
Represents an HQMF population criteria, also supports all the same methods as SimpleXml::Precondition
Constant Summary collapse
- IPP =
'initialPatientPopulation'
- DENOM =
'denominator'
- DENEX =
'denominatorExclusions'
- DENEXCEP =
'denominatorExceptions'
- NUMER =
'numerator'
- MSRPOPL =
'measurePopulation'
- OBSERV =
'measureObservation'
- STRAT =
"stratum"
- NUMEX =
"numeratorExclusions"
- MSRPOPLEX =
'measurePopulationExclusions'
- TITLES =
{ HQMF::PopulationCriteria::IPP => 'Initial Patient Population', HQMF::PopulationCriteria::DENOM => 'Denominator', HQMF::PopulationCriteria::NUMER => 'Numerator', HQMF::PopulationCriteria::NUMEX => 'Numerator Exclusion', HQMF::PopulationCriteria::DENEXCEP => 'Denominator Exception', HQMF::PopulationCriteria::DENEX => 'Denominator Exclusion', HQMF::PopulationCriteria::MSRPOPL => 'Measure Population', HQMF::PopulationCriteria::OBSERV => 'Measure Observation', HQMF::PopulationCriteria::MSRPOPLEX => 'Measure Population Exclusion' }
Constants included from Utilities
Utilities::MEASURE_ATTRIBUTES_MAP
Instance Attribute Summary collapse
-
#aggregator ⇒ Object
Returns the value of attribute aggregator.
-
#entry ⇒ Object
readonly
Returns the value of attribute entry.
-
#hqmf_id ⇒ Object
Returns the value of attribute hqmf_id.
-
#id ⇒ Object
Returns the value of attribute id.
-
#preconditions ⇒ Object
readonly
Returns the value of attribute preconditions.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #get_logic_leaves(children = nil) ⇒ Object
- #handle_negations ⇒ Object
-
#initialize(entry, doc, index) ⇒ PopulationCriteria
constructor
Create a new population criteria from the supplied HQMF entry.
- #set_index(index) ⇒ Object
- #to_model ⇒ Object
- #translate_type(type) ⇒ Object
Methods included from Utilities
#attr_val, attr_val, build_value, #children_of, #comments_on, #create_age_timing, #create_birthdate_criteria
Constructor Details
#initialize(entry, doc, index) ⇒ PopulationCriteria
Create a new population criteria from the supplied HQMF entry
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/model/population_criteria.rb', line 37 def initialize(entry, doc, index) @doc = doc @entry = entry @hqmf_id = attr_val('@uuid') @type = translate_type(attr_val('@type')) @title = TITLES[@type] @id = @type @id += "_#{index}" if (index > 0) @preconditions = @entry.xpath("#{Precondition::LOGICAL_OP}|#{Precondition::SUB_TREE}").collect do |precondition_def| Precondition.new(precondition_def, @doc) end @preconditions.select! {|p| !p.preconditions.empty? || p.reference} handle_negations end |
Instance Attribute Details
#aggregator ⇒ Object
Returns the value of attribute aggregator.
32 33 34 |
# File 'lib/model/population_criteria.rb', line 32 def aggregator @aggregator end |
#entry ⇒ Object (readonly)
Returns the value of attribute entry.
33 34 35 |
# File 'lib/model/population_criteria.rb', line 33 def entry @entry end |
#hqmf_id ⇒ Object
Returns the value of attribute hqmf_id.
32 33 34 |
# File 'lib/model/population_criteria.rb', line 32 def hqmf_id @hqmf_id end |
#id ⇒ Object
Returns the value of attribute id.
32 33 34 |
# File 'lib/model/population_criteria.rb', line 32 def id @id end |
#preconditions ⇒ Object (readonly)
Returns the value of attribute preconditions.
33 34 35 |
# File 'lib/model/population_criteria.rb', line 33 def preconditions @preconditions end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
33 34 35 |
# File 'lib/model/population_criteria.rb', line 33 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
33 34 35 |
# File 'lib/model/population_criteria.rb', line 33 def type @type end |
Instance Method Details
#get_logic_leaves(children = nil) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/model/population_criteria.rb', line 95 def get_logic_leaves(children=nil) children ||= @preconditions leaves = [] children.each do |precondition| unless (precondition.preconditions.empty?) leaves.concat get_logic_leaves(precondition.preconditions) else leaves << precondition end end leaves end |
#handle_negations ⇒ Object
89 90 91 92 93 |
# File 'lib/model/population_criteria.rb', line 89 def handle_negations @preconditions.each do |p| p.handle_negations(self) end end |
#set_index(index) ⇒ Object
57 58 59 60 |
# File 'lib/model/population_criteria.rb', line 57 def set_index(index) @id = @type @id += "_#{index}" if (index > 0) end |
#to_model ⇒ Object
108 109 110 111 |
# File 'lib/model/population_criteria.rb', line 108 def to_model mps = preconditions.collect {|p| p.to_model} HQMF::PopulationCriteria.new(id, hqmf_id, type, mps, title, aggregator) end |
#translate_type(type) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/model/population_criteria.rb', line 62 def translate_type(type) case type when IPP, 'initialPopulation' HQMF::PopulationCriteria::IPP when DENOM HQMF::PopulationCriteria::DENOM when DENEX HQMF::PopulationCriteria::DENEX when DENEXCEP HQMF::PopulationCriteria::DENEXCEP when NUMER HQMF::PopulationCriteria::NUMER when MSRPOPL HQMF::PopulationCriteria::MSRPOPL when OBSERV HQMF::PopulationCriteria::OBSERV when STRAT HQMF::PopulationCriteria::STRAT when NUMEX HQMF::PopulationCriteria::NUMEX when MSRPOPLEX HQMF::PopulationCriteria::MSRPOPLEX else raise "Unknown population criteria type #{type}" end end |