onc_certification_g10_test_kit 3.3.1 → 3.3.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: 29d1384f7d5a0ae29a25db2bef10d89572ef5112298a21ddc9ec8a7316947a62
4
- data.tar.gz: 5c4b63d1d7a45c65fc3af1e8d56b466fd99a811a06baedbdf6cd558b1085e3b2
3
+ metadata.gz: 9bb1416b5f4a895760df48a2c49468074e882651237b8b76ebc81434b16df44d
4
+ data.tar.gz: '09d90f9db1f4c5be41a8e7705c5b2809f81da0bb377bcc4c4bde14e5d168943e'
5
5
  SHA512:
6
- metadata.gz: 6a9bc19aa48b0b24bb045368b08e5de4dd1256258a4f17b0ef810a0c02653049ba4b5c300ccb24f1d47f300cca274f816a5d7c8a9e274e8ab7a8d69371885a74
7
- data.tar.gz: 3bfcbb63b923db092d12cd148911ee7993161799ea6bf25a60b187676ecf923e53935ea7546c7052e4489ff337f0b17c0dcd3078fde3a68dc2033039f7b9a214
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
  '*',
@@ -18,15 +18,10 @@ module ONCCertificationG10TestKit
18
18
  @validation_messages = []
19
19
  end
20
20
 
21
- def us_core_5_condition_category?
22
- binding_definition[:path] == 'category' &&
23
- binding_definition[:system] == 'http://hl7.org/fhir/us/core/ValueSet/us-core-problem-or-health-concern'
24
- end
25
-
26
21
  def validate
27
22
  # Handle special case due to required binding on a slice
28
- if us_core_5_condition_category?
29
- validate_us_core_5_condition_category
23
+ if binding_definition[:required_binding_slice]
24
+ validate_required_binding_slice
30
25
  else
31
26
  add_error(element_with_invalid_binding) if element_with_invalid_binding.present? # rubocop:disable Style/IfInsideElse
32
27
  end
@@ -34,18 +29,19 @@ module ONCCertificationG10TestKit
34
29
  validation_messages
35
30
  end
36
31
 
37
- def validate_us_core_5_condition_category
38
- valid_category =
32
+ def validate_required_binding_slice
33
+ valid_binding =
39
34
  find_a_value_at(path_source, binding_definition[:path]) do |element|
40
35
  !invalid_binding?(element)
41
36
  end
42
37
 
43
- return if valid_category.present?
38
+ return if valid_binding.present?
39
+
40
+ system = binding_definition[:system].presence || 'the declared Value Set'
44
41
 
45
42
  error_message = %(
46
- #{resource_type}/#{resource.id} does not contain a `category` from the
47
- `http://hl7.org/fhir/us/core/ValueSet/us-core-problem-or-health-concern`
48
- ValueSet.
43
+ #{resource_type}/#{resource.id} at #{resource_type}.#{binding_definition[:path]}
44
+ does not contain a valid code from #{system}.
49
45
  )
50
46
 
51
47
  validation_messages << {
@@ -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.1'.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.1
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-10 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