dpickett-clinical 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
 
4
- begin require "metric_fu" rescue Exception; end
4
+ begin require "metric_fu" rescue LoadError; end
5
5
 
6
6
  begin
7
7
  require 'jeweler'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.4
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.1.2"
5
+ s.version = "0.1.3"
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-06-28}
9
+ s.date = %q{2009-06-29}
10
10
  s.email = %q{dpickett@enlightsolutions.com}
11
11
  s.extra_rdoc_files = [
12
12
  "LICENSE",
@@ -37,6 +37,14 @@ Feature: As a potential participant for a clinical study
37
37
  Then I should get a trial
38
38
  And the trial should have an "id" of "NCT00001372"
39
39
 
40
+ Scenario: Find a specific trial with extended attributes
41
+ When I attempt to retrieve trial "NCT00454363"
42
+ Then I should get a trial
43
+ And the trial should have a "phase" of "2"
44
+ And the trial should have "conditions" like "Lung Cancer"
45
+ And the trial should have a "minimum_age" of "21 Years"
46
+ And the trial should have "sponsors" like "M.D. Anderson"
47
+
40
48
  Scenario: Find a non-existant trial
41
49
  When I attempt to retrieve trial "4325785"
42
50
  Then I should not get a trial
@@ -43,7 +43,6 @@ Then /^I should get trials where the "([^\"]*)" contains "([^\"]*)"$/ do |field,
43
43
  result.each do |i|
44
44
  found = true if i.to_s =~ /#{value}/i
45
45
  end
46
- debugger if !found
47
46
  found.should be_true
48
47
  else
49
48
  result.to_s.should =~ /#{value}/i
@@ -55,10 +54,15 @@ Then /^I should get a trial$/ do
55
54
  @trial.should_not be_nil
56
55
  end
57
56
 
58
- Then /^the trial should have an "([^\"]*)" of "([^\"]*)"$/ do |field, value|
59
- @trial.send(field).should eql(value)
57
+ Then /^the trial should have an? "([^\"]*)" of "([^\"]*)"$/ do |field, value|
58
+ @trial.send(field).to_s.should eql(value)
60
59
  end
61
60
 
61
+ Then /^the trial should have "([^\"]*)" like "([^\"]*)"$/ do |field, value|
62
+ @trial.send(field).to_s.should =~ /#{Regexp.escape(value)}/
63
+ end
64
+
65
+
62
66
  Then /^I should not get a trial$/ do
63
67
  @trial.should be_nil
64
68
  end
@@ -1,5 +1,3 @@
1
- require "ruby-debug"
2
-
3
1
  module Clinical
4
2
  class Trial
5
3
  include HappyMapper
@@ -16,9 +14,9 @@ module Clinical
16
14
  element :short_title, String, :tag => "title"
17
15
  element :official_title, String
18
16
  element :condition_summary, String
19
- has_many :condition_items, String, :tag => "condition"
17
+ has_many :condition_items, Clinical::Condition, :tag => "condition", :raw => true
20
18
 
21
- element :phase, Integer
19
+ element :text_phase, String, :tag => "phase"
22
20
  element :study_type, String
23
21
  element :study_design, String
24
22
 
@@ -36,10 +34,10 @@ module Clinical
36
34
 
37
35
  element :last_changed_at, Date, :tag => "lastchanged_date"
38
36
 
39
- element :minimum_age, String
40
- element :maximum_age, String
41
- element :gender, String
42
- element :healthy_volunteers, String
37
+ element :minimum_age, String, :tag => "eligibility/minimum_age"
38
+ element :maximum_age, String, :tag => "eligibility/maximum_age"
39
+ element :gender, String, :tag => "eligibility/gender"
40
+ element :healthy_volunteers, String, :tag => "eligibility/healthy_volunteers"
43
41
 
44
42
  element :participant_quantity, Integer, :tag => "enrollment"
45
43
 
@@ -77,6 +75,10 @@ module Clinical
77
75
  end
78
76
  end
79
77
 
78
+ def phase
79
+ self.text_phase.gsub(/phase /i, "").to_i
80
+ end
81
+
80
82
  class << self
81
83
  def find_by_id(id)
82
84
  response = get("/show/#{id}")
data/lib/clinical.rb CHANGED
@@ -11,6 +11,7 @@ require "clinical/intervention"
11
11
  require "clinical/outcome"
12
12
  require "clinical/primary_outcome"
13
13
  require "clinical/secondary_outcome"
14
+ require "clinical/condition"
14
15
 
15
16
  require "clinical/address"
16
17
  require "clinical/contact"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpickett-clinical
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
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-06-28 00:00:00 -07:00
12
+ date: 2009-06-29 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency