davinci_pas_test_kit 0.9.0 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/lib/davinci_pas_test_kit/client_suite.rb +1 -169
  3. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/{claim_status/pas_claim_status_test.rb → claim_response_decision/pas_claim_response_decision_test.rb} +10 -27
  4. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_approval_submit_response_attest.rb +1 -0
  5. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/pas_client_must_support_requirement_test.rb +1 -1
  6. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/pas_server_must_support_requirement_test.rb +4 -1
  7. data/lib/davinci_pas_test_kit/custom_groups/v2.0.1/notification/pas_subscription_notification_test.rb +40 -0
  8. data/lib/davinci_pas_test_kit/docs/client_suite_description_v201.md +172 -0
  9. data/lib/davinci_pas_test_kit/docs/server_suite_description_v201.md +150 -0
  10. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/client_inquiry_request_beneficiary_must_support_test.rb +5 -1
  11. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/client_submit_request_beneficiary_must_support_test.rb +5 -1
  12. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/server_inquiry_request_beneficiary_must_support_test.rb +7 -1
  13. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/server_inquiry_response_beneficiary_must_support_test.rb +5 -1
  14. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/server_submit_request_beneficiary_must_support_test.rb +7 -1
  15. data/lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/server_submit_response_beneficiary_must_support_test.rb +5 -1
  16. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim/claim_operation_test.rb +1 -1
  17. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_inquiry/claim_inquiry_operation_test.rb +1 -1
  18. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_inquiry/client_inquiry_request_claim_inquiry_must_support_test.rb +5 -1
  19. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_inquiry/server_inquiry_request_claim_inquiry_must_support_test.rb +7 -1
  20. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_update/client_submit_request_claim_update_must_support_test.rb +5 -1
  21. data/lib/davinci_pas_test_kit/generated/v2.0.1/claim_update/server_submit_request_claim_update_must_support_test.rb +7 -1
  22. data/lib/davinci_pas_test_kit/generated/v2.0.1/claiminquiryresponse/server_inquiry_response_claiminquiryresponse_must_support_test.rb +5 -1
  23. data/lib/davinci_pas_test_kit/generated/v2.0.1/claimresponse/server_submit_response_claimresponse_must_support_test.rb +5 -1
  24. data/lib/davinci_pas_test_kit/generated/v2.0.1/client_tests/client_denial_pas_response_bundle_validation_test.rb +3 -0
  25. data/lib/davinci_pas_test_kit/generated/v2.0.1/client_tests/client_pended_pas_response_bundle_validation_test.rb +3 -0
  26. data/lib/davinci_pas_test_kit/generated/v2.0.1/communication_request/server_submit_response_communication_request_must_support_test.rb +5 -1
  27. data/lib/davinci_pas_test_kit/generated/v2.0.1/coverage/client_inquiry_request_coverage_must_support_test.rb +5 -1
  28. data/lib/davinci_pas_test_kit/generated/v2.0.1/coverage/client_submit_request_coverage_must_support_test.rb +5 -1
  29. data/lib/davinci_pas_test_kit/generated/v2.0.1/coverage/server_inquiry_request_coverage_must_support_test.rb +7 -1
  30. data/lib/davinci_pas_test_kit/generated/v2.0.1/coverage/server_submit_request_coverage_must_support_test.rb +7 -1
  31. data/lib/davinci_pas_test_kit/generated/v2.0.1/device_request/client_submit_request_device_request_must_support_test.rb +5 -1
  32. data/lib/davinci_pas_test_kit/generated/v2.0.1/device_request/server_submit_request_device_request_must_support_test.rb +7 -1
  33. data/lib/davinci_pas_test_kit/generated/v2.0.1/encounter/client_submit_request_encounter_must_support_test.rb +5 -1
  34. data/lib/davinci_pas_test_kit/generated/v2.0.1/encounter/server_submit_request_encounter_must_support_test.rb +7 -1
  35. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/client_inquiry_request_insurer_must_support_test.rb +5 -1
  36. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/client_submit_request_insurer_must_support_test.rb +5 -1
  37. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/server_inquiry_request_insurer_must_support_test.rb +7 -1
  38. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/server_inquiry_response_insurer_must_support_test.rb +5 -1
  39. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/server_submit_request_insurer_must_support_test.rb +7 -1
  40. data/lib/davinci_pas_test_kit/generated/v2.0.1/insurer/server_submit_response_insurer_must_support_test.rb +5 -1
  41. data/lib/davinci_pas_test_kit/generated/v2.0.1/medication_request/client_submit_request_medication_request_must_support_test.rb +5 -1
  42. data/lib/davinci_pas_test_kit/generated/v2.0.1/medication_request/server_submit_request_medication_request_must_support_test.rb +7 -1
  43. data/lib/davinci_pas_test_kit/generated/v2.0.1/nutrition_order/client_submit_request_nutrition_order_must_support_test.rb +5 -1
  44. data/lib/davinci_pas_test_kit/generated/v2.0.1/nutrition_order/server_submit_request_nutrition_order_must_support_test.rb +7 -1
  45. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_request_bundle/client_inquiry_request_pas_inquiry_request_bundle_must_support_test.rb +5 -1
  46. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_request_bundle/server_inquiry_request_pas_inquiry_request_bundle_must_support_test.rb +7 -1
  47. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_request_bundle/server_pas_inquiry_request_bundle_validation_test.rb +4 -0
  48. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_response_bundle/server_inquiry_response_pas_inquiry_response_bundle_must_support_test.rb +5 -1
  49. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_inquiry_response_bundle/server_pas_inquiry_response_bundle_validation_test.rb +1 -0
  50. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_request_bundle/client_submit_request_pas_request_bundle_must_support_test.rb +5 -1
  51. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_request_bundle/server_pas_request_bundle_validation_test.rb +4 -0
  52. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_request_bundle/server_submit_request_pas_request_bundle_must_support_test.rb +7 -1
  53. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_response_bundle/server_pas_response_bundle_validation_test.rb +1 -0
  54. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_response_bundle/server_submit_response_pas_response_bundle_must_support_test.rb +5 -1
  55. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_server_approval_use_case_group.rb +3 -7
  56. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_server_denial_use_case_group.rb +3 -7
  57. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_server_must_support_use_case_group.rb +2 -2
  58. data/lib/davinci_pas_test_kit/generated/v2.0.1/pas_server_pended_use_case_group.rb +6 -8
  59. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/client_inquiry_request_practitioner_must_support_test.rb +5 -1
  60. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/client_submit_request_practitioner_must_support_test.rb +5 -1
  61. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/server_inquiry_request_practitioner_must_support_test.rb +7 -1
  62. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/server_inquiry_response_practitioner_must_support_test.rb +5 -1
  63. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/server_submit_request_practitioner_must_support_test.rb +7 -1
  64. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner/server_submit_response_practitioner_must_support_test.rb +5 -1
  65. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/client_inquiry_request_practitioner_role_must_support_test.rb +5 -1
  66. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/client_submit_request_practitioner_role_must_support_test.rb +5 -1
  67. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/server_inquiry_request_practitioner_role_must_support_test.rb +7 -1
  68. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/server_inquiry_response_practitioner_role_must_support_test.rb +5 -1
  69. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/server_submit_request_practitioner_role_must_support_test.rb +7 -1
  70. data/lib/davinci_pas_test_kit/generated/v2.0.1/practitioner_role/server_submit_response_practitioner_role_must_support_test.rb +5 -1
  71. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/client_inquiry_request_requestor_must_support_test.rb +5 -1
  72. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/client_submit_request_requestor_must_support_test.rb +5 -1
  73. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/server_inquiry_request_requestor_must_support_test.rb +7 -1
  74. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/server_inquiry_response_requestor_must_support_test.rb +5 -1
  75. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/server_submit_request_requestor_must_support_test.rb +7 -1
  76. data/lib/davinci_pas_test_kit/generated/v2.0.1/requestor/server_submit_response_requestor_must_support_test.rb +5 -1
  77. data/lib/davinci_pas_test_kit/generated/v2.0.1/server_suite.rb +2 -153
  78. data/lib/davinci_pas_test_kit/generated/v2.0.1/service_request/client_submit_request_service_request_must_support_test.rb +5 -1
  79. data/lib/davinci_pas_test_kit/generated/v2.0.1/service_request/server_submit_request_service_request_must_support_test.rb +7 -1
  80. data/lib/davinci_pas_test_kit/generated/v2.0.1/subscriber/client_inquiry_request_subscriber_must_support_test.rb +5 -1
  81. data/lib/davinci_pas_test_kit/generated/v2.0.1/subscriber/client_submit_request_subscriber_must_support_test.rb +5 -1
  82. data/lib/davinci_pas_test_kit/generated/v2.0.1/subscriber/server_inquiry_request_subscriber_must_support_test.rb +7 -1
  83. data/lib/davinci_pas_test_kit/generated/v2.0.1/subscriber/server_submit_request_subscriber_must_support_test.rb +7 -1
  84. data/lib/davinci_pas_test_kit/generated/v2.0.1/task/server_inquiry_response_task_must_support_test.rb +5 -1
  85. data/lib/davinci_pas_test_kit/generated/v2.0.1/task/server_submit_response_task_must_support_test.rb +5 -1
  86. data/lib/davinci_pas_test_kit/generator/group_generator.rb +26 -13
  87. data/lib/davinci_pas_test_kit/generator/operation_test_generator.rb +1 -1
  88. data/lib/davinci_pas_test_kit/generator/validation_test_generator.rb +9 -0
  89. data/lib/davinci_pas_test_kit/mock_server.rb +21 -3
  90. data/lib/davinci_pas_test_kit/must_support_test.rb +6 -2
  91. data/lib/davinci_pas_test_kit/pas_bundle_validation.rb +1 -1
  92. data/lib/davinci_pas_test_kit/version.rb +1 -1
  93. metadata +6 -3
