onc_certification_g10_test_kit 3.3.0 → 3.3.2

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5357a415d5bb6ec45aa058974bf15193e51a2df886dd2502ec9547624aa737c6
4
- data.tar.gz: 12305e05cb0c337dd0cf96f6e473ea338f9494a6e83e04ed31af534558dacc50
3
+ metadata.gz: 9bb1416b5f4a895760df48a2c49468074e882651237b8b76ebc81434b16df44d
4
+ data.tar.gz: '09d90f9db1f4c5be41a8e7705c5b2809f81da0bb377bcc4c4bde14e5d168943e'
5
5
  SHA512:
6
- metadata.gz: c4118a80d8819fc53fed826dfa71386b78958def1e196e96b182176e9eca66f4324be77b1bc53270a01ec8c31177919ad064b950e6c022157278a3222d6f4e4c
7
- data.tar.gz: e4969b599c5ca82c613032a9aa0feaaa3279c56d56980f35903249c341cce6bed805522e58276b5ae1ce50774f92293db8f0172813d0d1f5f7f8be0fbb9ca0ba
6
+ metadata.gz: 3bc7515b56f5680e57f7ef716b34ecf77b04abfdba314bc12d9c8a51a85b31da9a4da8895a32093431d52a18af36f7ca0cb9bb6fa2b2ff2f597f45e42442b151
7
+ data.tar.gz: d37b1c5641703be96934aeaa96444be227c7eab3653c888dcc37dfd70a41f9b44383a19efb3898337f73a93552ad48c1166b9ddffcef9eb10b8a0f87a493823f
@@ -4,27 +4,30 @@ require_relative '../terminology/bcp_13'
4
4
  module Inferno
5
5
  module Terminology
6
6
  module TerminologyValidation
7
- # Code systems to "preprocess" prior to validation, and the function to use
7
+ # CodeSystems/ValueSets to "preprocess" prior to validation, and the
8
+ # function to use
8
9
  PREPROCESS_FUNCS = {
9
- 'urn:ietf:bcp:13' => BCP13.method(:preprocess_code)
10
+ 'urn:ietf:bcp:13' => BCP13.method(:preprocess_code),
11
+ 'http://hl7.org/fhir/ValueSet/mimetypes' => BCP13.method(:preprocess_code)
10
12
  }.freeze
11
13
 
12
14
  def validators_repo
13
15
  @validators_repo ||= Repositories::Validators.new
14
16
  end
15
17
 
16
- # This function accepts a valueset URL, code, and optional system, and returns true
17
- # if the code or code/system combination is valid for the valueset
18
- # represented by that URL
18
+ # This function accepts a valueset URL, code, and optional system, and
19
+ # returns true if the code or code/system combination is valid for the
20
+ # valueset represented by that URL
19
21
  #
20
22
  # @param String value_set_url the URL for the valueset to validate against
21
23
  # @param String code the code to validate against the valueset
22
- # @param String system an optional codesystem to validate against. Defaults to nil
24
+ # @param String system an optional codesystem to validate against.
23
25
  # @return Boolean whether the code or code/system is in the valueset
24
26
  def validate_code(code:, value_set_url: nil, system: nil)
25
27
  # Before we validate the code, see if there's any preprocessing steps we have to do
26
28
  # To get the code "ready" for validation
27
29
  code = PREPROCESS_FUNCS[system].call(code) if PREPROCESS_FUNCS[system]
30
+ code = PREPROCESS_FUNCS[value_set_url].call(code) if PREPROCESS_FUNCS[value_set_url]
28
31
 
29
32
  # Get the valueset from the url. Redundant if the 'system' is not nil,
30
33
  # but allows us to throw a better error if the valueset isn't known by Inferno
@@ -38,7 +38,7 @@ module ONCCertificationG10TestKit
38
38
  extract_profile('ConditionEncounterDiagnosis')
39
39
  elsif resource_contains_category(resource, 'problem-list-item',
40
40
  'http://terminology.hl7.org/CodeSystem/condition-category') ||
41
- resource_contains_category(resource, 'health-concern', 'http://terminology.hl7.org/CodeSystem/condition-category')
41
+ resource_contains_category(resource, 'health-concern', 'http://hl7.org/fhir/us/core/CodeSystem/condition-category')
42
42
  extract_profile('ConditionProblemsHealthConcerns')
