12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/labimotion/models/dataset_klass.rb', line 12
def self.init_seeds
seeds_path = File.join(Rails.root, 'db', 'seeds', 'json', 'dataset_klasses.json')
seeds = JSON.parse(File.read(seeds_path))
seeds['chmo'].each do |term|
next if Labimotion::DatasetKlass.where(ols_term_id: term['id']).count.positive?
attributes = { ols_term_id: term['id'], label: "#{term['label']} (#{term['synonym']})", desc: "#{term['label']} (#{term['synonym']})", place: term['position'], created_by: Admin.first&.id || 0 }
Labimotion::DatasetKlass.create!(attributes)
end
true
end
|