Class: CtGov::ClinicalTrial

Inherits:
Object
  • Object
show all
Defined in:
lib/ct_gov/clinical_trial.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw_trial) ⇒ ClinicalTrial

Returns a new instance of ClinicalTrial.



3
4
5
# File 'lib/ct_gov/clinical_trial.rb', line 3

def initialize(raw_trial)
  @raw_trial = raw_trial
end

Instance Method Details

#brief_summaryObject



19
20
21
# File 'lib/ct_gov/clinical_trial.rb', line 19

def brief_summary
  @raw_trial['brief_summary']['textblock'].strip
end

#brief_titleObject



11
12
13
# File 'lib/ct_gov/clinical_trial.rb', line 11

def brief_title
  @raw_trial['brief_title']
end

#detailed_descriptionObject



23
24
25
# File 'lib/ct_gov/clinical_trial.rb', line 23

def detailed_description
  @raw_trial['detailed_description']['textblock'].strip
end

#eligibility_descriptionObject



27
28
29
# File 'lib/ct_gov/clinical_trial.rb', line 27

def eligibility_description
  @raw_trial['eligibility']['criteria']['textblock']
end

#nctidObject



7
8
9
# File 'lib/ct_gov/clinical_trial.rb', line 7

def nctid
  @raw_trial['id_info']['nct_id']
end

#official_titleObject



15
16
17
# File 'lib/ct_gov/clinical_trial.rb', line 15

def official_title
  @raw_trial['official_title']
end

#overall_statusObject



31
32
33
# File 'lib/ct_gov/clinical_trial.rb', line 31

def overall_status
  @raw_trial['overall_status']
end

#publicationsObject



35
36
37
38
39
# File 'lib/ct_gov/clinical_trial.rb', line 35

def publications
  @raw_trial['reference'].map do |reference|
    Publication.new(reference)
  end
end

#start_dateObject



41
42
43
# File 'lib/ct_gov/clinical_trial.rb', line 41

def start_date
  Date.parse(@raw_trial['start_date'])
end

#study_typeObject



45
46
47
# File 'lib/ct_gov/clinical_trial.rb', line 45

def study_type
  @raw_trial['study_type']
end