43
43
  end
44
44
  else
@@ -41,7 +41,7 @@ module ONCCertificationG10TestKit
41
41
  ].freeze
42
42
 
43
43
  V5_VALID_RESOURCE_TYPES =
44
- (VALID_RESOURCE_TYPES + ['ServiceRequest', 'QuestionnaireResponse']).freeze
44
+ (VALID_RESOURCE_TYPES + ['ServiceRequest', 'QuestionnaireResponse', 'Media']).freeze
45
45
 
46
46
  PATIENT_COMPARTMENT_RESOURCE_TYPES = [
47
47
  '*',
@@ -19,11 +19,37 @@ module ONCCertificationG10TestKit
19
19
  end
20
20
 
21
21
  def validate
22
- add_error(element_with_invalid_binding) if element_with_invalid_binding.present?
22
+ # Handle special case due to required binding on a slice
23
+ if binding_definition[:required_binding_slice]
24
+ validate_required_binding_slice
25
+ else
26
+ add_error(element_with_invalid_binding) if element_with_invalid_binding.present? # rubocop:disable Style/IfInsideElse
27
+ end
23
28
 
24
29
  validation_messages
25
30
  end
26
31
 
32
+ def validate_required_binding_slice
33
+ valid_binding =
34
+ find_a_value_at(path_source, binding_definition[:path]) do |element|
35
+ !invalid_binding?(element)
36
+ end
37
+
38
+ return if valid_binding.present?
39
+
40
+ system = binding_definition[:system].presence || 'the declared Value Set'
41
+
42
+ error_message = %(
43
+ #{resource_type}/#{resource.id} at #{resource_type}.#{binding_definition[:path]}
44
+ does not contain a valid code from #{system}.
45
+ )
46
+
47
+ validation_messages << {
48
+ type: 'error',
49
+ message: error_message
50
+ }
51
+ end
52
+
27
53
  def path_source
28
54
  return resource if binding_definition[:extensions].blank?
29
55
 
@@ -45,7 +45,7 @@ module ONCCertificationG10TestKit
45
45
 
46
46
  run do
47
47
  assert token_revocation_attestation == 'true',
48
- 'Health IT Module did not demonstrate support for application registration for single patients.'
48
+ 'Health IT Module did not demonstrate the ability to revoke tokens.'
49
49
  pass token_revocation_notes if token_revocation_notes.present?
50
50
  end
51
51
  end
@@ -1,3 +1,3 @@
1
1
  module ONCCertificationG10TestKit
2
- VERSION = '3.3.0'.freeze
2
+ VERSION = '3.3.2'.freeze
3
3
  end
@@ -102,13 +102,22 @@ module ONCCertificationG10TestKit
102
102
  end
103
103
  next if metadata.nil?
104
104
 
105
- metadata.bindings
105
+ validation_messages = if resource.instance_of?(FHIR::Provenance)
106
+ USCoreTestKit::ProvenanceValidator.validate(resource)
107
+ else
108
+ []
109
+ end
110
+
111
+ terminology_validation_messages = metadata.bindings
106
112
  .select { |binding_definition| binding_definition[:strength] == 'required' }
107
113
  .flat_map do |binding_definition|
108
114
  TerminologyBindingValidator.validate(resource, binding_definition)
109
- rescue Inferno::UnknownValueSetException, Inferno::UnknownCodeSystemException => e
110
- { type: 'warning', message: e.message }
115
+ rescue Inferno::UnknownValueSetException, Inferno::UnknownCodeSystemException => e
116
+ { type: 'warning', message: e.message }
111
117
  end.compact
118
+
119
+ validation_messages.concat(terminology_validation_messages)
120
+ validation_messages
112
121
  end
113
122
  end
114
123
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onc_certification_g10_test_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-08 00:00:00.000000000 Z
11
+ date: 2022-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bloomer
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: 0.4.1
145
+ version: 0.4.3
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - '='
151
151
  - !ruby/object:Gem::Version
152
- version: 0.4.1
152
+ version: 0.4.3
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: database_cleaner-sequel
155
155
  requirement: !ruby/object:Gem::Requirement