qpp_measure_data_client 2.0.4
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 +7 -0
- data/README.md +88 -0
- data/lib/qpp_measure_data_client/client.rb +13 -0
- data/lib/qpp_measure_data_client/exceptions.rb +34 -0
- data/lib/qpp_measure_data_client/measures/client.rb +82 -0
- data/lib/qpp_measure_data_client/measures/e_measure_uuid.rb +20 -0
- data/lib/qpp_measure_data_client/measures/measure.rb +86 -0
- data/lib/qpp_measure_data_client/measures/measures.rb +37 -0
- data/lib/qpp_measure_data_client/measures/stratum.rb +28 -0
- data/lib/qpp_measure_data_client/version.rb +5 -0
- data/lib/qpp_measure_data_client.rb +8 -0
- data/spec/qpp_measure_data_client/measures/client_spec.rb +71 -0
- data/spec/qpp_measure_data_client/measures/e_measure_uuid_spec.rb +21 -0
- data/spec/qpp_measure_data_client/measures/measure_spec.rb +48 -0
- data/spec/qpp_measure_data_client/measures/measures_spec.rb +45 -0
- data/spec/qpp_measure_data_client/measures/stratum_spec.rb +20 -0
- data/spec/qpp_measure_data_client_spec.rb +9 -0
- data/spec/spec_helper.rb +16 -0
- metadata +61 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 7dc242897c9d29f79b236ca549387cacdcd33d4367f517f557680e0c9665a332
|
|
4
|
+
data.tar.gz: aeeebcfee7590887392d66a1eb10bf33f3e1711ce4fbed0c1d99b7d693db32ad
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 26cef00e8daef88f7dbfd21b1ee80da28febd1a547d56eaf30473bd9fdb92c41822a6b51221b1fd9b1d76626bdd57e17b81cbb48ee113cf5d5553881f840220f
|
|
7
|
+
data.tar.gz: e1f012eb4c552d0d3163400fe74f8dcc40f26a4d795bf958691466bedc95b4e97d3126bbb952f6498cb9eafe6e1cc5937c6846239705ec45555880a97f278a76
|
data/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# QppMeasureDataClient
|
|
2
|
+
|
|
3
|
+
QppMeasureDataClient provides a Ruby client for interacting with [QPP Measure Data](https://github.com/CMSgov/qpp-measures-data/blob/master/README.md)
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'qpp_measure_data_client'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install qpp_measure_data_client
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Create the folder structure under your application `config/qpp_measures_data/measures`
|
|
24
|
+
|
|
25
|
+
1) Service Client
|
|
26
|
+
|
|
27
|
+
The service client should be created as follows:
|
|
28
|
+
|
|
29
|
+
QppMeasureDataClient::Measures::Client.new
|
|
30
|
+
|
|
31
|
+
### Example
|
|
32
|
+
```bash
|
|
33
|
+
$ bin/console
|
|
34
|
+
```
|
|
35
|
+
```ruby
|
|
36
|
+
2.4.1 :001 > client = QppMeasureDataClient::Measures::Client.new
|
|
37
|
+
=> #<QppMeasureDataClient::Measures::Client:0x007f87e8f97780 @source="./qpp_measure_data_client/config/qpp_measures_data/measures">
|
|
38
|
+
|
|
39
|
+
2.4.1 :002 > client.get_measure('2017', {measureId: 'ACI_INFBLO_1'})
|
|
40
|
+
=> #<QppMeasureDataClient::Measures::Measure:0x007fd93fa71fa0 @category="aci", @cehrtEligible=nil, @description="I have not knowingly and willfully take action to limit or restrict the interoperability of certified EHR technology.\nI have responded to requests to retrieve or exchange information—including requests from patients and other health care providers regardless of the requestor's affiliation or technology.\nI have implemented appropriate standards and processes to ensure that its certified EHR technology was connected in accordance with applicable law and standards, allowed patients timely access to their electronic health information; and supported exchange of electronic health information with other health care providers.", @eMeasureId=nil, @firstPerformanceYear=2017, @isBonus=false, @isHighPriority=nil, @isInverse=nil, @isRiskAdjusted=nil, @isRequired=true, @isRegistryMeasure=nil, @lastPerformanceYear=nil, @measureId="ACI_INFBLO_1", @measureType=nil, @metricType="boolean", @nationalQualityStrategyDomain=nil, @nqfEMeasureId=nil, @nqfId=nil, @objective=nil, @overallAlgorithm=nil, @primarySteward=nil, @reportingCategory="preAttestation", @subcategoryId=nil, @title="Prevention of Information Blocking Attestation", @weight=0, @measureSets=[], @strata=[], @substitutes=[], @submissionMethods=[]>
|
|
41
|
+
|
|
42
|
+
2.4.1 :003 > client.get_measures('2017', {}, )
|
|
43
|
+
=> [#<QppMeasureDataClient::Measures::Measure:0x007fdcc3522d60 @category="ia", @cehrtEligible=false, @description="I attest that I am a Patient Centered Medical Home (PCMH) or Comparable Specialty Practice that has achieved certification from a national program, regional or state program, private payer, or other body that administers patient-centered medical home accreditation and should receive full credit for the Improvement Activities performance category.", @eMeasureId=nil, @firstPerformanceYear=2017, @isBonus=nil, @isHighPriority=nil, @isInverse=nil, @isRiskAdjusted=nil, @isRequired=nil, @isRegistryMeasure=nil, @lastPerformanceYear=nil, @measureId="IA_PCMH", @measureType=nil, @metricType="boolean", @nationalQualityStrategyDomain=nil, @nqfEMeasureId=nil, @nqfId=nil, @objective=nil, @overallAlgorithm=nil, @primarySteward=nil, @reportingCategory=nil, @subcategoryId=nil, @title="Patient Centered Medical Home Attestation", @weight=nil, @measureSets=[], @strata=[], @substitutes=[], @submissionMethods=[]>]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
****
|
|
47
|
+
|
|
48
|
+
## Development
|
|
49
|
+
|
|
50
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
51
|
+
|
|
52
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](http://repo.release.cerner.corp/main/rubygems/).
|
|
53
|
+
|
|
54
|
+
## Release
|
|
55
|
+
|
|
56
|
+
1. Draft a [new release](https://github.cerner.com/healtheintent/qpp_measure_data_client/releases/new), add changelog in details, release version in Tag version and Release Title.
|
|
57
|
+
|
|
58
|
+
2. After creating release, Gary will start to build and release artifact automatically. You can check build status alongside your latest commit on following URL
|
|
59
|
+
|
|
60
|
+
`https://github.cerner.com/healtheintent/qpp_measure_data_client/commits/<release version>`
|
|
61
|
+
|
|
62
|
+
For example, on [commit history](https://github.cerner.com/healtheintent/qpp_measure_data_client/commits/1.5.0) for tag 1.5.0, green tick on latest commit implies successful Gary build. To get more information, follow the dialog by hovering on the tick.
|
|
63
|
+
|
|
64
|
+
3. After build is successful, Raise a PR to increase the VERSION variable in `lib/qpp_measure_data_client/version.rb` file to next version.
|
|
65
|
+
|
|
66
|
+
**NOTE - Do not use a SNAPSHOT version because HealtheIntent does not maintain SNAPSHOT Ruby artifacts.**
|
|
67
|
+
|
|
68
|
+
4. Create a new jira version for next release by
|
|
69
|
+
|
|
70
|
+
`rigm release create_jira_version -r <Next Release Version>`
|
|
71
|
+
|
|
72
|
+
5. Create a release review JIRA for next release
|
|
73
|
+
|
|
74
|
+
`rigm release create_release_review -r <Next Release Version>`
|
|
75
|
+
|
|
76
|
+
6. Update the Jiras and Jira fix version to reflect the release is done.
|
|
77
|
+
|
|
78
|
+
`rigm release jiras -r <released_version>`
|
|
79
|
+
|
|
80
|
+
`rigm release jira_version -r <released_version>`
|
|
81
|
+
|
|
82
|
+
7. You can confirm release on [Cernerrepos Dashboard](https://cernerrepos.net/ui/packages/rubygems:%2F%2Fqpp_measure_data_client?name=qpp_measure_data_client&type=packages).
|
|
83
|
+
|
|
84
|
+
References - [Releasing Ruby Projects](https://github.cerner.com/healtheintent/architectures/blob/master/rfd/0070/README.md)
|
|
85
|
+
|
|
86
|
+
## Contributing
|
|
87
|
+
|
|
88
|
+
Branch first before doing any new work, and don't forget to follow the [Jira guideline](https://wiki.ucern.com/display/pophealth/JIRA+Guidance#JIRAGuidance)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'qpp_measure_data_client/measures/client'
|
|
4
|
+
|
|
5
|
+
module QppMeasureDataClient
|
|
6
|
+
# Client class to return measures client object
|
|
7
|
+
class Client
|
|
8
|
+
# Public: retrieves measure client object
|
|
9
|
+
def self.measures_client
|
|
10
|
+
QppMeasureDataClient::Measures::Client.new
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module QppMeasureDataClient
|
|
4
|
+
module Exceptions
|
|
5
|
+
# Public: Base exception for all errors in this module.
|
|
6
|
+
class QppMeasureDataClientError < StandardError; end
|
|
7
|
+
|
|
8
|
+
# Error Class to throw error when file is not found
|
|
9
|
+
class FileNotFound < QppMeasureDataClientError
|
|
10
|
+
attr_reader :path
|
|
11
|
+
|
|
12
|
+
# Public: Throws a custom error message when file is not found, with path included in message.
|
|
13
|
+
#
|
|
14
|
+
# path - File path.
|
|
15
|
+
def initialize(path)
|
|
16
|
+
@path = path
|
|
17
|
+
super("File not found: #{@path}")
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Error Class to throw error when file format is not known
|
|
22
|
+
class UnknownFormat < QppMeasureDataClientError
|
|
23
|
+
attr_reader :format
|
|
24
|
+
|
|
25
|
+
# Public: Throws a custom error message when file format is not found, with format included in message.
|
|
26
|
+
#
|
|
27
|
+
# format - File format
|
|
28
|
+
def initialize(format)
|
|
29
|
+
@format = format
|
|
30
|
+
super("Unknown format: #{@format}")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'qpp_measure_data_client/measures/measures'
|
|
5
|
+
require 'qpp_measure_data_client/exceptions'
|
|
6
|
+
|
|
7
|
+
module QppMeasureDataClient
|
|
8
|
+
module Measures
|
|
9
|
+
# Client class containing methods required to generate measures from file data.
|
|
10
|
+
class Client
|
|
11
|
+
include Measures
|
|
12
|
+
|
|
13
|
+
attr_reader :source
|
|
14
|
+
|
|
15
|
+
# Public: Initializes config and source.
|
|
16
|
+
def initialize(config = {})
|
|
17
|
+
config = defaults.merge(symbolize(config))
|
|
18
|
+
|
|
19
|
+
@source = config[:source]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
# Read the list of QPPmeasures for a given performance period as path.
|
|
25
|
+
#
|
|
26
|
+
# resource: File name to read qpp measures data from
|
|
27
|
+
# scope: Directory name to append to source path
|
|
28
|
+
#
|
|
29
|
+
# Returns a list of QPPmeaures
|
|
30
|
+
def read(resource, scope: nil)
|
|
31
|
+
path = source
|
|
32
|
+
path = File.join(path, scope.to_s) if scope
|
|
33
|
+
path = File.join(path, "#{resource}.json")
|
|
34
|
+
|
|
35
|
+
raise QppMeasureDataClient::Exceptions::FileNotFound, path unless File.exist?(path)
|
|
36
|
+
|
|
37
|
+
JSON.parse(ERB.new(File.read(path)).result)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Search the list of QPPmeasures for a given performance period and query.
|
|
41
|
+
#
|
|
42
|
+
# resource: File name to read qpp measures data from
|
|
43
|
+
# scope: Directory name to append to source path
|
|
44
|
+
# query: A hash and an optional parameter (eg. { measureId: 'ACI_INFBLO_1' })
|
|
45
|
+
#
|
|
46
|
+
# Returns a list of QPPmeaures
|
|
47
|
+
def search(resource, scope: nil, query: nil)
|
|
48
|
+
query = stringify(query)
|
|
49
|
+
|
|
50
|
+
records = read(resource, scope: scope)
|
|
51
|
+
|
|
52
|
+
return records if query.empty?
|
|
53
|
+
|
|
54
|
+
return records.find { |record| record['id'] == query } unless query.respond_to? :values_at
|
|
55
|
+
|
|
56
|
+
records.select do |record|
|
|
57
|
+
query.all? do |key, value|
|
|
58
|
+
record[key].casecmp(value).zero?
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def symbolize(value)
|
|
64
|
+
return value.to_sym unless value.respond_to? :keys
|
|
65
|
+
|
|
66
|
+
value.symbolize_keys
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def stringify(value)
|
|
70
|
+
return value.to_s unless value.respond_to? :keys
|
|
71
|
+
|
|
72
|
+
value.stringify_keys
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def defaults
|
|
76
|
+
{
|
|
77
|
+
source: File.expand_path('config/qpp_measures_data/measures')
|
|
78
|
+
}
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module QppMeasureDataClient
|
|
4
|
+
module Measures
|
|
5
|
+
# EMeasureUuid class to convert provided hash into a EMeasureUuid object.
|
|
6
|
+
class EMeasureUuid
|
|
7
|
+
attr_accessor :initialPopulationUuid, :denominatorUuid, :numeratorUuid, :denominatorExclusionUuid
|
|
8
|
+
|
|
9
|
+
# Internal: Initialize assigning values to instance variables from the given hash.
|
|
10
|
+
#
|
|
11
|
+
# e_measure_uuid: A hash containing values for a EMeasureUuid.
|
|
12
|
+
def initialize(e_measure_uuid)
|
|
13
|
+
@initialPopulationUuid = e_measure_uuid[:initialPopulationUuid]
|
|
14
|
+
@denominatorUuid = e_measure_uuid[:denominatorUuid]
|
|
15
|
+
@numeratorUuid = e_measure_uuid[:numeratorUuid]
|
|
16
|
+
@denominatorExclusionUuid = e_measure_uuid[:denominatorExclusionUuid]
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'qpp_measure_data_client/measures/stratum'
|
|
4
|
+
|
|
5
|
+
module QppMeasureDataClient
|
|
6
|
+
module Measures
|
|
7
|
+
# Measure class to convert provided hash into a Measure object.
|
|
8
|
+
class Measure
|
|
9
|
+
attr_accessor :category,
|
|
10
|
+
:cehrtEligible,
|
|
11
|
+
:description,
|
|
12
|
+
:eMeasureId,
|
|
13
|
+
:firstPerformanceYear,
|
|
14
|
+
:isBonus,
|
|
15
|
+
:isHighPriority,
|
|
16
|
+
:isInverse,
|
|
17
|
+
:isRiskAdjusted,
|
|
18
|
+
:isRequired,
|
|
19
|
+
:isRegistryMeasure,
|
|
20
|
+
:lastPerformanceYear,
|
|
21
|
+
:measureId,
|
|
22
|
+
:measureType,
|
|
23
|
+
:metricType,
|
|
24
|
+
:nationalQualityStrategyDomain,
|
|
25
|
+
:nqfEMeasureId,
|
|
26
|
+
:nqfId,
|
|
27
|
+
:objective,
|
|
28
|
+
:overallAlgorithm,
|
|
29
|
+
:primarySteward,
|
|
30
|
+
:preprod,
|
|
31
|
+
:reportingCategory,
|
|
32
|
+
:subcategoryId,
|
|
33
|
+
:title,
|
|
34
|
+
:exclusion,
|
|
35
|
+
:weight,
|
|
36
|
+
:measureSets,
|
|
37
|
+
:strata,
|
|
38
|
+
:substitutes,
|
|
39
|
+
:submissionMethods
|
|
40
|
+
|
|
41
|
+
# Internal: Initialize assigning values to instance variables from the given hash.
|
|
42
|
+
#
|
|
43
|
+
# measure: A hash containing values for a Measure.
|
|
44
|
+
def initialize(measure)
|
|
45
|
+
@category = measure[:category]
|
|
46
|
+
@cehrtEligible = measure[:cehrtEligible]
|
|
47
|
+
@description = measure[:description]
|
|
48
|
+
@eMeasureId = measure[:eMeasureId]
|
|
49
|
+
@firstPerformanceYear = measure[:firstPerformanceYear]
|
|
50
|
+
@isBonus = measure[:isBonus]
|
|
51
|
+
@isHighPriority = measure[:isHighPriority]
|
|
52
|
+
@isInverse = measure[:isInverse]
|
|
53
|
+
@isRiskAdjusted = measure[:isRiskAdjusted]
|
|
54
|
+
@isRequired = measure[:isRequired]
|
|
55
|
+
@isRegistryMeasure = measure[:isRegistryMeasure]
|
|
56
|
+
@lastPerformanceYear = measure[:lastPerformanceYear]
|
|
57
|
+
@measureId = measure[:measureId]
|
|
58
|
+
@measureType = measure[:measureType]
|
|
59
|
+
@metricType = measure[:metricType]
|
|
60
|
+
@nationalQualityStrategyDomain = measure[:nationalQualityStrategyDomain]
|
|
61
|
+
@nqfEMeasureId = measure[:nqfEMeasureId]
|
|
62
|
+
@nqfId = measure[:nqfId]
|
|
63
|
+
@objective = measure[:objective]
|
|
64
|
+
@overallAlgorithm = measure[:overallAlgorithm]
|
|
65
|
+
@primarySteward = measure[:primarySteward]
|
|
66
|
+
@preprod = measure[:preprod] || []
|
|
67
|
+
@reportingCategory = measure[:reportingCategory]
|
|
68
|
+
@subcategoryId = measure[:subcategoryId]
|
|
69
|
+
@title = measure[:title]
|
|
70
|
+
@exclusion = measure[:exclusion]
|
|
71
|
+
@weight = measure[:weight]
|
|
72
|
+
@measureSets = measure[:measureSets].nil? ? [] : measure[:measureSets]
|
|
73
|
+
@strata =
|
|
74
|
+
if measure[:strata].nil?
|
|
75
|
+
[]
|
|
76
|
+
else
|
|
77
|
+
measure[:strata].map do |strata|
|
|
78
|
+
QppMeasureDataClient::Measures::Stratum.new(strata.with_indifferent_access)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
@substitutes = measure[:substitutes].nil? ? [] : measure[:substitutes]
|
|
82
|
+
@submissionMethods = measure[:submissionMethods].nil? ? [] : measure[:submissionMethods]
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'active_support/all'
|
|
4
|
+
|
|
5
|
+
module QppMeasureDataClient
|
|
6
|
+
module Measures
|
|
7
|
+
# Measures module contains method to generate measure list and measure from qpp_measure_data files
|
|
8
|
+
module Measures
|
|
9
|
+
# Gets the list of measures for a given performance period and query parameters.
|
|
10
|
+
#
|
|
11
|
+
# query: A hash and an optional parameter (eg. { measureId: 'ACI_INFBLO_1' })
|
|
12
|
+
# performance_year: The performance year. It is a required parameter
|
|
13
|
+
#
|
|
14
|
+
# Returns a list of meaures
|
|
15
|
+
def get_measures(performance_year, query = {})
|
|
16
|
+
raise ArgumentError, 'Must pass performance period' unless performance_year.present?
|
|
17
|
+
|
|
18
|
+
results = search('measures-data', scope: performance_year, query: query)
|
|
19
|
+
results.map do |measure_data|
|
|
20
|
+
Measure.new(measure_data.with_indifferent_access)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Gets a measure for a given performance period and query parameters.
|
|
25
|
+
#
|
|
26
|
+
# query: A hash and an optional parameter (eg. { measureId: 'ACI_INFBLO_1' })
|
|
27
|
+
# performance_year: The performance year. It is a required parameter
|
|
28
|
+
#
|
|
29
|
+
# Returns a meaure
|
|
30
|
+
def get_measure(performance_year, query = {})
|
|
31
|
+
raise ArgumentError, 'Must pass performance period' unless performance_year.present?
|
|
32
|
+
|
|
33
|
+
Measure.new(search('measures-data', scope: performance_year, query: query).first.with_indifferent_access)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'qpp_measure_data_client/measures/e_measure_uuid'
|
|
4
|
+
|
|
5
|
+
module QppMeasureDataClient
|
|
6
|
+
module Measures
|
|
7
|
+
# Stratum class to convert provided hash into a Stratum object.
|
|
8
|
+
class Stratum
|
|
9
|
+
attr_accessor :name, :description, :eMeasureUuids
|
|
10
|
+
|
|
11
|
+
# Internal: Initialize assigning values to instance variables from the given hash.
|
|
12
|
+
#
|
|
13
|
+
# stratum: A hash containing values for a Strata.
|
|
14
|
+
def initialize(stratum)
|
|
15
|
+
@name = stratum[:name]
|
|
16
|
+
@description = stratum[:description]
|
|
17
|
+
@eMeasureUuids =
|
|
18
|
+
if stratum[:eMeasureUuids].nil?
|
|
19
|
+
nil
|
|
20
|
+
else
|
|
21
|
+
QppMeasureDataClient::Measures::EMeasureUuid.new(
|
|
22
|
+
stratum[:eMeasureUuids].with_indifferent_access
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'qpp_measure_data_client/version'
|
|
4
|
+
require 'qpp_measure_data_client/measures/client'
|
|
5
|
+
require 'qpp_measure_data_client/measures/measure'
|
|
6
|
+
require 'qpp_measure_data_client/measures/stratum'
|
|
7
|
+
require 'qpp_measure_data_client/measures/e_measure_uuid'
|
|
8
|
+
require 'qpp_measure_data_client/client'
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe QppMeasureDataClient::Measures::Client do
|
|
6
|
+
let(:resource) { 'measures-data' }
|
|
7
|
+
let(:file_data) do
|
|
8
|
+
'[
|
|
9
|
+
{
|
|
10
|
+
"category": "ia",
|
|
11
|
+
"firstPerformanceYear": 2017,
|
|
12
|
+
"lastPerformanceYear": null,
|
|
13
|
+
"metricType": "boolean",
|
|
14
|
+
"measureId": "IA_PCMH",
|
|
15
|
+
"cehrtEligible": false,
|
|
16
|
+
"description": "mock_description",
|
|
17
|
+
"title": "mock_title",
|
|
18
|
+
"weight": null,
|
|
19
|
+
"subcategoryId": null
|
|
20
|
+
}
|
|
21
|
+
]'
|
|
22
|
+
end
|
|
23
|
+
let(:scope) { 2020 }
|
|
24
|
+
|
|
25
|
+
before do
|
|
26
|
+
allow(File).to receive(:exist?) { true }
|
|
27
|
+
allow(File).to receive(:read) { file_data }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe '#read' do
|
|
31
|
+
it 'returns Array of Hash' do
|
|
32
|
+
expect(QppMeasureDataClient::Measures::Client.new.send(:read, resource, scope: scope)).to be_an_instance_of(Array)
|
|
33
|
+
expect(
|
|
34
|
+
QppMeasureDataClient::Measures::Client.new.send(
|
|
35
|
+
:read,
|
|
36
|
+
resource,
|
|
37
|
+
scope: scope
|
|
38
|
+
).first
|
|
39
|
+
).to be_an_instance_of(Hash)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'raises FileNotFoundException' do
|
|
43
|
+
allow(File).to receive(:exist?) { false }
|
|
44
|
+
expect do
|
|
45
|
+
QppMeasureDataClient::Measures::Client.new.send(
|
|
46
|
+
:read,
|
|
47
|
+
resource
|
|
48
|
+
)
|
|
49
|
+
end.to raise_exception(QppMeasureDataClient::Exceptions::FileNotFound)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe '#search' do
|
|
54
|
+
it 'returns Array of Hash' do
|
|
55
|
+
expect(
|
|
56
|
+
QppMeasureDataClient::Measures::Client.new.send(
|
|
57
|
+
:search,
|
|
58
|
+
resource,
|
|
59
|
+
scope: scope
|
|
60
|
+
)
|
|
61
|
+
).to be_an_instance_of(Array)
|
|
62
|
+
expect(
|
|
63
|
+
QppMeasureDataClient::Measures::Client.new.send(
|
|
64
|
+
:search,
|
|
65
|
+
resource,
|
|
66
|
+
scope: scope
|
|
67
|
+
).first
|
|
68
|
+
).to be_an_instance_of(Hash)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe QppMeasureDataClient::Measures::EMeasureUuid do
|
|
6
|
+
let(:uuid) { QppMeasureDataClient::Measures::EMeasureUuid }
|
|
7
|
+
let(:data) do
|
|
8
|
+
{
|
|
9
|
+
initialPopulationUuid: 'mock_initialPopulationUuid',
|
|
10
|
+
denominatorUuid: 'mock_denominatorUuid',
|
|
11
|
+
numeratorUuid: 'mock_numeratorUuid',
|
|
12
|
+
denominatorExclusionUuid: 'mock_denominatorExclusionUuid'
|
|
13
|
+
}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe '#Initializing class' do
|
|
17
|
+
it 'returns e_measure_uuid' do
|
|
18
|
+
expect(QppMeasureDataClient::Measures::EMeasureUuid.new(data)).to be_an_instance_of(uuid)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe QppMeasureDataClient::Measures::Measure do
|
|
6
|
+
let(:measure) { QppMeasureDataClient::Measures::Measure }
|
|
7
|
+
let(:data) do
|
|
8
|
+
{
|
|
9
|
+
category: 'mock_category',
|
|
10
|
+
cehrtEligible: 'mock_cehrtEligible',
|
|
11
|
+
description: 'mock_description',
|
|
12
|
+
eMeasureId: 'mock_eMeasureId',
|
|
13
|
+
firstPerformanceYear: 'mock_firstPerformanceYear',
|
|
14
|
+
isBonus: 'mock_isBonus',
|
|
15
|
+
isHighPriority: 'mock_isHighPriority',
|
|
16
|
+
isInverse: 'mock_isInverse',
|
|
17
|
+
isRiskAdjusted: 'mock_isRiskAdjusted',
|
|
18
|
+
isRequired: 'mock_isRequired',
|
|
19
|
+
isRegistryMeasure: 'mock_isRegistryMeasure',
|
|
20
|
+
lastPerformanceYear: 'mock_lastPerformanceYear',
|
|
21
|
+
measureId: 'mock_measureId',
|
|
22
|
+
measureType: 'mock_measureType',
|
|
23
|
+
metricType: 'mock_metricType',
|
|
24
|
+
nationalQualityStrategyDomain: 'mock_nationalQualityStrategyDomain',
|
|
25
|
+
nqfEMeasureId: 'mock_nqfEMeasureId',
|
|
26
|
+
nqfId: 'mock_nqfId',
|
|
27
|
+
objective: 'mock_objective',
|
|
28
|
+
overallAlgorithm: 'mock_overallAlgorithm',
|
|
29
|
+
primarySteward: 'mock_primarySteward',
|
|
30
|
+
preprod: [],
|
|
31
|
+
reportingCategory: 'mock_reportingCategory',
|
|
32
|
+
subcategoryId: 'mock_subcategoryId',
|
|
33
|
+
title: 'mock_title',
|
|
34
|
+
exclusion: 'mock_exclusion',
|
|
35
|
+
weight: 'mock_weight',
|
|
36
|
+
measureSets: [],
|
|
37
|
+
strata: [],
|
|
38
|
+
substitutes: [],
|
|
39
|
+
submissionMethods: []
|
|
40
|
+
}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe '#Initializing class' do
|
|
44
|
+
it 'returns measure' do
|
|
45
|
+
expect(measure.new(data)).to be_an_instance_of(measure)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe QppMeasureDataClient::Measures::Measure do
|
|
6
|
+
let(:client) { QppMeasureDataClient::Client }
|
|
7
|
+
let(:measure_data) { QppMeasureDataClient::Measures::Measure }
|
|
8
|
+
let(:performance_year) { 2020 }
|
|
9
|
+
let(:file_data) do
|
|
10
|
+
'[
|
|
11
|
+
{
|
|
12
|
+
"category": "ia",
|
|
13
|
+
"firstPerformanceYear": 2017,
|
|
14
|
+
"lastPerformanceYear": null,
|
|
15
|
+
"metricType": "boolean",
|
|
16
|
+
"measureId": "IA_PCMH",
|
|
17
|
+
"cehrtEligible": false,
|
|
18
|
+
"description": "mock_description",
|
|
19
|
+
"title": "mock_title",
|
|
20
|
+
"weight": null,
|
|
21
|
+
"subcategoryId": null
|
|
22
|
+
}
|
|
23
|
+
]'
|
|
24
|
+
end
|
|
25
|
+
before do
|
|
26
|
+
allow(File).to receive(:exist?) { true }
|
|
27
|
+
allow(File).to receive(:read) { file_data }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe '#get_measure' do
|
|
31
|
+
it 'returns measure data' do
|
|
32
|
+
expect(client.measures_client.get_measure(performance_year)).to be_an_instance_of(measure_data)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
describe '#get_measures' do
|
|
37
|
+
it 'returns measure data list' do
|
|
38
|
+
expect(client.measures_client.get_measures(performance_year)).to be_an_instance_of(Array)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
it 'returns measure data list containing measures' do
|
|
42
|
+
expect(client.measures_client.get_measures(performance_year).first).to be_an_instance_of(measure_data)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe QppMeasureDataClient::Measures::Stratum do
|
|
6
|
+
let(:strata) { QppMeasureDataClient::Measures::Stratum }
|
|
7
|
+
let(:data) do
|
|
8
|
+
{
|
|
9
|
+
name: 'mock_name',
|
|
10
|
+
description: 'mock_description',
|
|
11
|
+
eMeasureUuids: nil
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe '#Initializing class' do
|
|
16
|
+
it 'returns strata' do
|
|
17
|
+
expect(QppMeasureDataClient::Measures::Stratum.new(data)).to be_an_instance_of(strata)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'qpp_measure_data_client'
|
|
5
|
+
|
|
6
|
+
RSpec.configure do |config|
|
|
7
|
+
# Enable flags like --only-failures and --next-failure
|
|
8
|
+
config.example_status_persistence_file_path = '.rspec_status'
|
|
9
|
+
|
|
10
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
|
11
|
+
config.disable_monkey_patching!
|
|
12
|
+
|
|
13
|
+
config.expect_with :rspec do |c|
|
|
14
|
+
c.syntax = :expect
|
|
15
|
+
end
|
|
16
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: qpp_measure_data_client
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 2.0.4
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- cerner
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2025-03-03 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: Models and client for QPP measure data
|
|
13
|
+
executables: []
|
|
14
|
+
extensions: []
|
|
15
|
+
extra_rdoc_files: []
|
|
16
|
+
files:
|
|
17
|
+
- README.md
|
|
18
|
+
- lib/qpp_measure_data_client.rb
|
|
19
|
+
- lib/qpp_measure_data_client/client.rb
|
|
20
|
+
- lib/qpp_measure_data_client/exceptions.rb
|
|
21
|
+
- lib/qpp_measure_data_client/measures/client.rb
|
|
22
|
+
- lib/qpp_measure_data_client/measures/e_measure_uuid.rb
|
|
23
|
+
- lib/qpp_measure_data_client/measures/measure.rb
|
|
24
|
+
- lib/qpp_measure_data_client/measures/measures.rb
|
|
25
|
+
- lib/qpp_measure_data_client/measures/stratum.rb
|
|
26
|
+
- lib/qpp_measure_data_client/version.rb
|
|
27
|
+
- spec/qpp_measure_data_client/measures/client_spec.rb
|
|
28
|
+
- spec/qpp_measure_data_client/measures/e_measure_uuid_spec.rb
|
|
29
|
+
- spec/qpp_measure_data_client/measures/measure_spec.rb
|
|
30
|
+
- spec/qpp_measure_data_client/measures/measures_spec.rb
|
|
31
|
+
- spec/qpp_measure_data_client/measures/stratum_spec.rb
|
|
32
|
+
- spec/qpp_measure_data_client_spec.rb
|
|
33
|
+
- spec/spec_helper.rb
|
|
34
|
+
homepage: http://github.cerner.com/healtheintent/qpp_measure_data_client
|
|
35
|
+
licenses: []
|
|
36
|
+
metadata: {}
|
|
37
|
+
rdoc_options: []
|
|
38
|
+
require_paths:
|
|
39
|
+
- lib
|
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: '3.0'
|
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '0'
|
|
50
|
+
requirements: []
|
|
51
|
+
rubygems_version: 3.6.3
|
|
52
|
+
specification_version: 4
|
|
53
|
+
summary: Models and client for QPP measure data
|
|
54
|
+
test_files:
|
|
55
|
+
- spec/qpp_measure_data_client/measures/client_spec.rb
|
|
56
|
+
- spec/qpp_measure_data_client/measures/e_measure_uuid_spec.rb
|
|
57
|
+
- spec/qpp_measure_data_client/measures/measure_spec.rb
|
|
58
|
+
- spec/qpp_measure_data_client/measures/measures_spec.rb
|
|
59
|
+
- spec/qpp_measure_data_client/measures/stratum_spec.rb
|
|
60
|
+
- spec/qpp_measure_data_client_spec.rb
|
|
61
|
+
- spec/spec_helper.rb
|