// Measure variables <%= js_for_measure_period(measure_period) if measure_period -%> <%- all_criteria.select {|c| c.type == :variable}.each do |criteria| -%> var <%= js_name(criteria) %> = <%= js_for_value(criteria.value) %>; <%- end -%> // Data critera <%- all_criteria.select {|c| c.type != :variable}.each do |criteria| -%> hqmfjs.<%= js_name(criteria) %> = function(patient) { <%- if criteria.type == :characteristic and !criteria.property.nil? -%> <%= js_for_characteristic(criteria) %> <%- else -%> <%- if criteria.type != :derived -%> <%= js_for_patient_data(criteria) %> <%- else # derived criteria -%> <%= js_for_derived_data(criteria) %> <%- end -%> <%- if criteria.value -%> events = filterEventsByValue(events, <%= js_for_bounds(criteria.value) %>); <%- end -%> <%- if criteria.field_values.present? criteria.field_values.keys.each do |field| -%> events = <%= field_library_method(field) %>(events, "<%= field_method(field) %>", <%= js_for_bounds(criteria.field_values[field]) %>); <%- end -%> <%- end -%> <%- if criteria.temporal_references and criteria.temporal_references.length > 0 -%> <%- criteria.temporal_references.each do |temporal_reference| -%> if (events.length > 0) events = <%= temporal_reference.type %>(events, hqmfjs.<%= temporal_reference.reference.id %>(patient)<%= ", #{js_for_bounds(temporal_reference.range)}" if temporal_reference.range %>); else events.specificContext=hqmf.SpecificsManager.empty(); <%- end -%> <%- else -%> <%- if criteria.specific_occurrence -%> events.specificContext=new hqmf.SpecificOccurrence(Row.buildForDataCriteria(events.specific_occurrence, events)) <%- else -%> events.specificContext=hqmf.SpecificsManager.identity() <%- end -%> <%- end -%> <%- if criteria.subset_operators -%> <%- criteria.subset_operators.select {|subset_operator| subset_operator.type}.each do |subset_operator| -%> events = <%= subset_operator.type %>(events<%= ", #{js_for_bounds(subset_operator.value)}" if subset_operator.value %>); <%- end # each operator -%> <%- end # subset operators -%> return events; <%- end # non-characteristic criteria -%> } <%- end -%>