@@ -141,6 +141,7 @@ module DaVinciPASTestKit
141
141
 
142
142
  def description
143
143
  <<~DESCRIPTION
144
+ #{description_user_input_validation if user_input?}
144
145
  #{system == 'server' ? description_intro_server : description_intro_client}
145
146
  It verifies the presence of mandatory elements and that elements with
146
147
  required bindings contain appropriate values. CodeableConcept element
@@ -158,6 +159,7 @@ module DaVinciPASTestKit
158
159
  This test validates the conformity of the
159
160
  #{request_type.include?('request') ? 'user input' : "server's response"} to the
160
161
  [#{profile_name}](#{profile_url}) structure#{request_type.include?('request') ? ', ensuring subsequent tests can accurately simulate content.' : '.'}
162
+
161
163
  It also checks that other conformance requirements defined in the [PAS Formal
162
164
  Specification](https://hl7.org/fhir/us/davinci-pas/STU2/specification.html),
163
165
  such as the presence of all referenced instances within the bundle and the
@@ -176,6 +178,13 @@ module DaVinciPASTestKit
176
178
  conformance of those instances to the appropriate profiles, are met.
177
179
  GENERIC_INTRO
178
180
  end
181
+
182
+ def description_user_input_validation
183
+ <<~USER_INPUT_INTRO
184
+ **USER INPUT VALIDATION**: This test validates input provided by the user instead of the system under test.
185
+ Errors encountered will be treated as a skip instead of a failure.
186
+ USER_INPUT_INTRO
187
+ end
179
188
  end
180
189
  end
181
190
  end
@@ -25,9 +25,13 @@ module DaVinciPASTestKit
25
25
  operation = request&.url&.split('$')&.last
26
26
  req_bundle = FHIR.from_contents(request&.request_body)
27
27
  claim_entry = req_bundle&.entry&.find { |e| e&.resource&.resourceType == 'Claim' }
28
- root_url = base_url(claim_entry&.fullUrl)
29
- return unless ['submit', 'inquire'].include?(operation) && claim_entry.present?
28
+ claim_full_url = claim_entry&.fullUrl
29
+ if claim_entry.blank? || claim_full_url.blank?
30
+ handle_missing_required_elements(claim_entry, request)
31
+ return
32
+ end
30
33
 
34
+ root_url = base_url(claim_full_url)
31
35
  claim_response = mock_claim_response(claim_entry.resource, req_bundle, operation, root_url)
32
36
 
33
37
  res_bundle = FHIR::Bundle.new(
@@ -137,11 +141,25 @@ module DaVinciPASTestKit
137
141
  request.query_parameters['token']
138
142
  end
139
143
 
144
+ def handle_missing_required_elements(claim_entry, request)
145
+ request.status = 400
146
+ request.response_headers = { 'Content-Type': 'application/json' }
147
+ details = if claim_entry.blank?
148
+ 'Required Claim entry missing from bundle'
149
+ else
150
+ 'Required element fullUrl missing from Claim entry'
151
+ end
152
+ request.response_body = FHIR::OperationOutcome.new(
153
+ issue: FHIR::OperationOutcome::Issue.new(severity: 'fatal', code: 'required',
154
+ details: FHIR::CodeableConcept.new(text: details))
155
+ ).to_json
156
+ end
157
+
140
158
  # Drop the last two segments of a URL, i.e. the resource type and ID of a FHIR resource
141
159
  # e.g. http://example.org/fhir/Patient/123 -> http://example.org/fhir
142
160
  # @private
143
161
  def base_url(url)
144
- return unless url.start_with?('http://', 'https://')
162
+ return unless url&.start_with?('http://', 'https://')
145
163
 
146
164
  # Drop everything after the second to last '/', ignoring a trailing slash
147
165
  url.sub(%r{/[^/]*/[^/]*(/)?\z}, '')
@@ -41,8 +41,12 @@ module DaVinciPASTestKit
41
41
  @all_must_support_errors ||= []
42
42
  end
43
43
 
44
- def validate_must_support
45
- assert all_must_support_errors.empty?, all_must_support_errors.join("\n")
44
+ def validate_must_support(user_input_validation)
45
+ if user_input_validation
46
+ skip_if !all_must_support_errors.empty?, all_must_support_errors.join("\n")
47
+ else
48
+ assert all_must_support_errors.empty?, all_must_support_errors.join("\n")
49
+ end
46
50
  end
47
51
 
48
52
  def perform_must_support_test(resources)
@@ -465,7 +465,7 @@ module DaVinciPASTestKit
465
465
  url_regex = /\A#{URI::DEFAULT_PARSER.make_regexp(%w[http https])}\z/
466
466
  urn_uuid_regex = /\Aurn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\z/i
467
467
 
468
- string.match?(url_regex) || string.match?(urn_uuid_regex)
468
+ string&.match?(url_regex) || string&.match?(urn_uuid_regex)
469
469
  end
470
470
 
471
471
  # This method traverses references within a FHIR resource, ensuring that referenced resources
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: truen
2
2
 
3
3
  module DaVinciPASTestKit
4
- VERSION = '0.9.0'.freeze
4
+ VERSION = '0.9.3'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: davinci_pas_test_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inferno Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-16 00:00:00.000000000 Z
11
+ date: 2024-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inferno_core
@@ -90,7 +90,7 @@ files:
90
90
  - LICENSE
91
91
  - lib/davinci_pas_test_kit.rb
92
92
  - lib/davinci_pas_test_kit/client_suite.rb
93
- - lib/davinci_pas_test_kit/custom_groups/v2.0.1/claim_status/pas_claim_status_test.rb
93
+ - lib/davinci_pas_test_kit/custom_groups/v2.0.1/claim_response_decision/pas_claim_response_decision_test.rb
94
94
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_approval_submit_response_attest.rb
95
95
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_approval_submit_test.rb
96
96
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_denial_submit_response_attest.rb
@@ -112,11 +112,14 @@ files:
112
112
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/pas_client_must_support_requirement_test.rb
113
113
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/pas_server_must_support_requirement_test.rb
114
114
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/must_support/service_request_metadata.yml
115
+ - lib/davinci_pas_test_kit/custom_groups/v2.0.1/notification/pas_subscription_notification_test.rb
115
116
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_client_approval_group.rb
116
117
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_client_authentication_group.rb
117
118
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_client_denial_group.rb
118
119
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_client_pended_group.rb
119
120
  - lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_error_group.rb
121
+ - lib/davinci_pas_test_kit/docs/client_suite_description_v201.md
122
+ - lib/davinci_pas_test_kit/docs/server_suite_description_v201.md
120
123
  - lib/davinci_pas_test_kit/ext/inferno_core/record_response_route.rb
121
124
  - lib/davinci_pas_test_kit/ext/inferno_core/request.rb
122
125
  - lib/davinci_pas_test_kit/ext/inferno_core/runnable.rb