cqm-validators 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ci.yml +35 -0
- data/.overcommit.yml +2 -0
- data/.rubocop.yml +3 -1
- data/.simplecov +2 -0
- data/Gemfile +1 -1
- data/README.md +1 -0
- data/cqm_validators.gemspec +5 -3
- data/lib/cqm_validators/version.rb +1 -1
- data/lib/measure_validator.rb +1 -1
- data/lib/performance_rate_validator.rb +3 -0
- data/lib/reported_result_extractor.rb +20 -16
- data/lib/schematron/qrda/cat_1_r5_3/HL7 QRDA Category I STU 5.3.sch +3836 -0
- data/lib/schematron/qrda/cat_1_r5_3/voc.xml +1191 -0
- data/lib/schematron/qrda/cat_3_r1/HL7 QRDA Category III Release 1.sch +879 -0
- data/lib/schematron/qrda/cat_3_r1/voc.xml +704 -0
- data/lib/validators.rb +20 -0
- metadata +28 -19
- data/.travis.yml +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7f5aa4c4199a8fa00a964e8f791fff0518f3c1286425480d62e7e893c3259461
|
4
|
+
data.tar.gz: 7642850c6daf117dec474a52256801b1263ef0aeb78abcdf6d2bcb8378230431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6114df00a65a292b9e7248529175b238150eda867d1c1c4edfefdeb77400e4ded51f6d1ebec9fddd0985ecde65edef99e9b4c11d5c58b40d74ebbe638d6b0f2a
|
7
|
+
data.tar.gz: 8a1b7f742eb7107ab9ea3b0caa59935f0c8f47e084ce62262b206902464221f09aa45b62132effe697c17ef5231cc4fee07b6561d4b644bc352bec0d83af9566
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: Continuous Integration
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
- cqm_validators_2_x
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
build:
|
10
|
+
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version: [2.6, 2.5]
|
16
|
+
mongodb-version: [4.0.18, 4.4]
|
17
|
+
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- name: Use Ruby ${{ matrix.ruby-version }}
|
21
|
+
uses: ruby/setup-ruby@v1
|
22
|
+
with:
|
23
|
+
ruby-version: ${{ matrix.ruby-version }}
|
24
|
+
- name: Install dependencies
|
25
|
+
run: bundle install
|
26
|
+
- name: Start MongoDB
|
27
|
+
uses: supercharge/mongodb-github-action@1.3.0
|
28
|
+
with:
|
29
|
+
mongodb-version: ${{ matrix.mongodb-version }}
|
30
|
+
- name: Run overcommit
|
31
|
+
run: |
|
32
|
+
bundle exec overcommit --sign
|
33
|
+
bundle exec overcommit --run
|
34
|
+
- name: Run tests
|
35
|
+
run: bundle exec rake test
|
data/.overcommit.yml
CHANGED
@@ -7,6 +7,8 @@ PreCommit:
|
|
7
7
|
exclude: ['test/fixtures/**/*', 'lib/schema/**/*', 'lib/schematron/iso-schematron-xslt1/**/*', 'lib/schematron/iso-schematron-xslt2/**/*', 'lib/schematron/qrda/**/*']
|
8
8
|
AuthorName:
|
9
9
|
enabled: false
|
10
|
+
AuthorEmail:
|
11
|
+
enabled: false
|
10
12
|
CommitMsg:
|
11
13
|
RussianNovel:
|
12
14
|
enabled: true
|
data/.rubocop.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.4
|
3
3
|
Exclude:
|
4
4
|
- bin/*
|
5
5
|
Style/Documentation:
|
@@ -56,6 +56,8 @@ Metrics/CyclomaticComplexity:
|
|
56
56
|
Max: 10
|
57
57
|
Metrics/PerceivedComplexity:
|
58
58
|
Max: 10
|
59
|
+
Exclude:
|
60
|
+
- 'lib/reported_result_extractor.rb'
|
59
61
|
Naming/MethodParameterName:
|
60
62
|
Enabled: false
|
61
63
|
Style/DateTime:
|
data/.simplecov
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -25,6 +25,7 @@ Starting with version **2.0.0** released on 6/20/19, cqm-validators versioning h
|
|
25
25
|
| X | QRDA Cat 1 | QRDA Cat 3 |
|
26
26
|
| --- | --- | --- |
|
27
27
|
| 2 | R1 STU5.1 | R1 STU2.1 |
|
28
|
+
| 3 | R1 STU5.2 | R1 STU2.1 |
|
28
29
|
|
29
30
|
* **Y** indicates major changes (incompatible API changes)
|
30
31
|
|
data/cqm_validators.gemspec
CHANGED
@@ -22,7 +22,9 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.
|
25
|
+
spec.required_ruby_version = '>= 2.4.0'
|
26
|
+
|
27
|
+
spec.add_dependency 'nokogiri', '>= 1.8.5', '< 1.13.0'
|
26
28
|
|
27
29
|
spec.add_development_dependency 'bundler'
|
28
30
|
spec.add_development_dependency 'byebug'
|
@@ -30,6 +32,6 @@ Gem::Specification.new do |spec|
|
|
30
32
|
spec.add_development_dependency 'minitest-reporters'
|
31
33
|
spec.add_development_dependency 'mongoid'
|
32
34
|
spec.add_development_dependency 'overcommit'
|
33
|
-
spec.add_development_dependency 'rake', '
|
34
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
35
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
36
|
+
spec.add_development_dependency 'rubocop', '~> 0.93'
|
35
37
|
end
|
data/lib/measure_validator.rb
CHANGED
@@ -12,7 +12,7 @@ module CqmValidators
|
|
12
12
|
@errors = []
|
13
13
|
@doc = get_document(file)
|
14
14
|
@doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3')
|
15
|
-
measure_ids = CQM::Measure.
|
15
|
+
measure_ids = CQM::Measure.pluck(:hqmf_id)
|
16
16
|
doc_measure_ids = @doc.xpath(measure_selector).map(&:value).map(&:upcase)
|
17
17
|
# list of all of the set ids in the QRDA
|
18
18
|
doc_neutral_ids = @doc.xpath(neutral_measure_selector).map(&:value).map(&:upcase).sort
|
@@ -35,10 +35,13 @@ module CqmValidators
|
|
35
35
|
denexcep = 0
|
36
36
|
denom = 0
|
37
37
|
numer = 0
|
38
|
+
numex = 0
|
38
39
|
denex = reported_result['DENEX'] unless reported_result['DENEX'].nil?
|
39
40
|
denexcep = reported_result['DENEXCEP'] unless reported_result['DENEXCEP'].nil?
|
40
41
|
denom = reported_result['DENOM'] unless reported_result['DENOM'].nil?
|
41
42
|
numer = reported_result['NUMER'] unless reported_result['NUMER'].nil?
|
43
|
+
numex = reported_result['NUMEX'] unless reported_result['NUMEX'].nil?
|
44
|
+
numer -= numex
|
42
45
|
denom = denom - denex - denexcep
|
43
46
|
pr = if denom.zero?
|
44
47
|
'NA'
|
@@ -8,7 +8,7 @@ module CqmValidators
|
|
8
8
|
# returns nil if nothing matching is found
|
9
9
|
# returns a hash with the values of the populations filled out along with the population_ids added to the result
|
10
10
|
|
11
|
-
ALL_POPULATION_CODES = %w[IPP DENOM NUMER NUMEX DENEX DENEXCEP MSRPOPL MSRPOPLEX
|
11
|
+
ALL_POPULATION_CODES = %w[IPP DENOM NUMER NUMEX DENEX DENEXCEP MSRPOPL MSRPOPLEX].freeze
|
12
12
|
|
13
13
|
def extract_results_by_ids(measure, poulation_set_id, doc, stratification_id = nil)
|
14
14
|
results = nil
|
@@ -36,21 +36,14 @@ module CqmValidators
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def get_measure_components(n, population_set, stratification_id)
|
39
|
-
|
39
|
+
# observations are a hash of population/value. For example {"DENOM"=>108.0, "NUMER"=>2}
|
40
|
+
results = { supplemental_data: {}, observations: {} }
|
40
41
|
stratification = stratification_id ? population_set.stratifications.where(stratification_id: stratification_id).first.hqmf_id : nil
|
41
42
|
ALL_POPULATION_CODES.each do |pop_code|
|
42
|
-
next unless population_set.populations[pop_code]
|
43
|
+
next unless population_set.populations[pop_code]
|
43
44
|
|
44
|
-
|
45
|
-
sup =
|
46
|
-
if pop_code == 'OBSERV'
|
47
|
-
next unless population_set.populations['MSRPOPL']
|
48
|
-
|
49
|
-
msrpopl = population_set.populations['MSRPOPL']['hqmf_id']
|
50
|
-
val, sup = extract_cv_value(n, population_set.observations.first.hqmf_id, msrpopl, stratification)
|
51
|
-
else
|
52
|
-
val, sup, pr = extract_component_value(n, pop_code, population_set.populations[pop_code]['hqmf_id'], stratification)
|
53
|
-
end
|
45
|
+
get_observed_values(results, n, pop_code, population_set, stratification)
|
46
|
+
val, sup, pr = extract_component_value(n, pop_code, population_set.populations[pop_code]['hqmf_id'], stratification)
|
54
47
|
unless val.nil?
|
55
48
|
results[pop_code] = val
|
56
49
|
results[:supplemental_data][pop_code] = sup
|
@@ -60,8 +53,19 @@ module CqmValidators
|
|
60
53
|
results
|
61
54
|
end
|
62
55
|
|
63
|
-
def
|
64
|
-
|
56
|
+
def get_observed_values(results, n, pop_code, population_set, stratification)
|
57
|
+
statement_name = population_set.populations[pop_code]['statement_name']
|
58
|
+
# look to see if there is an observation that corresponds to the specific statement_name
|
59
|
+
statement_observation = population_set.observations.select { |obs| obs.observation_parameter.statement_name == statement_name }
|
60
|
+
# return unless an observation is found
|
61
|
+
unless statement_observation.empty?
|
62
|
+
hqmf_id = population_set.populations[pop_code]['hqmf_id']
|
63
|
+
results[:observations][pop_code] = extract_cv_value(n, statement_observation.first.hqmf_id, hqmf_id, pop_code, stratification)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def extract_cv_value(node, id, msrpopl, pop_code, strata = nil)
|
68
|
+
xpath_observation = %( cda:component/cda:observation[./cda:value[@code = "#{pop_code}"] and ./cda:reference/cda:externalObservation/cda:id[#{translate('@root')}='#{msrpopl.upcase}']])
|
65
69
|
cv = node.at_xpath(xpath_observation)
|
66
70
|
return nil unless cv
|
67
71
|
|
@@ -73,7 +77,7 @@ module CqmValidators
|
|
73
77
|
else
|
74
78
|
val = get_cv_value(cv, id)
|
75
79
|
end
|
76
|
-
|
80
|
+
val
|
77
81
|
end
|
78
82
|
|
79
83
|
def extract_component_value(node, code, id, strata = nil)
|