# File lib/ct_gov/clinical_trial.rb, line 99 def primary_completion_date Date.parse(@raw_trial['primary_completion_date']) end
class CtGov::ClinicalTrial
Public Class Methods
new(raw_trial)
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 3 def initialize(raw_trial) @raw_trial = raw_trial end
Public Instance Methods
brief_summary()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 65 def brief_summary @raw_trial['brief_summary']['textblock'].strip end
brief_title()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 15 def brief_title @raw_trial['brief_title'] end
browse_conditions()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 19 def browse_conditions @raw_trial['condition_browse'].nil? ? [] : [@raw_trial['condition_browse']['mesh_term']].flatten end
browse_interventions()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 27 def browse_interventions @raw_trial['intervention_browse'].nil? ? [] : [@raw_trial['intervention_browse']['mesh_term']].flatten end
completion_date()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 23 def completion_date Date.parse(@raw_trial['completion_date']) end
detailed_description()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 69 def detailed_description @raw_trial['detailed_description']['textblock'].strip end
eligibility_description()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 73 def eligibility_description @raw_trial['eligibility']['criteria']['textblock'] end
healthy_volunteers?()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 7 def healthy_volunteers? @raw_trial['eligibility']['accepts_healthy_volunteers'] == 'Accepts Healthy Volunteers' end
keywords()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 31 def keywords @raw_trial['keyword'].nil? ? [] : [@raw_trial['keyword']].flatten end
locations()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 35 def locations if @raw_trial['location'].nil? [] else [@raw_trial['location']].flatten.map do |loc| Location.new(loc) unless loc.nil? end end end
max_age()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 81 def max_age @raw_trial['eligibility']['maximum_age'] end
min_age()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 77 def min_age @raw_trial['eligibility']['minimum_age'] end
nctid()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 11 def nctid @raw_trial['id_info']['nct_id'] end
official_title()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 45 def official_title @raw_trial['official_title'] end
overall_contacts()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 49 def overall_contacts contacts = [] contacts.push Contact.new(@raw_trial['overall_contact']) if @raw_trial['overall_contact'] [@raw_trial['overall_contact_backup']].flatten.each do |contact| contacts.push Contact.new(contact) end contacts end
overall_official()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 61 def overall_official CtGov::Investigator.new(@raw_trial['overall_official']) unless @raw_trial['overall_official'].nil? end
overall_status()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 85 def overall_status @raw_trial['overall_status'] end
primary_completion_date()
click to toggle source
publications()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 89 def publications if @raw_trial['reference'].nil? [] else [@raw_trial['reference']].flatten.map do |reference| Publication.new(reference) end end end
start_date()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 103 def start_date Date.parse(@raw_trial['start_date']) end
study_type()
click to toggle source
# File lib/ct_gov/clinical_trial.rb, line 107 def study_type @raw_trial['study_type'] end