gcig_ca125 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +2 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +78 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +52 -0
- data/VERSION +1 -0
- data/lib/gcig_ca125/calculator.rb +62 -0
- data/lib/gcig_ca125/result.rb +29 -0
- data/lib/gcig_ca125/version.rb +10 -0
- data/lib/gcig_ca125.rb +6 -0
- data/spec/data/gcig_test_data.csv +169 -0
- data/spec/gcig_ca125_spec.rb +7 -0
- data/spec/lib/gcig_ca125/calculator_spec.rb +50 -0
- data/spec/lib/gcig_ca125/result_spec.rb +37 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/support/test_data_reader.rb +40 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d133224038fb6ef26a93a6f8e32585f222e74ca3
|
4
|
+
data.tar.gz: 592cec79d5630e8841308510953eb38215462c7c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 28daead6112db7d7aaa2b3885012f03c852e471e16bcca2053b778a7bb36afa9f826a1e05b2db665c2bbb595976edbfe8d87a24b9993255602e9708d9de0ba83
|
7
|
+
data.tar.gz: 26174659d1b40019e22fd9de89b26ef87243594b69405221962c7f954c41df657c97f53e152d6b07da1ae6968fa84bc92962ef1677428dbcbde837ff4ddcdba7
|
data/.document
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", "~> 3.2"
|
10
|
+
gem "rdoc", "~> 4.2"
|
11
|
+
gem "bundler", "~> 1.7"
|
12
|
+
gem "jeweler", "~> 2.0"
|
13
|
+
gem "simplecov", "~> 0.9"
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.3.7)
|
5
|
+
builder (3.2.2)
|
6
|
+
descendants_tracker (0.0.4)
|
7
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
8
|
+
diff-lcs (1.2.5)
|
9
|
+
docile (1.1.5)
|
10
|
+
faraday (0.9.1)
|
11
|
+
multipart-post (>= 1.2, < 3)
|
12
|
+
git (1.2.9.1)
|
13
|
+
github_api (0.12.3)
|
14
|
+
addressable (~> 2.3)
|
15
|
+
descendants_tracker (~> 0.0.4)
|
16
|
+
faraday (~> 0.8, < 0.10)
|
17
|
+
hashie (>= 3.3)
|
18
|
+
multi_json (>= 1.7.5, < 2.0)
|
19
|
+
nokogiri (~> 1.6.3)
|
20
|
+
oauth2
|
21
|
+
hashie (3.4.0)
|
22
|
+
highline (1.7.1)
|
23
|
+
jeweler (2.0.1)
|
24
|
+
builder
|
25
|
+
bundler (>= 1.0)
|
26
|
+
git (>= 1.2.5)
|
27
|
+
github_api
|
28
|
+
highline (>= 1.6.15)
|
29
|
+
nokogiri (>= 1.5.10)
|
30
|
+
rake
|
31
|
+
rdoc
|
32
|
+
json (1.8.2)
|
33
|
+
jwt (1.3.0)
|
34
|
+
mini_portile (0.6.2)
|
35
|
+
multi_json (1.11.0)
|
36
|
+
multi_xml (0.5.5)
|
37
|
+
multipart-post (2.0.0)
|
38
|
+
nokogiri (1.6.6.2)
|
39
|
+
mini_portile (~> 0.6.0)
|
40
|
+
oauth2 (1.0.0)
|
41
|
+
faraday (>= 0.8, < 0.10)
|
42
|
+
jwt (~> 1.0)
|
43
|
+
multi_json (~> 1.3)
|
44
|
+
multi_xml (~> 0.5)
|
45
|
+
rack (~> 1.2)
|
46
|
+
rack (1.6.0)
|
47
|
+
rake (10.4.2)
|
48
|
+
rdoc (4.2.0)
|
49
|
+
json (~> 1.4)
|
50
|
+
rspec (3.2.0)
|
51
|
+
rspec-core (~> 3.2.0)
|
52
|
+
rspec-expectations (~> 3.2.0)
|
53
|
+
rspec-mocks (~> 3.2.0)
|
54
|
+
rspec-core (3.2.1)
|
55
|
+
rspec-support (~> 3.2.0)
|
56
|
+
rspec-expectations (3.2.0)
|
57
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
58
|
+
rspec-support (~> 3.2.0)
|
59
|
+
rspec-mocks (3.2.1)
|
60
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
61
|
+
rspec-support (~> 3.2.0)
|
62
|
+
rspec-support (3.2.2)
|
63
|
+
simplecov (0.9.2)
|
64
|
+
docile (~> 1.1.0)
|
65
|
+
multi_json (~> 1.0)
|
66
|
+
simplecov-html (~> 0.9.0)
|
67
|
+
simplecov-html (0.9.0)
|
68
|
+
thread_safe (0.3.4)
|
69
|
+
|
70
|
+
PLATFORMS
|
71
|
+
ruby
|
72
|
+
|
73
|
+
DEPENDENCIES
|
74
|
+
bundler (~> 1.7)
|
75
|
+
jeweler (~> 2.0)
|
76
|
+
rdoc (~> 4.2)
|
77
|
+
rspec (~> 3.2)
|
78
|
+
simplecov (~> 0.9)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015 Paul D Mitchell
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= gcig_ca125
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to gcig_ca125
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2015 Paul D Mitchell. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
require './lib/gcig_ca125'
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "gcig_ca125"
|
18
|
+
gem.homepage = "http://github.com/yatsura/gcig_ca125"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{Response and progression of ovarian cancer according to serum CA 125 levels}
|
21
|
+
gem.description = %Q{ A Ruby gem of calculating the response of Ovarian cancer patient
|
22
|
+
according to levels of CA 125 as defined by the GCIG}
|
23
|
+
gem.email = "paul.d.mitchell@ed.ac.uk"
|
24
|
+
gem.authors = ["Paul D Mitchell"]
|
25
|
+
gem.version = GcigCa125::Version::STRING
|
26
|
+
# dependencies defined in Gemfile
|
27
|
+
end
|
28
|
+
Jeweler::RubygemsDotOrgTasks.new
|
29
|
+
|
30
|
+
require 'rspec/core'
|
31
|
+
require 'rspec/core/rake_task'
|
32
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
33
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Code coverage detail"
|
37
|
+
task :simplecov do
|
38
|
+
ENV['COVERAGE'] = "true"
|
39
|
+
Rake::Task['spec'].execute
|
40
|
+
end
|
41
|
+
|
42
|
+
task :default => :spec
|
43
|
+
|
44
|
+
require 'rdoc/task'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
47
|
+
|
48
|
+
rdoc.rdoc_dir = 'rdoc'
|
49
|
+
rdoc.title = "gcig_ca125 #{version}"
|
50
|
+
rdoc.rdoc_files.include('README*')
|
51
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
52
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
module GcigCa125
|
4
|
+
class Calculator
|
5
|
+
def initialize(rx_date, normal_range=(0..30))
|
6
|
+
@normal_range = normal_range
|
7
|
+
@rx_date = rx_date
|
8
|
+
@tests = []
|
9
|
+
end
|
10
|
+
|
11
|
+
def result
|
12
|
+
Result.new is_evaluable?, is_response?, is_normalised?
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_ca125_test(date, value)
|
16
|
+
@tests << [date, value]
|
17
|
+
sort_tests
|
18
|
+
end
|
19
|
+
|
20
|
+
def is_evaluable?
|
21
|
+
@evaluable = (@tests.first[0] <= @rx_date) && (@tests.first[0] >= (@rx_date - 9))
|
22
|
+
@evaluable = (@tests.first[1] > @normal_range.max * 2) if @evaluable
|
23
|
+
end
|
24
|
+
|
25
|
+
def is_response?
|
26
|
+
if is_evaluable?
|
27
|
+
@tests.select { |test| (test[0] > date_of_fall + 28 ) && test[1] < half_of_first }.any?
|
28
|
+
else
|
29
|
+
@response = false
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def is_normalised?
|
34
|
+
@normalised = find_normalised
|
35
|
+
@normalised.any?
|
36
|
+
end
|
37
|
+
|
38
|
+
def sort_tests
|
39
|
+
@tests = @tests.sort { |a,b| a[0] <=> b[0] }
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def date_of_fall
|
44
|
+
valid_response = Proc.new do |test|
|
45
|
+
#(test[1] < half_of_first) && (test[0] > (@rx_date + 28))
|
46
|
+
(test[1] < half_of_first) && (test[0] > (@tests.first[0]))
|
47
|
+
end
|
48
|
+
if @tests.select(&valid_response).any?
|
49
|
+
@tests.select(&valid_response).first[0]
|
50
|
+
else
|
51
|
+
Date.parse('2999-01-01')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
def half_of_first
|
55
|
+
@tests.first[1] / 2.0
|
56
|
+
end
|
57
|
+
|
58
|
+
def find_normalised
|
59
|
+
@tests.select { |test| @normal_range.include? test[1] }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module GcigCa125
|
2
|
+
class Result
|
3
|
+
def initialize(eva, res, norm)
|
4
|
+
@evaluable = eva
|
5
|
+
@response = res
|
6
|
+
@normalised = norm
|
7
|
+
end
|
8
|
+
def to_s
|
9
|
+
"Not evaluable"
|
10
|
+
end
|
11
|
+
|
12
|
+
def message
|
13
|
+
self.to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
def evaluable?
|
17
|
+
@evaluable
|
18
|
+
end
|
19
|
+
|
20
|
+
def response?
|
21
|
+
@response
|
22
|
+
end
|
23
|
+
|
24
|
+
def normalised?
|
25
|
+
@normalised
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
data/lib/gcig_ca125.rb
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
1,1995-06-14,1995-06-12,217,YES,NO,NO,No response: no 50% reduction
|
2
|
+
,,1995-07-25,220,,,,
|
3
|
+
,,1995-09-06,195,,,,
|
4
|
+
2,1995-05-12,1995-05-10,84,YES,NO,YES,Not confirmed: no sample > 28 days after fall
|
5
|
+
,,1995-06-01,45,,,,
|
6
|
+
,,1995-06-21,43,,,,
|
7
|
+
,,1995-08-28,9,,1,1,
|
8
|
+
,,1995-09-19,8,,,,
|
9
|
+
3,1995-05-11,1995-05-31,58,NO,N/A,YES,Not evaluable: no sample pre-Rx
|
10
|
+
,,1995-06-21,24,,,1,
|
11
|
+
,,1995-07-19,15,,,2,
|
12
|
+
,,1995-08-09,14,,,,
|
13
|
+
,,1995-09-13,11,,,,
|
14
|
+
4,1995-04-07,1995-04-06,68,YES,NO,YES,Not confirmed: no sample > 28 days after fall
|
15
|
+
,,1995-05-22,50,,,,
|
16
|
+
,,1995-07-04,51,,,,
|
17
|
+
,,1995-07-26,10,,1,1,
|
18
|
+
5,1995-03-30,1995-03-28,59,NO,N/A,YES,Not evaluable: 1st sample < 2.ULN
|
19
|
+
,,1995-04-19,37,,,,
|
20
|
+
,,1995-05-10,36,,,,
|
21
|
+
,,1995-07-05,30,,,1,
|
22
|
+
,,1995-08-02,13,,,2,
|
23
|
+
6,1995-03-14,1995-03-09,1310,YES,NO,NO,No response: no 50% reduction
|
24
|
+
,,1995-04-03,920,,,,
|
25
|
+
,,1995-04-25,678,,,,
|
26
|
+
,,1995-05-15,656,,,,
|
27
|
+
7,1994-11-01,1994-10-31,51,NO,N/A,YES,Not evaluable: 1st sample < 2.ULN
|
28
|
+
,,1994-12-14,14,,,1,
|
29
|
+
,,1995-01-09,21,,,,
|
30
|
+
,,1995-01-31,21,,,2,
|
31
|
+
,,1995-02-21,9,,,,
|
32
|
+
,,1995-03-13,15,,,,
|
33
|
+
,,1995-04-05,15,,,,
|
34
|
+
8,1995-05-18,1995-05-18,985,YES,YES,YES,Confirmed response
|
35
|
+
,,1995-06-08,145,,1,,
|
36
|
+
,,1995-07-19,16,,,1,
|
37
|
+
,,1995-08-09,10,,,,
|
38
|
+
,,1995-08-30,7,,,2,
|
39
|
+
,,1995-10-06,17,,,,
|
40
|
+
,,1995-11-02,9,,,,
|
41
|
+
9,1994-09-14,1994-09-12,407,YES,YES,NO,Confirmed response
|
42
|
+
,,1994-10-05,360,,,,
|
43
|
+
,,1994-10-26,258,,,,
|
44
|
+
,,1994-11-16,192,,1,,
|
45
|
+
,,1994-12-28,130,,2,,
|
46
|
+
,,1995-01-19,125,,,,
|
47
|
+
10,1994-08-18,1994-08-16,77,YES,NO,NO,No response: no 50% reduction
|
48
|
+
,,1994-09-08,51,,,,
|
49
|
+
,,1994-09-29,71,,,,
|
50
|
+
,,1994-10-20,78,,,,
|
51
|
+
,,1994-11-10,73,,,,
|
52
|
+
,,1994-12-01,132,,,,
|
53
|
+
,,1994-12-29,97,,,,
|
54
|
+
,,1995-01-19,163,,,,
|
55
|
+
11,1994-07-18,1994-07-13,39,NO,N/A,YES,Not evaluable: 1st sample < 2.ULN
|
56
|
+
,,1994-08-08,17,,,1,
|
57
|
+
,,1994-09-02,9,,,,
|
58
|
+
,,1994-09-22,8,,,2,
|
59
|
+
,,1994-10-13,9,,,,
|
60
|
+
,,1994-11-02,8,,,,
|
61
|
+
12,1995-06-28,1995-06-13,31,NO,N/A,YES,Not evaluable: 1st sample < 2.ULN
|
62
|
+
,,1995-07-18,12,,,1,
|
63
|
+
,,1995-08-10,10,,,,
|
64
|
+
,,1995-08-31,5,,,2,
|
65
|
+
,,1995-09-20,4,,,,
|
66
|
+
,,1995-11-01,3,,,,
|
67
|
+
13,1994-12-05,1994-11-29,312,YES,NO,NO,Not confirmed: no sample > 28 days after fall
|
68
|
+
,,1994-12-27,170,,,,
|
69
|
+
,,1995-01-17,65,,1,,
|
70
|
+
,,1995-02-07,45,,,,
|
71
|
+
14,1995-05-12,1995-05-11,672,YES,NO,NO,Not confirmed: reduction not maintained
|
72
|
+
,,1995-05-18,290,,1,,
|
73
|
+
,,1995-06-16,337,,,,
|
74
|
+
,,1995-07-14,415,,,,
|
75
|
+
,,1995-08-14,600,,,,
|
76
|
+
15,1995-04-13,1995-04-04,9060,YES,NO,NO,Not confirmed: no sample > 28 days after fall
|
77
|
+
,,1995-05-04,4840,,,,
|
78
|
+
,,1995-05-29,2300,,1,,
|
79
|
+
16,1994-12-07,1994-11-21,1480,NO,N/A,YES,Not evaluable: no sample within 1 week of Rx
|
80
|
+
,,1994-12-28,500,,,,
|
81
|
+
,,1995-01-17,74,,,,
|
82
|
+
,,1995-02-14,8,,,1,
|
83
|
+
17,1994-07-28,1994-07-25,75,YES,YES,YES,Confirmed response.
|
84
|
+
,,1994-08-07,25,,1,1,
|
85
|
+
,,1994-09-20,13,,2,2,
|
86
|
+
,,1994-10-18,11,,,,
|
87
|
+
18,1994-11-16,1994-11-10,8384,YES,YES,NO,Confirmed response.
|
88
|
+
,,1994-12-06,1030,,1,,
|
89
|
+
,,1994-12-27,818,,2,,
|
90
|
+
,,1995-01-17,155,,,,
|
91
|
+
,,1995-02-15,78,,,,
|
92
|
+
,,1995-02-28,87,,,,
|
93
|
+
,,1995-03-22,64,,,,
|
94
|
+
,,1995-05-03,65,,,,
|
95
|
+
19,1995-05-16,1995-06-01,419,NO,N/A,YES,Not evaluable: no sample pre-Rx
|
96
|
+
,,1995-07-05,215,,,,
|
97
|
+
,,1995-07-30,20,,,1,
|
98
|
+
,,1995-08-22,20,,,,
|
99
|
+
,,1995-09-13,20,,,,
|
100
|
+
20,1994-08-02,1995-07-27,334,NO,N/A,YES,Not evaluable: no sample pre-Rx
|
101
|
+
,,1995-08-29,76,,,,
|
102
|
+
,,1995-09-19,26,,,1,
|
103
|
+
,,1995-10-10,20,,,,
|
104
|
+
,,1995-10-30,18,,,2,
|
105
|
+
,,1995-11-20,11,,,,
|
106
|
+
21,1995-07-31,1995-07-31,320,YES,YES,YES,Confirmed response
|
107
|
+
,,1995-08-21,170,,,,
|
108
|
+
,,1995-09-11,68,,1,,
|
109
|
+
,,1995-10-02,43,,,,
|
110
|
+
,,1995-10-23,27,,2,1,
|
111
|
+
,,1995-11-13,29,,,,
|
112
|
+
22,1995-07-24,1995-07-19,202,YES,NO,NO,No response: no 50% reduction
|
113
|
+
,,1995-08-11,819,,,,
|
114
|
+
,,1995-09-01,322,,,,
|
115
|
+
,,1995-09-05,277,,,,
|
116
|
+
,,1995-09-25,174,,,,
|
117
|
+
,,1995-10-16,173,,,,
|
118
|
+
,,1995-11-06,166,,,,
|
119
|
+
,,1995-12-20,237,,,,
|
120
|
+
,,1996-01-10,256,,,,
|
121
|
+
,,1996-02-05,473,,,,
|
122
|
+
,,1996-04-15,840,,,,
|
123
|
+
23,1995-06-14,1995-06-14,160,YES,NO,NO,No response: no 50% reduction
|
124
|
+
,,1995-07-05,160,,,,
|
125
|
+
,,1995-07-20,176,,,,
|
126
|
+
,,1995-08-01,166,,,,
|
127
|
+
,,1995-08-17,163,,,,
|
128
|
+
,,1995-08-22,142,,,,
|
129
|
+
,,1995-09-12,146,,,,
|
130
|
+
,,1995-10-31,765,,,,
|
131
|
+
24,1995-04-05,1995-04-03,37,NO,N/A,YES,Not evaluable: 1st sample < 2.ULN
|
132
|
+
,,1995-04-05,37,,,,
|
133
|
+
,,1995-04-24,13,,,1,
|
134
|
+
,,1995-05-15,8,,,,
|
135
|
+
,,1995-06-05,8,,,2,
|
136
|
+
,,1995-06-26,7,,,,
|
137
|
+
,,1995-07-17,1,,,,
|
138
|
+
25,1995-01-17,1995-01-16,104,YES,NO,YES,Not confirmed: reduction not maintained
|
139
|
+
,,1995-02-06,56,,,,
|
140
|
+
,,1995-03-07,29,,1,1,
|
141
|
+
,,1995-03-28,21,,,,
|
142
|
+
,,1995-04-12,53,,,,
|
143
|
+
26,1996-04-10,1996-04-10,1154,YES,YES,NO,Confirmed response
|
144
|
+
,,1996-06-05,104,,1,,
|
145
|
+
,,1996-07-03,53,,2,,
|
146
|
+
,,1996-07-31,42,,,,
|
147
|
+
27,1994-12-20,1994-12-20,598,YES,NO,NO,Not confirmed: reduction not maintained
|
148
|
+
,,1994-12-29,294,,,,
|
149
|
+
,,1995-01-06,354,,,,
|
150
|
+
,,1995-01-26,302,,,,
|
151
|
+
,,1995-02-02,350,,,,
|
152
|
+
,,1995-03-21,389,,,,
|
153
|
+
,,1995-04-10,479,,,,
|
154
|
+
28,1994-01-13,1994-01-13,233,YES,NO,NO,No response: no 50% reduction
|
155
|
+
,,1994-02-08,240,,,,
|
156
|
+
,,1994-03-08,227,,,,
|
157
|
+
,,1994-04-05,280,,,,
|
158
|
+
,,1994-05-03,385,,,,
|
159
|
+
,,1994-06-03,390,,,,
|
160
|
+
29,1991-12-12,1991-12-12,178,YES,NO,NO,No response: no 50% reduction
|
161
|
+
,,1992-01-09,227,,,,
|
162
|
+
,,1992-02-06,189,,,,
|
163
|
+
,,1992-03-05,209,,,,
|
164
|
+
,,1992-04-02,173,,,,
|
165
|
+
30,1991-11-07,1991-11-07,1692,YES,NO,NO,No response: no 50% reduction
|
166
|
+
,,1991-12-05,2345,,,,
|
167
|
+
,,1992-01-02,2480,,,,
|
168
|
+
,,1992-01-30,2360,,,,
|
169
|
+
,,1992-02-28,3588,,,,
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'pry'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
# Test data from GCIG RESP SET
|
5
|
+
#
|
6
|
+
|
7
|
+
describe "GcigCa125::Calculator" do
|
8
|
+
before(:all) do
|
9
|
+
file = File.new('./spec/data/gcig_test_data.csv')
|
10
|
+
@test_data = TestDataReader.new(file)
|
11
|
+
end
|
12
|
+
|
13
|
+
context "GCIG Test Data" do
|
14
|
+
(1..30).each do |test_id|
|
15
|
+
context "ID_NUM #{test_id}" do
|
16
|
+
before do
|
17
|
+
@data = @test_data.get_test(test_id)
|
18
|
+
@calculator = GcigCa125::Calculator.new Date.parse(@data[:rx_date])
|
19
|
+
@data[:results].each do |result|
|
20
|
+
@calculator.add_ca125_test(Date.parse(result[:date]),result[:value].to_i)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "evaluable" do
|
25
|
+
if @data[:evaluable].upcase == 'YES'
|
26
|
+
expect(@calculator.result).to be_evaluable
|
27
|
+
else
|
28
|
+
expect(@calculator.result).not_to be_evaluable
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "response" do
|
33
|
+
if @data[:response].upcase == 'YES'
|
34
|
+
expect(@calculator.result).to be_response
|
35
|
+
else
|
36
|
+
expect(@calculator.result).not_to be_response
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it "normalised" do
|
41
|
+
if @data[:normalised].upcase == 'YES'
|
42
|
+
expect(@calculator.result).to be_normalised
|
43
|
+
else
|
44
|
+
expect(@calculator.result).not_to be_normalised
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "GcigCa125::Result" do
|
4
|
+
it "response to message" do
|
5
|
+
expect(GcigCa125::Result.instance_methods).to include(:message)
|
6
|
+
end
|
7
|
+
|
8
|
+
it "response to evaluable" do
|
9
|
+
expect(GcigCa125::Result.instance_methods).to include(:evaluable?)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "response to response" do
|
13
|
+
expect(GcigCa125::Result.instance_methods).to include(:response?)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "response to normalised" do
|
17
|
+
expect(GcigCa125::Result.instance_methods).to include(:normalised?)
|
18
|
+
end
|
19
|
+
|
20
|
+
context "#message" do
|
21
|
+
it "starts with 'No response' if evaluable but no response and has not normalised" do
|
22
|
+
skip
|
23
|
+
end
|
24
|
+
|
25
|
+
it "starts with 'Not evaluable' if not evaluable" do
|
26
|
+
skip
|
27
|
+
end
|
28
|
+
|
29
|
+
it "starts with 'Not confirmed' if evaluable and normalised but not response" do
|
30
|
+
skip
|
31
|
+
end
|
32
|
+
|
33
|
+
it "starts with 'Confirmed response' if evaluable, normalised and is a response" do
|
34
|
+
skip
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
module SimpleCov::Configuration
|
4
|
+
def clean_filters
|
5
|
+
@filters = []
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
SimpleCov.configure do
|
10
|
+
clean_filters
|
11
|
+
load_adapter 'test_frameworks'
|
12
|
+
end
|
13
|
+
|
14
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
15
|
+
add_filter "/.rvm/"
|
16
|
+
end
|
17
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
18
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
19
|
+
|
20
|
+
require 'rspec'
|
21
|
+
require 'gcig_ca125'
|
22
|
+
|
23
|
+
# Requires supporting files with custom matchers and macros, etc,
|
24
|
+
# in ./support/ and its subdirectories.
|
25
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
26
|
+
|
27
|
+
RSpec.configure do |config|
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class TestDataReader
|
2
|
+
def initialize(file)
|
3
|
+
@file = file
|
4
|
+
end
|
5
|
+
|
6
|
+
def get_test(num)
|
7
|
+
if !@data
|
8
|
+
test_reader
|
9
|
+
end
|
10
|
+
@data[num]
|
11
|
+
end
|
12
|
+
|
13
|
+
def data
|
14
|
+
@data
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_reader
|
18
|
+
test_id = 0
|
19
|
+
test_details = {}
|
20
|
+
@data = []
|
21
|
+
@file.readlines.each do |line|
|
22
|
+
items = line.split(',')
|
23
|
+
if (items[0].length > 0) && (items[0] != test_id)
|
24
|
+
@data << test_details
|
25
|
+
test_id = items[0]
|
26
|
+
test_details = {
|
27
|
+
:id => items[0],
|
28
|
+
:rx_date => items[1],
|
29
|
+
:evaluable => items[4],
|
30
|
+
:response => items[5],
|
31
|
+
:normalised => items[6],
|
32
|
+
:note => items[7],
|
33
|
+
:results => []
|
34
|
+
}
|
35
|
+
end
|
36
|
+
test_details[:results] << {:date => items[2], :value => items[3]}
|
37
|
+
end
|
38
|
+
@data << test_details
|
39
|
+
end
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gcig_ca125
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paul D Mitchell
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jeweler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.9'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.9'
|
83
|
+
description: |2-
|
84
|
+
A Ruby gem of calculating the response of Ovarian cancer patient
|
85
|
+
according to levels of CA 125 as defined by the GCIG
|
86
|
+
email: paul.d.mitchell@ed.ac.uk
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files:
|
90
|
+
- LICENSE.txt
|
91
|
+
- README.rdoc
|
92
|
+
files:
|
93
|
+
- ".document"
|
94
|
+
- ".rspec"
|
95
|
+
- Gemfile
|
96
|
+
- Gemfile.lock
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.rdoc
|
99
|
+
- Rakefile
|
100
|
+
- VERSION
|
101
|
+
- lib/gcig_ca125.rb
|
102
|
+
- lib/gcig_ca125/calculator.rb
|
103
|
+
- lib/gcig_ca125/result.rb
|
104
|
+
- lib/gcig_ca125/version.rb
|
105
|
+
- spec/data/gcig_test_data.csv
|
106
|
+
- spec/gcig_ca125_spec.rb
|
107
|
+
- spec/lib/gcig_ca125/calculator_spec.rb
|
108
|
+
- spec/lib/gcig_ca125/result_spec.rb
|
109
|
+
- spec/spec_helper.rb
|
110
|
+
- spec/support/test_data_reader.rb
|
111
|
+
homepage: http://github.com/yatsura/gcig_ca125
|
112
|
+
licenses:
|
113
|
+
- MIT
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 2.4.2
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: Response and progression of ovarian cancer according to serum CA 125 levels
|
135
|
+
test_files: []
|