Module: Lab::Loaders::ReasonsForTestLoader

Extended by:
LoaderMixin
Defined in:
lib/tasks/loaders/reasons_for_test_loader.rb

Constant Summary

Constants included from LoaderMixin

LoaderMixin::CONCEPT_CLASS_TEST, LoaderMixin::CONCEPT_DATATYPE_CODED

Class Method Summary collapse

Methods included from LoaderMixin

add_concept_to_set, data_path, find_or_create_concept, included

Class Method Details

.loadObject



11
12
13
14
15
16
17
18
19
# File 'lib/tasks/loaders/reasons_for_test_loader.rb', line 11

def load
  CSV.open(data_path('reasons-for-test.csv'), headers: :first_row) do |csv|
    csv.each do |row|
      puts "Adding reason for test: #{row['reason_name']}"
      add_concept_to_set(set_concept_id: find_or_create_concept(Lab::Metadata::REASON_FOR_TEST_CONCEPT_NAME).concept_id,
                         concept_id: find_or_create_concept(row['reason_name']).concept_id)
    end
  end
end