class HQMF1::Observation

Represents an HQMF population criteria

Attributes

doc[R]
entry[R]
hqmf_id[RW]
id[RW]
preconditions[R]
stratification_id[RW]

Public Class Methods

new(entry, doc) click to toggle source

Create a new population criteria from the supplied HQMF entry @param [Nokogiri::XML::Element] the HQMF entry

# 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

Public Instance Methods

code() click to toggle source

Get the code for the population criteria @return [String] the code (e.g. IPP, DEMON, NUMER, DENEX, DENEXCEP)

# File lib/hqmf-parser/1.0/observation.rb, line 21
def code
  HQMF::PopulationCriteria::OBSERV
end
reference() click to toggle source
# File lib/hqmf-parser/1.0/observation.rb, line 36
def reference
  nil
end
title() click to toggle source
# File lib/hqmf-parser/1.0/observation.rb, line 32
def title
  "Measure Observation"
end
to_json() click to toggle source
# 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