lib/generator/js.rb in hqmf2js-1.1.0 vs lib/generator/js.rb in hqmf2js-1.2.0
- old
+ new
@@ -136,12 +136,12 @@
"getCodes(\"#{criteria.code_list_id}\")"
end
end
# Returns the JavaScript generated for a HQMF::Precondition
- def js_for_precondition(precondition, indent)
- HQMF2JS::Generator.render_template('precondition', {'doc' => doc, 'precondition' => precondition, 'indent' => indent})
+ def js_for_precondition(precondition, indent, context=false)
+ HQMF2JS::Generator.render_template('precondition', {'doc' => doc, 'precondition' => precondition, 'indent' => indent, 'context' => context})
end
def patient_api_method(criteria)
criteria.patient_api_function
end
@@ -200,10 +200,11 @@
#{js_for(population[HQMF::PopulationCriteria::NUMER], HQMF::PopulationCriteria::NUMER)}
#{js_for(population[HQMF::PopulationCriteria::DENEX], HQMF::PopulationCriteria::DENEX)}
#{js_for(population[HQMF::PopulationCriteria::DENEXCEP], HQMF::PopulationCriteria::DENEXCEP)}
// CV
#{js_for(population[HQMF::PopulationCriteria::MSRPOPL], HQMF::PopulationCriteria::MSRPOPL)}
+ #{js_for(population[HQMF::PopulationCriteria::OBSERV], HQMF::PopulationCriteria::OBSERV)}
"
end
def js_initialize_specifics(data_criteria)
specific_occurrences = []
@@ -222,10 +223,14 @@
def js_for(criteria_code, type=nil, when_not_found=false)
# for multiple populations, criteria code will be something like IPP_1 and type will be IPP
type ||= criteria_code
criteria = @doc.population_criteria(criteria_code)
if criteria && criteria.preconditions && criteria.preconditions.length > 0
- HQMF2JS::Generator.render_template('population_criteria', {'doc' => @doc, 'criteria' => criteria, 'type'=>type})
+ if type==HQMF::PopulationCriteria::OBSERV
+ HQMF2JS::Generator.render_template('observation_criteria', {'doc' => @doc, 'criteria' => criteria, 'type'=>type})
+ else
+ HQMF2JS::Generator.render_template('population_criteria', {'doc' => @doc, 'criteria' => criteria, 'type'=>type})
+ end
else
"hqmfjs.#{type} = function(patient) { return new Boolean(#{when_not_found}); }"
end
end
\ No newline at end of file