clinical 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -45,18 +45,6 @@ namespace :rcov do
45
45
  t.rcov_opts = %w{--aggregate coverage.data --exclude osx\/objc,gems\/,features\/,spec\/ -o "features_rcov"}
46
46
  end
47
47
  end
48
- begin
49
- desc "Run both specs and features to generate aggregated coverage"
50
- task :rcov do |t|
51
- rm "coverage.data" if File.exist?("coverage.data")
52
- Rake::Task["rcov:cucumber"].invoke
53
- Rake::Task["rcov:tests"].invoke
54
- end
55
- rescue LoadError
56
- task :rcov do
57
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
58
- end
59
- end
60
48
 
61
49
  begin
62
50
  require 'cucumber/rake/task'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
data/clinical.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{clinical}
5
- s.version = "0.2.4"
5
+ s.version = "0.2.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Dan Pickett"]
9
- s.date = %q{2009-07-29}
9
+ s.date = %q{2009-08-07}
10
10
  s.email = %q{dpickett@enlightsolutions.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -48,11 +48,10 @@ Gem::Specification.new do |s|
48
48
  "test/fixtures/open_set.xml",
49
49
  "test/test_helper.rb"
50
50
  ]
51
- s.has_rdoc = true
52
51
  s.homepage = %q{http://github.com/dpickett/clinical}
53
52
  s.rdoc_options = ["--charset=UTF-8"]
54
53
  s.require_paths = ["lib"]
55
- s.rubygems_version = %q{1.3.2}
54
+ s.rubygems_version = %q{1.3.5}
56
55
  s.summary = %q{a library for accessing data from ClinicalTrials.gov}
57
56
  s.test_files = [
58
57
  "test/clinical/trial_test.rb",
@@ -46,6 +46,17 @@ Feature: As a potential participant for a clinical study
46
46
  And the trial should have "sponsors" like "M.D. Anderson"
47
47
  And the trial should have an "overall_official" like "Alexandra Phan, MD"
48
48
 
49
+ Scenario: Find trials that were updated between a range of dates
50
+ Given I am searching for trials that have been updated between "07/06/2009" and "07/07/2009"
51
+ When I perform the extended search
52
+ Then I should get trials where "updated_at" is greater than or equal to "07/06/2009"
53
+ And I should get trials where "updated_at" is less than or equal to "07/07/2009"
54
+
55
+ Scenario: Find trials that were updated beyond a single date
56
+ Given I am searching for trials that have been updated after "07/06/2009"
57
+ When I perform the extended search
58
+ Then I should get trials where "updated_at" is greater than or equal to "07/06/2009"
59
+
49
60
  Scenario: Find a non-existant trial
50
61
  When I attempt to retrieve trial "4325785"
51
62
  Then I should not get a trial
@@ -10,6 +10,21 @@ Given /^I am searching for trials where "([^\"]*)" is "([^\"]*)"$/ do |field, va
10
10
  @params[field.to_sym] = value
11
11
  end
12
12
 
13
+ Given /^I am searching for trials that have been updated between "([^\"]*)" and "([^\"]*)"$/ do |start_date, end_date|
14
+ dates = [Date.parse(start_date)]
15
+ dates << Date.parse(end_date)
16
+
17
+ @params ||= {}
18
+ @params[:updated_at] = dates
19
+ end
20
+
21
+ Given /^I am searching for trials that have been updated after "([^\"]*)"$/ do |date|
22
+ dates = [Date.parse(date)]
23
+
24
+ @params ||= {}
25
+ @params[:updated_at] = dates
26
+ end
27
+
13
28
  When /^I perform the search$/ do
14
29
  @trials = Clinical::Trial.find(:conditions => @params)
15
30
  end
@@ -67,8 +82,30 @@ Then /^the trial should have (an\s)?"([^\"]*)" like "([^\"]*)"$/ do |an, field,
67
82
  @trial.send(field).to_s.should =~ /#{Regexp.escape(value)}/
68
83
  end
69
84
 
85
+ Then /^I should get trials where "([^\"]*)" is greater than "([^\"]*)"$/ do |arg1, arg2|
86
+ pending
87
+ end
88
+
89
+ Then /^I should get trials where "([^\"]*)" is greater than or equal to "([^\"]*)"$/ do |attr, date|
90
+ @trials.each do |t|
91
+ assert t.send(attr) >= Date.parse(date),
92
+ "#{t.send(attr)} is not >= #{Date.parse(date)}"
93
+ end
94
+ end
95
+
96
+ Then /^I should get trials where "([^\"]*)" is less than or equal to "([^\"]*)"$/ do |attr, date|
97
+ @trials.each do |t|
98
+ assert t.send(attr) <= Date.parse(date),
99
+ "#{t.send(attr)} is not <= #{Date.parse(date)}"
100
+ end
101
+ end
102
+
70
103
 
71
104
  Then /^I should not get a trial$/ do
72
105
  @trial.should be_nil
73
106
  end
74
107
 
108
+
109
+ Then /^I should get trials where "([^\"]*)" is between "([^\"]*)" and "([^\"]*)"$/ do |attr, start_date, end_date|
110
+ end
111
+
@@ -34,7 +34,8 @@ module Clinical
34
34
  element :start_date, Date
35
35
  element :end_date, Date
36
36
 
37
- element :last_changed_at, Date, :tag => "lastchanged_date"
37
+ element :first_received_at, Date, :tag => "firstreceived_date"
38
+ element :updated_at, Date, :tag => "lastchanged_date"
38
39
 
39
40
  element :minimum_age, String, :tag => "eligibility/minimum_age"
40
41
  element :maximum_age, String, :tag => "eligibility/maximum_age"
@@ -164,6 +165,17 @@ module Clinical
164
165
  query[value] = conditions[key] unless conditions[key].nil?
165
166
  end
166
167
 
168
+ unless conditions[:updated_at].nil?
169
+ unless conditions[:updated_at].is_a?(Array)
170
+ conditions[:updated_at] = [conditions[:updated_at]]
171
+ end
172
+
173
+ query["lup_s"] = conditions[:updated_at][0].strftime("%m/%d/%Y")
174
+ if conditions[:updated_at].size == 2
175
+ query["lup_e"] = conditions[:updated_at][1].strftime("%m/%d/%Y")
176
+ end
177
+ end
178
+
167
179
  query
168
180
  end
169
181
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clinical
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Pickett
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-29 00:00:00 -04:00
12
+ date: 2009-08-07 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements: []
121
121
 
122
122
  rubyforge_project:
123
- rubygems_version: 1.3.2
123
+ rubygems_version: 1.3.5
124
124
  signing_key:
125
125
  specification_version: 3
126
126
  summary: a library for accessing data from ClinicalTrials.gov