cqm-validators 2.0.2 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c8067796e458fb6576378bcfedadb762e75cfc3222e7b71288a1ac24f706087
4
- data.tar.gz: 5ee8cfad30be91371fee0b0ebcd454d5c7bd5993d6ff96b3e565fd148039e5b8
3
+ metadata.gz: 6abb9bf8064df8134c14cf879afb6e0166c187b72bf4d4111880bcabb3c06a2f
4
+ data.tar.gz: 9efa76762db8bb2168e14fafe8940e93a5321f5c10602498a4ab0357a765ff35
5
5
  SHA512:
6
- metadata.gz: 0333e138838bda558b17d0612b5f270d9d549c908531e5e1792433941aaaa913c7d0d7754d09f60ca91df98cd355612418a68cb122a2d9440479d923fbff2989
7
- data.tar.gz: 58deb72053f7e7e29e9c2174b21e7b603bbd5fffe954665add5899de6d0438b0b24d40c403b08735358bb10001585731230c4452d8a345295c19fab1bb49308c
6
+ metadata.gz: 2644f1657d905ec149c4bfcc8ce7ed9d8adfd2f67af49d7521c7a4060ae5d44f2bbfb1b97a32f1d5ce033b6d5a469e7772c6291252fca2eb71e037bfe0e68b62
7
+ data.tar.gz: 1388423a072a4db0cc3290b67328cac5598be670c5730a50b079f2de1af2265e705e71e28f004a295849d50d165bf08389c6b0cb8e5e281c2aeaa6d78ca38dc7
@@ -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,21 +1,19 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.5
2
+ TargetRubyVersion: 2.4
3
3
  Exclude:
4
4
  - bin/*
5
- Documentation:
5
+ Style/Documentation:
6
6
  Enabled: false
7
7
  # TODO: remove this exception when java_processor.rb is fixed to rescue StandardError
8
+ Style/HashEachMethods:
9
+ Enabled: false
10
+ Style/HashTransformKeys:
11
+ Enabled: false
12
+ Style/HashTransformValues:
13
+ Enabled: false
8
14
  Lint/RescueException:
9
15
  Exclude:
10
16
  - 'lib/schematron/java_processor.rb'
11
- Layout/LineLength:
12
- Max: 150
13
- Exclude:
14
- - 'test/**/*'
15
- # TODO: remove exclusions below this line as line length is fixed
16
- - 'lib/reported_result_extractor.rb'
17
- - 'lib/data_validator.rb'
18
- - 'lib/measure_validator.rb'
19
17
  Metrics/AbcSize:
20
18
  # The ABC size is a calculated magnitude, so this number can be a Fixnum or
21
19
  # a Float.
@@ -33,6 +31,14 @@ Metrics/ClassLength:
33
31
  - 'test/**/*'
34
32
  # TODO: remove exclusions below this line as Class length is fixed
35
33
  - 'lib/qrda_qdm_template_validator.rb'
34
+ Layout/LineLength:
35
+ Max: 150
36
+ Exclude:
37
+ - 'test/**/*'
38
+ # TODO: remove exclusions below this line as line length is fixed
39
+ - 'lib/reported_result_extractor.rb'
40
+ - 'lib/data_validator.rb'
41
+ - 'lib/measure_validator.rb'
36
42
  Metrics/MethodLength:
37
43
  CountComments: false # count full line comments?
38
44
  Max: 20
data/Gemfile CHANGED
@@ -9,6 +9,6 @@ gemspec development_group: :test
9
9
 
10
10
  group :test do
11
11
  gem 'codecov', require: false
12
- gem 'cqm-models', git: 'https://github.com/projecttacoma/cqm-models.git', branch: 'master'
12
+ gem 'cqm-models', '~> 3.0'
13
13
  gem 'simplecov', require: false
14
14
  end
data/README.md CHANGED
@@ -18,15 +18,18 @@ Then run bundler to grab all of the necessary gems:
18
18
  Versioning
19
19
  ==========
20
20
 
21
- Starting with version **1.0.1.0** released on 5/22/2019, cqm-validators versioning has the format **W.X.Y.Z**, where:
21
+ Starting with version **2.0.0** released on 6/20/19, cqm-validators versioning has the format **X.Y.Z**, where:
22
22
 
23
- * **W** maps to a version of QRDA Category 1 and QRDA Category 3. See the table below to see the existing mapping to QRDA versions.
23
+ * **X** maps to a version of QRDA. See the table below to see the existing mapping to QRDA versions.
24
24
 
25
- | W | QRDA Cat 1 | QRDA Cat 3 |
25
+ | X | QRDA Cat 1 | QRDA Cat 3 |
26
26
  | --- | --- | --- |
27
- | 1 | R1 STU5.1 | R1 STU2.1 |
27
+ | 2 | R1 STU5.1 | R1 STU2.1 |
28
+ | 3 | R1 STU5.2 | R1 STU2.1 |
28
29
 
29
- * **X.Y.Z** uses [SemVer](http://semver.org/) for versioning. **X.Y.Z** starts at 0.0.0 when **W** is incremented.
30
+ * **Y** indicates major changes (incompatible API changes)
31
+
32
+ * **Z** indicates minor changes (added functionality in a backwards-compatible manner) and patch changes (backwards-compatible bug fixes)
30
33
 
31
34
  For the versions available, see [tags on this repository](https://github.com/projecttacoma/cqm-validators/tags).
32
35
 
@@ -22,9 +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.required_ruby_version = '>= 2.5.0'
25
+ spec.required_ruby_version = '>= 2.4.0'
26
26
 
27
- spec.add_dependency 'nokogiri', '~>1.10'
27
+ spec.add_dependency 'nokogiri', '>= 1.8.5', '< 1.13.0'
28
28
 
29
29
  spec.add_development_dependency 'bundler'
30
30
  spec.add_development_dependency 'byebug'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CqmValidators
4
- VERSION = '2.0.2'
4
+ VERSION = '3.1.2'
5
5
  end
@@ -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 OBSERV].freeze
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
- results = { supplemental_data: {} }
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] || pop_code == 'OBSERV'
43
+ next unless population_set.populations[pop_code]
43
44
 
44
- val = nil
45
- sup = nil
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 extract_cv_value(node, id, msrpopl, strata = nil)
64
- xpath_observation = %( cda:component/cda:observation[./cda:value[@code = "MSRPOPL"] and ./cda:reference/cda:externalObservation/cda:id[#{translate('@root')}='#{msrpopl.upcase}']])
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
- [val, (strata.nil? ? extract_supplemental_data(cv) : nil)]
80
+ val
77
81
  end
78
82
 
79
83
  def extract_component_value(node, code, id, strata = nil)