Created
June 16, 2010 17:42
-
-
Save r00k/441011 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DIAGNOSES = [ "Bladder Cancer", "Brain/Neuro Cancer", "Breast Cancer", "Cervical Cancer", "Colorectal Cancer", "Cutaneous Skin Cancer", | |
"Endometrial/Uterine Cancer", "Esophageal Cancer", "Head and Neck Cancer", "Kidney Cancer", "Leukemia/MDS", "Liver Cancer", | |
"Lung Cancer", "Hodgkin's Lymphoma", "Non-Hodgkin's Lymphoma", "Melanoma", "Multiple Myeloma", "Ovarian Cancer", "Pancreatic Cancer", | |
"Pediatric Blood Related", "Pediatric Brain Tumor", "Pediatric Solid Tumors", "Prevention & Early Detection", "Prostate Cancer", | |
"Sarcoma", "Stomach Cancer", "Testicular Cancer", "Thyroid Cancer", "Other Cancers", "Other Trials" ] | |
namespace :trials do | |
namespace :diagnoses do | |
desc "Seed the database with a basic set of diagnoses." | |
task :create => :environment do | |
create_diagnoses | |
end | |
end | |
desc "Runs the trials:import and diagnoses:create tasks, and rebuilds thinking sphinx" | |
task :bootstrap => :environment do | |
Rake::Task["trials:import"].execute | |
Rake::Task["trials:diagnoses:create"].execute | |
Rake::Task["trials:assign_abbreviations"].execute | |
Rake::Task["thinking_sphinx:rebuild"].execute | |
end | |
desc "Imports trials from clinicaltrials.gov. Creates or updates as appropriate." | |
task :import => :environment do | |
puts "Importing trials. See #{ImportTrials::LOG_FILE} for details." | |
ImportTrials.run | |
puts "Done importing trials." | |
end | |
desc "Assigns abbreviations to trials as specified in ImportTrials::INSTITUTIONS" | |
task :assign_abbreviations => :environment do | |
ImportTrials.assign_abbreviations | |
end | |
end | |
# ======================================================== | |
def create_diagnoses | |
DIAGNOSES.each do |diagnosis| | |
Diagnosis.create(:name => diagnosis) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment