quality-measure-engine 2.5.2 → 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWIwOWQ5NDlkZjk1NjM2MDhlOWJmMzY5MzZlNjA3NGE5MjNkYTAzMg==
4
+ NzQxMzZjMGM5NTAxM2Q0OWM1NjZhN2U4ZWY2YzQ4NzEzYThkZjc3YQ==
5
5
  data.tar.gz: !binary |-
6
- YjQ5MTUyYTZlMWJkM2ViOGQyYTQ2MDA2MmExNWE3N2FlOGFlNDNlZQ==
6
+ MjljNTk1NDBkNTFiYjY1M2ZjM2ZiM2QyNGY5MjE0YzhmZGIwZmEzOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTA1ODcwODdmOTM4MDJmZjdiYTkzYzc1NjFlYTZjNWViNDg4YzhlNDU3M2Nh
10
- ZGJkZTQyZDQzODhjMmEzNTgzN2FlZGI3Y2U3YThiZTBlMDYxODA0YTcyNGQ4
11
- M2VmN2Y5YTMzMjZlOGQwZDkzYzRkZjAyYzlkYjgxMjAwNTFjNzI=
9
+ MWE3YTAwMTFlMzBiMzc2ODgyZWVhYTRhNGY5NTQ0MmNmNDkwMjVjODI3ZTg2
10
+ MzM4MjYwY2RmNzc4NDVhZTViZGVlMzI5YWMyYTVhNzdhZjhhNTI4ZWU1MjIy
11
+ Y2M3ZDI1Yjc5ZDgzMDcwMzNmZTA2ZGU0NjEzOWI0MTFmN2E5NzQ=
12
12
  data.tar.gz: !binary |-
13
- NjNlMjhhOTNhYjVhNjk0ZjgxNWEyZjgzMmM4MmZlNzg3MjYyNDM5NjhmY2Nj
14
- NTgzNDllMGJjN2U3MTZhZDQ5YWViZTQ3MWJhZGUyZmQ3NTZiOTgwMWExYTMx
15
- NzJhOWM0OTU2YzFmZDkyM2U3YzFlNTQ3YzliY2UyMmMzOTA5ZjQ=
13
+ ZjQ4ODgxN2ExMDQwYzgzMDY2MDMyMTg3ZTU3ZTEyNWZlY2I2Zjg3ZDNjYWFl
14
+ MmFlYzE5NjM4MjZhNDExNzAyNzliMDFhYTBlOTc0ZWNiMDU5NGYwNmM5MjI2
15
+ YjAxZmIxN2U5M2IxMTEwMjgxZGRhY2JjODIxY2RkMmNiNDQyOWE=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- quality-measure-engine (2.5.2)
4
+ quality-measure-engine (2.5.3)
5
5
  delayed_job_mongoid (~> 2.0.0)
6
6
  mongoid (~> 3.1.4)
7
7
  moped (~> 1.5.1)
@@ -19,7 +19,7 @@ module QME
19
19
  @measure_id = measure_id
20
20
  @sub_id = sub_id
21
21
  @parameter_values = parameter_values
22
- @measure_def = QualityMeasure.new(@measure_id, @sub_id).definition
22
+ @measure_def = QualityMeasure.new(@measure_id, @sub_id, parameter_values['bundle_id']).definition
23
23
  determine_connection_information()
24
24
  end
25
25
 
@@ -6,10 +6,10 @@ module QME
6
6
 
7
7
  # Return a list of the measures in the database
8
8
  # @return [Hash] an hash of measure definitions
9
- def self.all
9
+ def self.all(bundle_id = nil)
10
10
  result = {}
11
- measures = get_db()['measures']
12
- measures.find().each do |measure|
11
+ measures = query_measures({}, bundle_id)
12
+ measures.find_all.each do |measure|
13
13
  id = measure['id']
14
14
  sub_id = measure['sub_id']
15
15
  measure_id = "#{id}#{sub_id}.json"
@@ -18,36 +18,44 @@ module QME
18
18
  result
19
19
  end
20
20
 
21
- def self.get_measures(measure_ids)
22
- get_db()['measures'].find('id' => {"$in" => measure_ids})
21
+ def self.get_measures(measure_ids, bundle_id = nil)
22
+ query_measures({'id' => {"$in" => measure_ids}}, bundle_id)
23
23
  end
24
24
 
25
- def self.get(measure_id, sub_id)
26
- get_db()['measures'].find('id' => measure_id, 'sub_id' => sub_id)
25
+ def self.get(measure_id, sub_id, bundle_id = nil)
26
+ query_measures({'id' => measure_id, 'sub_id' => sub_id}, bundle_id)
27
27
  end
28
28
 
29
- def self.sub_measures(measure_id)
30
- get_db()['measures'].find('id' => measure_id)
29
+ def self.sub_measures(measure_id, bundle_id = nil)
30
+ query_measures({'id' => measure_id}, bundle_id)
31
31
  end
32
32
 
33
33
  # Creates a new QualityMeasure
34
34
  # @param [String] measure_id value of the measure's id field
35
35
  # @param [String] sub_id value of the measure's sub_id field, may be nil for measures with only a single numerator and denominator
36
- def initialize(measure_id, sub_id = nil)
36
+ def initialize(measure_id, sub_id = nil, bundle_id = nil)
37
37
  @measure_id = measure_id
38
38
  @sub_id = sub_id
39
+ @bundle_id = bundle_id
39
40
  determine_connection_information
40
41
  end
41
42
 
42
43
  # Retrieve a measure definition from the database
43
44
  # @return [Hash] a JSON hash of the encoded measure
44
45
  def definition
45
- measures = get_db()['measures']
46
46
  if @sub_id
47
- measures.find({'id' => @measure_id, 'sub_id' => @sub_id}).first()
47
+ QME::QualityMeasure.query_measures({'id' => @measure_id, 'sub_id' => @sub_id}, @bundle_id).first()
48
48
  else
49
- measures.find({'id' => @measure_id}).first()
49
+ QME::QualityMeasure.query_measures({'id' => @measure_id}, @bundle_id).first()
50
50
  end
51
51
  end
52
+
53
+ # Build measure collection query. Allows scoping of query to a single bundle
54
+ # @param [String] criteria Moped query hash
55
+ # @param [String] bundle_id the MongoDB id of the bundle to scope the query against. Leaving this as nil will scope to all bundles
56
+ def self.query_measures(criteria, bundle_id=nil)
57
+ criteria = bundle_id ? criteria.merge!({'bundle_id' => bundle_id}): criteria
58
+ get_db()['measures'].find(criteria)
59
+ end
52
60
  end
53
61
  end
data/lib/qme/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module QME
2
- VERSION = "2.5.2"
2
+ VERSION = "2.5.3"
3
3
  end
@@ -96,4 +96,16 @@ class MapReduceExecutorTest < MiniTest::Unit::TestCase
96
96
  assert_equal 0, get_db['patient_cache'].find().count
97
97
  assert result[QME::QualityReport::NUMERATOR]
98
98
  end
99
+
100
+ def test_get_patient_result_with_bundle_id
101
+ measure_id = "2E679CD2-3FEC-4A75-A75A-61403E5EFEE8"
102
+ bundle_id = get_db()['bundles'].find.first
103
+ get_db()['measures'].find('id' => measure_id).update(:$set => {'bundle_id' => bundle_id})
104
+ executor = QME::MapReduce::Executor.new(measure_id, nil,
105
+ 'effective_date' => Time.gm(2011, 1, 15).to_i, 'bundle_id' => bundle_id)
106
+ result = executor.get_patient_result("12345")
107
+ assert_equal 0, get_db['patient_cache'].find().count
108
+ assert result[QME::QualityReport::NUMERATOR]
109
+ end
110
+
99
111
  end
@@ -2,16 +2,52 @@ require 'test_helper'
2
2
 
3
3
  class QualityMeasureTest < MiniTest::Unit::TestCase
4
4
  include QME::DatabaseAccess
5
- def setup
6
5
 
6
+ def setup
7
7
  collection_fixtures(get_db(), 'measures')
8
8
  collection_fixtures(get_db(), 'bundles')
9
+ @bundle_id = get_db['bundles'].find.first['_id']
10
+ get_db['measures'].find({}).update(:$set => {'bundle_id' => @bundle_id})
9
11
  load_system_js
10
12
  end
11
13
 
12
- def test_getting_all_measures
14
+ def test_getting_all_measures_without_bundle_id
13
15
  all_measures = QME::QualityMeasure.all
14
16
  assert_equal 5, all_measures.size
17
+
15
18
  assert all_measures["2E679CD2-3FEC-4A75-A75A-61403E5EFEE8.json"]
16
19
  end
20
+
21
+ def test_getting_definition_with_bundle_id
22
+ result = QME::QualityMeasure.all(@bundle_id).to_a.first.last
23
+ measure = QME::QualityMeasure.new(result['id'], result['sub_id'], @bundle_id)
24
+ assert measure.definition
25
+ assert_equal result['id'], measure.definition['id']
26
+ end
27
+
28
+ def test_getting_all_measure_with_bundle_id
29
+ get_db()['measures']
30
+ all_measures = QME::QualityMeasure.all(@bundle_id)
31
+
32
+ assert_equal 1, all_measures.size
33
+ end
34
+
35
+ def test_getting_measure_subset
36
+ measure_ids = get_db['measures'].find({}).map { |m| m['id'] }
37
+ measure_ids.pop
38
+ measures = QME::QualityMeasure.get_measures(measure_ids)
39
+ measure_ids2 = measures.map { |m| m['id'] }
40
+ assert_equal [], measure_ids - measure_ids2
41
+ end
42
+
43
+ def test_getting_sub_measures
44
+ measures = QME::QualityMeasure.sub_measures("8A4D92B2-3887-5DF3-0139-0C4E41594C98")
45
+ assert_equal 2, measures.count
46
+ end
47
+
48
+ def test_getting_sub_measure
49
+ measure = QME::QualityMeasure.get("8A4D92B2-3887-5DF3-0139-0C4E41594C98", 'a')
50
+ assert measure
51
+ end
52
+
17
53
  end
metadata CHANGED
@@ -1,7 +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.2
4
+ version: 2.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc Hadley
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-11-08 00:00:00.000000000 Z
15
+ date: 2013-12-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: moped