quality-measure-engine 2.5.1 → 2.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZWIwOWQ5NDlkZjk1NjM2MDhlOWJmMzY5MzZlNjA3NGE5MjNkYTAzMg==
5
+ data.tar.gz: !binary |-
6
+ YjQ5MTUyYTZlMWJkM2ViOGQyYTQ2MDA2MmExNWE3N2FlOGFlNDNlZQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OTA1ODcwODdmOTM4MDJmZjdiYTkzYzc1NjFlYTZjNWViNDg4YzhlNDU3M2Nh
10
+ ZGJkZTQyZDQzODhjMmEzNTgzN2FlZGI3Y2U3YThiZTBlMDYxODA0YTcyNGQ4
11
+ M2VmN2Y5YTMzMjZlOGQwZDkzYzRkZjAyYzlkYjgxMjAwNTFjNzI=
12
+ data.tar.gz: !binary |-
13
+ NjNlMjhhOTNhYjVhNjk0ZjgxNWEyZjgzMmM4MmZlNzg3MjYyNDM5NjhmY2Nj
14
+ NTgzNDllMGJjN2U3MTZhZDQ5YWViZTQ3MWJhZGUyZmQ3NTZiOTgwMWExYTMx
15
+ NzJhOWM0OTU2YzFmZDkyM2U3YzFlNTQ3YzliY2UyMmMzOTA5ZjQ=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- quality-measure-engine (2.5.1)
4
+ quality-measure-engine (2.5.2)
5
5
  delayed_job_mongoid (~> 2.0.0)
6
6
  mongoid (~> 3.1.4)
7
7
  moped (~> 1.5.1)
@@ -62,13 +62,13 @@ GEM
62
62
  treetop (~> 1.4.8)
63
63
  method_source (0.8.2)
64
64
  mime-types (1.24)
65
- mini_portile (0.5.1)
65
+ mini_portile (0.5.2)
66
66
  minitest (4.7.5)
67
- mongoid (3.1.4)
67
+ mongoid (3.1.5)
68
68
  activemodel (~> 3.2)
69
69
  moped (~> 1.4)
70
70
  origin (~> 1.0)
71
- tzinfo (~> 0.3.22)
71
+ tzinfo (~> 0.3.29)
72
72
  moped (1.5.1)
73
73
  multi_json (1.7.9)
74
74
  nokogiri (1.6.0)
@@ -6,21 +6,26 @@ module QME
6
6
  def self.median(frequencies)
7
7
  set_size = frequencies.values.reduce(0, :+)
8
8
  offset = set_size.even? ? 1 : 0
9
- median_positions = [(set_size / 2), (set_size / 2)+offset]
9
+ left_position, right_position = [(set_size / 2), (set_size / 2) + offset]
10
+ current_position = -1 + offset #compensate for integer math flooring
10
11
 
11
- current_position = 0
12
12
  median_left = nil
13
13
  median_right = nil
14
14
 
15
15
  frequencies.keys.sort.each do |value|
16
- current_position += frequencies[value]
17
-
18
- median_left = value if median_left.nil? && current_position >= median_positions[0]
19
- if current_position >= median_positions[1]
20
- median_right = value
16
+ current_position += (frequencies[value])
17
+
18
+ if current_position >= left_position && median_left == nil
19
+ median_left = value
20
+ return median_left if set_size.odd?
21
+ end
22
+
23
+ if current_position >= right_position
24
+ median_right = value
21
25
  break
22
26
  end
23
27
  end
28
+
24
29
  median_left ||= 0
25
30
  median_right ||= 0
26
31
  (median_left + median_right)/2
@@ -37,4 +42,4 @@ module QME
37
42
  end
38
43
 
39
44
  end
40
- end
45
+ end
data/lib/qme/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module QME
2
- VERSION = "2.5.1"
2
+ VERSION = "2.5.2"
3
3
  end
@@ -0,0 +1,37 @@
1
+ require 'test_helper'
2
+
3
+ class CVAggregatorTest < MiniTest::Unit::TestCase
4
+
5
+ def test_median_with_simple_odd_size_set
6
+ calc({90.0 => 1, 4315.0 => 2}, 4315.0)
7
+ end
8
+
9
+ def test_median_with_complex_odd_size_set
10
+ calc({0.0 => 5, 25.0 => 2, 50.0 => 8, 100.0 => 6}, 50.0)
11
+ end
12
+
13
+ def test_median_with_simple_even_size_set
14
+ calc({50.0 => 1, 100.0 => 1}, 75.0)
15
+ end
16
+
17
+ def test_median_with_large_offset_even_size_set
18
+ calc({1.0 => 3, 2.0 => 1, 5.0 => 1, 7.0 => 1, 8.0 => 1, 10.0 => 2, 12.0 => 1}, 6.0)
19
+ end
20
+
21
+ def test_median_with_complex_even_size_set
22
+ calc({25.0 => 5, 50.0 => 5, 100.0 => 5, 200.0 => 5}, 75.0)
23
+ end
24
+
25
+ def test_median_with_empty_set
26
+ calc({}, 0)
27
+ end
28
+
29
+ def test_single_element_set
30
+ calc({1.0 => 1}, 1.0)
31
+ end
32
+
33
+ def calc(ft, exp)
34
+ result = QME::MapReduce::CVAggregator.median(ft)
35
+ assert_equal exp, result
36
+ end
37
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quality-measure-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
5
- prerelease:
4
+ version: 2.5.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Marc Hadley
@@ -13,12 +12,11 @@ authors:
13
12
  autorequire:
14
13
  bindir: bin
15
14
  cert_chain: []
16
- date: 2013-08-23 00:00:00.000000000 Z
15
+ date: 2013-11-08 00:00:00.000000000 Z
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
18
  name: moped
20
19
  requirement: !ruby/object:Gem::Requirement
21
- none: false
22
20
  requirements:
23
21
  - - ~>
24
22
  - !ruby/object:Gem::Version
@@ -26,7 +24,6 @@ dependencies:
26
24
  type: :runtime
27
25
  prerelease: false
28
26
  version_requirements: !ruby/object:Gem::Requirement
29
- none: false
30
27
  requirements:
31
28
  - - ~>
32
29
  - !ruby/object:Gem::Version
@@ -34,7 +31,6 @@ dependencies:
34
31
  - !ruby/object:Gem::Dependency
35
32
  name: mongoid
36
33
  requirement: !ruby/object:Gem::Requirement
37
- none: false
38
34
  requirements:
39
35
  - - ~>
40
36
  - !ruby/object:Gem::Version
@@ -42,7 +38,6 @@ dependencies:
42
38
  type: :runtime
43
39
  prerelease: false
44
40
  version_requirements: !ruby/object:Gem::Requirement
45
- none: false
46
41
  requirements:
47
42
  - - ~>
48
43
  - !ruby/object:Gem::Version
@@ -50,7 +45,6 @@ dependencies:
50
45
  - !ruby/object:Gem::Dependency
51
46
  name: rubyzip
52
47
  requirement: !ruby/object:Gem::Requirement
53
- none: false
54
48
  requirements:
55
49
  - - ~>
56
50
  - !ruby/object:Gem::Version
@@ -58,7 +52,6 @@ dependencies:
58
52
  type: :runtime
59
53
  prerelease: false
60
54
  version_requirements: !ruby/object:Gem::Requirement
61
- none: false
62
55
  requirements:
63
56
  - - ~>
64
57
  - !ruby/object:Gem::Version
@@ -66,7 +59,6 @@ dependencies:
66
59
  - !ruby/object:Gem::Dependency
67
60
  name: delayed_job_mongoid
68
61
  requirement: !ruby/object:Gem::Requirement
69
- none: false
70
62
  requirements:
71
63
  - - ~>
72
64
  - !ruby/object:Gem::Version
@@ -74,7 +66,6 @@ dependencies:
74
66
  type: :runtime
75
67
  prerelease: false
76
68
  version_requirements: !ruby/object:Gem::Requirement
77
- none: false
78
69
  requirements:
79
70
  - - ~>
80
71
  - !ruby/object:Gem::Version
@@ -82,7 +73,6 @@ dependencies:
82
73
  - !ruby/object:Gem::Dependency
83
74
  name: nokogiri
84
75
  requirement: !ruby/object:Gem::Requirement
85
- none: false
86
76
  requirements:
87
77
  - - ~>
88
78
  - !ruby/object:Gem::Version
@@ -90,7 +80,6 @@ dependencies:
90
80
  type: :runtime
91
81
  prerelease: false
92
82
  version_requirements: !ruby/object:Gem::Requirement
93
- none: false
94
83
  requirements:
95
84
  - - ~>
96
85
  - !ruby/object:Gem::Version
@@ -98,7 +87,6 @@ dependencies:
98
87
  - !ruby/object:Gem::Dependency
99
88
  name: rubyXL
100
89
  requirement: !ruby/object:Gem::Requirement
101
- none: false
102
90
  requirements:
103
91
  - - ~>
104
92
  - !ruby/object:Gem::Version
@@ -106,7 +94,6 @@ dependencies:
106
94
  type: :runtime
107
95
  prerelease: false
108
96
  version_requirements: !ruby/object:Gem::Requirement
109
- none: false
110
97
  requirements:
111
98
  - - ~>
112
99
  - !ruby/object:Gem::Version
@@ -114,7 +101,6 @@ dependencies:
114
101
  - !ruby/object:Gem::Dependency
115
102
  name: minitest
116
103
  requirement: !ruby/object:Gem::Requirement
117
- none: false
118
104
  requirements:
119
105
  - - ~>
120
106
  - !ruby/object:Gem::Version
@@ -122,7 +108,6 @@ dependencies:
122
108
  type: :development
123
109
  prerelease: false
124
110
  version_requirements: !ruby/object:Gem::Requirement
125
- none: false
126
111
  requirements:
127
112
  - - ~>
128
113
  - !ruby/object:Gem::Version
@@ -130,7 +115,6 @@ dependencies:
130
115
  - !ruby/object:Gem::Dependency
131
116
  name: simplecov
132
117
  requirement: !ruby/object:Gem::Requirement
133
- none: false
134
118
  requirements:
135
119
  - - ~>
136
120
  - !ruby/object:Gem::Version
@@ -138,7 +122,6 @@ dependencies:
138
122
  type: :development
139
123
  prerelease: false
140
124
  version_requirements: !ruby/object:Gem::Requirement
141
- none: false
142
125
  requirements:
143
126
  - - ~>
144
127
  - !ruby/object:Gem::Version
@@ -146,7 +129,6 @@ dependencies:
146
129
  - !ruby/object:Gem::Dependency
147
130
  name: rails
148
131
  requirement: !ruby/object:Gem::Requirement
149
- none: false
150
132
  requirements:
151
133
  - - ~>
152
134
  - !ruby/object:Gem::Version
@@ -154,7 +136,6 @@ dependencies:
154
136
  type: :development
155
137
  prerelease: false
156
138
  version_requirements: !ruby/object:Gem::Requirement
157
- none: false
158
139
  requirements:
159
140
  - - ~>
160
141
  - !ruby/object:Gem::Version
@@ -207,6 +188,7 @@ files:
207
188
  - test/test_helper.rb
208
189
  - test/unit/qme/bundle/eh_measure_sheet_test.rb
209
190
  - test/unit/qme/bundle/eh_patient_importer_test.rb
191
+ - test/unit/qme/map/cv_aggregator_test.rb
210
192
  - test/unit/qme/map/map_reduce_builder_test.rb
211
193
  - test/unit/qme/map/map_reduce_executor_test.rb
212
194
  - test/unit/qme/map/measure_calculation_job_test.rb
@@ -214,27 +196,26 @@ files:
214
196
  - test/unit/qme/quality_report_test.rb
215
197
  homepage: http://www.projectpophealth.org
216
198
  licenses: []
199
+ metadata: {}
217
200
  post_install_message:
218
201
  rdoc_options: []
219
202
  require_paths:
220
203
  - lib
221
204
  required_ruby_version: !ruby/object:Gem::Requirement
222
- none: false
223
205
  requirements:
224
206
  - - ! '>='
225
207
  - !ruby/object:Gem::Version
226
208
  version: '0'
227
209
  required_rubygems_version: !ruby/object:Gem::Requirement
228
- none: false
229
210
  requirements:
230
211
  - - ! '>='
231
212
  - !ruby/object:Gem::Version
232
213
  version: '0'
233
214
  requirements: []
234
215
  rubyforge_project:
235
- rubygems_version: 1.8.25
216
+ rubygems_version: 2.1.3
236
217
  signing_key:
237
- specification_version: 3
218
+ specification_version: 4
238
219
  summary: This library can run JavaScript based clinical quality measures on a repository
239
220
  of patients stored in MongoDB
240
221
  test_files:
@@ -259,6 +240,7 @@ test_files:
259
240
  - test/test_helper.rb
260
241
  - test/unit/qme/bundle/eh_measure_sheet_test.rb
261
242
  - test/unit/qme/bundle/eh_patient_importer_test.rb
243
+ - test/unit/qme/map/cv_aggregator_test.rb
262
244
  - test/unit/qme/map/map_reduce_builder_test.rb
263
245
  - test/unit/qme/map/map_reduce_executor_test.rb
264
246
  - test/unit/qme/map/measure_calculation_job_test.rb