Class: Measures::SourceDataCriteriaLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/measure-loader/source_data_criteria_loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(hqmf_xml, value_sets_from_single_code_references) ⇒ SourceDataCriteriaLoader

Returns a new instance of SourceDataCriteriaLoader.



4
5
6
7
# File 'lib/measure-loader/source_data_criteria_loader.rb', line 4

def initialize(hqmf_xml, value_sets_from_single_code_references)
  @hqmf_xml = hqmf_xml
  @single_code_concepts = map_single_code_concepts(value_sets_from_single_code_references)
end

Instance Method Details

#extract_data_criteriaObject



9
10
11
12
13
14
15
16
17
# File 'lib/measure-loader/source_data_criteria_loader.rb', line 9

def extract_data_criteria
  data_criteria_entries = @hqmf_xml.css('QualityMeasureDocument/component/dataCriteriaSection/entry')
  source_data_criteria = data_criteria_entries.map { |entry| modelize_data_criteria_entry(entry) }

  # We create the sdc in such a way that "negative" ones look positive in our array by now,
  # so using uniq should give us an array of all positive criteria with no duplicates
  source_data_criteria.uniq! { |sdc| "#{sdc.codeListId}_#{sdc.hqmfOid}" }
  return source_data_criteria
end