clinical 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/clinical.gemspec +2 -4
- data/features/finding_clinical_trials.feature +1 -1
- data/lib/clinical/abstract_element.rb +19 -0
- data/lib/clinical/contact.rb +12 -18
- data/lib/clinical/location.rb +2 -1
- data/lib/clinical/trial.rb +5 -4
- data/lib/clinical.rb +1 -3
- metadata +2 -4
- data/lib/clinical/location_contact.rb +0 -7
- data/lib/clinical/overall_contact.rb +0 -7
- data/lib/clinical/overall_official.rb +0 -6
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.10
|
data/clinical.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{clinical}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.10"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dan Pickett"]
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"features/step_definitions/clinical_steps.rb",
|
29
29
|
"features/support/env.rb",
|
30
30
|
"lib/clinical.rb",
|
31
|
+
"lib/clinical/abstract_element.rb",
|
31
32
|
"lib/clinical/address.rb",
|
32
33
|
"lib/clinical/agency.rb",
|
33
34
|
"lib/clinical/collaborator.rb",
|
@@ -38,10 +39,7 @@ Gem::Specification.new do |s|
|
|
38
39
|
"lib/clinical/intervention.rb",
|
39
40
|
"lib/clinical/lead_sponsor.rb",
|
40
41
|
"lib/clinical/location.rb",
|
41
|
-
"lib/clinical/location_contact.rb",
|
42
42
|
"lib/clinical/outcome.rb",
|
43
|
-
"lib/clinical/overall_contact.rb",
|
44
|
-
"lib/clinical/overall_official.rb",
|
45
43
|
"lib/clinical/primary_outcome.rb",
|
46
44
|
"lib/clinical/secondary_outcome.rb",
|
47
45
|
"lib/clinical/sponsor.rb",
|
@@ -36,6 +36,7 @@ Feature: As a potential participant for a clinical study
|
|
36
36
|
When I attempt to retrieve trial "NCT00001372"
|
37
37
|
Then I should get a trial
|
38
38
|
And the trial should have an "id" of "NCT00001372"
|
39
|
+
And the trial should have an "overall_contact"
|
39
40
|
|
40
41
|
Scenario: Find a specific trial with extended attributes
|
41
42
|
When I attempt to retrieve trial "NCT00454363"
|
@@ -47,7 +48,6 @@ Feature: As a potential participant for a clinical study
|
|
47
48
|
And the trial should have an "overall_official" like "Alexandra Phan, MD"
|
48
49
|
And the trial should have "eligibility_criteria" like "DISEASE CHARACTERISTICS"
|
49
50
|
And the trial should have "brief_summary" like "Pazopanib"
|
50
|
-
And the trial should have an "overall_contact"
|
51
51
|
|
52
52
|
Scenario: Find trials that were updated between a range of dates
|
53
53
|
Given I am searching for trials that have been updated between "07/06/2009" and "07/07/2009"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Clinical
|
2
|
+
module AbstractElement
|
3
|
+
def self.included(base)
|
4
|
+
base.extend(ClassMethods)
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassMethods
|
8
|
+
def abstract_element(name, type, options = {})
|
9
|
+
element(name, type, options.merge(:parser => :abstract_parse, :raw => true))
|
10
|
+
end
|
11
|
+
|
12
|
+
def abstract_parse(xml, options = {})
|
13
|
+
tag XML::Parser.string(xml).parse.root.name
|
14
|
+
parse(xml)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
data/lib/clinical/contact.rb
CHANGED
@@ -1,25 +1,19 @@
|
|
1
1
|
module Clinical
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
include HappyMapper
|
6
|
-
include Clinical::Contact::InstanceMethods
|
2
|
+
class Contact
|
3
|
+
include HappyMapper
|
4
|
+
include Clinical::AbstractElement
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
6
|
+
element :first_name, String
|
7
|
+
element :middle_name, String
|
8
|
+
element :last_name, String
|
9
|
+
element :degrees, String
|
10
|
+
element :phone, String
|
11
|
+
element :phone_extension, String, :tag => "phone_ext"
|
12
|
+
element :email, String
|
16
13
|
|
17
|
-
end
|
18
14
|
|
19
|
-
|
20
|
-
|
21
|
-
[first_name, last_name, "(#{phone})"].join(" ")
|
22
|
-
end
|
15
|
+
def to_s
|
16
|
+
[first_name, last_name, "(#{phone})"].join(" ")
|
23
17
|
end
|
24
18
|
end
|
25
19
|
end
|
data/lib/clinical/location.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module Clinical
|
2
2
|
class Location
|
3
3
|
include HappyMapper
|
4
|
+
include Clinical::AbstractElement
|
4
5
|
|
5
6
|
element :facility, String
|
6
7
|
has_one :status, Clinical::Status, :parser => :parse
|
7
|
-
|
8
|
+
abstract_element :contact, Clinical::Contact
|
8
9
|
has_one :address, Clinical::Address
|
9
10
|
end
|
10
11
|
end
|
data/lib/clinical/trial.rb
CHANGED
@@ -2,6 +2,7 @@ module Clinical
|
|
2
2
|
class Trial
|
3
3
|
include HappyMapper
|
4
4
|
include HTTParty
|
5
|
+
include Clinical::AbstractElement
|
5
6
|
|
6
7
|
base_uri "http://clinicaltrials.gov"
|
7
8
|
default_params :displayxml => true
|
@@ -24,8 +25,8 @@ module Clinical
|
|
24
25
|
has_many :collaborators, Clinical::Collaborator
|
25
26
|
has_many :agencies, Clinical::Agency
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
abstract_element :overall_official, Clinical::Contact, :tag => "overall_official"
|
29
|
+
abstract_element :overall_contact, Clinical::Contact, :tag => "overall_contact"
|
29
30
|
|
30
31
|
has_many :interventions, Intervention, :tag => "intervention"
|
31
32
|
has_many :primary_outcomes, PrimaryOutcome
|
@@ -98,7 +99,7 @@ module Clinical
|
|
98
99
|
#this metadata is not accessible in the feed so crawl the html page
|
99
100
|
#to get keywords, categories, and terms
|
100
101
|
def get_metadata
|
101
|
-
response = self.class.get("/show/#{id}", :query => {:displayxml => false})
|
102
|
+
response = self.class.get("/ct2/show/#{id}", :query => {:displayxml => false})
|
102
103
|
html = Nokogiri::HTML(response.body)
|
103
104
|
|
104
105
|
metadata = {}
|
@@ -124,7 +125,7 @@ module Clinical
|
|
124
125
|
|
125
126
|
class << self
|
126
127
|
def find_by_id(id)
|
127
|
-
response = get("/show/#{id}")
|
128
|
+
response = get("/ct2/show/#{id}")
|
128
129
|
if response.code == 400
|
129
130
|
nil
|
130
131
|
else
|
data/lib/clinical.rb
CHANGED
@@ -6,6 +6,7 @@ require "happymapper"
|
|
6
6
|
require "nokogiri"
|
7
7
|
|
8
8
|
require "clinical/extensions"
|
9
|
+
require "clinical/abstract_element"
|
9
10
|
|
10
11
|
require "clinical/status"
|
11
12
|
require "clinical/intervention"
|
@@ -21,9 +22,6 @@ require "clinical/agency"
|
|
21
22
|
require "clinical/collaborator"
|
22
23
|
|
23
24
|
require "clinical/contact"
|
24
|
-
require "clinical/overall_official"
|
25
|
-
require "clinical/location_contact"
|
26
|
-
require "clinical/overall_contact"
|
27
25
|
|
28
26
|
require "clinical/address"
|
29
27
|
require "clinical/location"
|
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
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Pickett
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- features/step_definitions/clinical_steps.rb
|
75
75
|
- features/support/env.rb
|
76
76
|
- lib/clinical.rb
|
77
|
+
- lib/clinical/abstract_element.rb
|
77
78
|
- lib/clinical/address.rb
|
78
79
|
- lib/clinical/agency.rb
|
79
80
|
- lib/clinical/collaborator.rb
|
@@ -84,10 +85,7 @@ files:
|
|
84
85
|
- lib/clinical/intervention.rb
|
85
86
|
- lib/clinical/lead_sponsor.rb
|
86
87
|
- lib/clinical/location.rb
|
87
|
-
- lib/clinical/location_contact.rb
|
88
88
|
- lib/clinical/outcome.rb
|
89
|
-
- lib/clinical/overall_contact.rb
|
90
|
-
- lib/clinical/overall_official.rb
|
91
89
|
- lib/clinical/primary_outcome.rb
|
92
90
|
- lib/clinical/secondary_outcome.rb
|
93
91
|
- lib/clinical/sponsor.rb
|