Class: HQMF1::Observation
- Inherits:
-
Object
- Object
- HQMF1::Observation
- Includes:
- Utilities
- Defined in:
- lib/hqmf-parser/1.0/observation.rb
Overview
Represents an HQMF population criteria
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#entry ⇒ Object
readonly
Returns the value of attribute entry.
-
#hqmf_id ⇒ Object
Returns the value of attribute hqmf_id.
-
#id ⇒ String
Get the id for the population criteria, used elsewhere in the HQMF document to refer to this criteria.
-
#preconditions ⇒ Object
readonly
Returns the value of attribute preconditions.
-
#stratification_id ⇒ Object
Returns the value of attribute stratification_id.
Instance Method Summary collapse
-
#code ⇒ String
Get the code for the population criteria.
-
#initialize(entry, doc) ⇒ Observation
constructor
Create a new population criteria from the supplied HQMF entry.
- #reference ⇒ Object
- #title ⇒ Object
- #to_json ⇒ Object
Methods included from Utilities
#attr_val, #clean_json, #clean_json_recursive
Methods included from HQMF::Conversion::Utilities
#build_hash, #check_equality, #json_array, #openstruct_to_json
Constructor Details
#initialize(entry, doc) ⇒ Observation
Create a new population criteria from the supplied HQMF entry
12 13 14 15 16 17 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 12 def initialize(entry, doc) @doc = doc @entry = entry @id = attr_val('cda:observation/cda:id/@root').upcase @preconditions = [Precondition.new(@entry, nil, @doc)] end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
7 8 9 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 7 def doc @doc end |
#entry ⇒ Object (readonly)
Returns the value of attribute entry.
7 8 9 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 7 def entry @entry end |
#hqmf_id ⇒ Object
Returns the value of attribute hqmf_id.
8 9 10 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 8 def hqmf_id @hqmf_id end |
#id ⇒ String
Get the id for the population criteria, used elsewhere in the HQMF document to refer to this criteria
28 29 30 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 28 def id @id end |
#preconditions ⇒ Object (readonly)
Returns the value of attribute preconditions.
7 8 9 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 7 def preconditions @preconditions end |
#stratification_id ⇒ Object
Returns the value of attribute stratification_id.
8 9 10 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 8 def stratification_id @stratification_id end |
Instance Method Details
#code ⇒ String
Get the code for the population criteria
21 22 23 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 21 def code HQMF::PopulationCriteria::OBSERV end |
#reference ⇒ Object
36 37 38 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 36 def reference nil end |
#title ⇒ Object
32 33 34 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 32 def title "Measure Observation" end |
#to_json ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/hqmf-parser/1.0/observation.rb', line 40 def to_json json = {} self.preconditions.compact.each do |precondition| json[:preconditions] ||= [] json[:preconditions] << precondition.to_json end json[:preconditions].each {|p| p[:conjunction] ||= "AND"} json[:id] = id json[:title] = title json[:code] = code json[:hqmf_id] = hqmf_id if hqmf_id json[:stratification_id] = stratification_id if stratification_id json[:reference] = reference {self.code => json} end |