carin_for_blue_button_test_kit 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/c4bb_client_test_suite.rb +227 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/client_claims_data_attestation_test.rb +32 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/coverage_claims_data_request_test.rb +25 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/eob_inpatient_claims_data_request_test.rb +26 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/eob_oral_claims_data_request_test.rb +25 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/eob_outpatient_claims_data_request_test.rb +28 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/eob_pharmacy_claims_data_request_test.rb +25 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/eob_professional_claims_data_request_test.rb +27 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/organization_claims_data_request_test.rb +26 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/patient_claims_data_request_test.rb +24 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/practitioner_claims_data_request_test.rb +25 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/relatedperson_claims_data_request_test.rb +25 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/client_validation_test.rb +93 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/collection.rb +19 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/endpoints/next_page_endpoint.rb +24 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/endpoints/resource_api_endpoint.rb +74 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/endpoints/resource_id_endpoint.rb +24 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/endpoints/token_endpoint.rb +24 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/initial_wait_test.rb +76 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/metadata/mock_capability_statement.json +535 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/metadata/mock_operation_outcome_resource.json +16 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/mock_server.rb +190 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/coverage_required_searches.rb +45 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/eob_required_searches.rb +71 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/organization_required_searches.rb +47 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/patient_required_searches.rb +71 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/practitioner_required_searches.rb +47 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/relatedperson_required_searches.rb +43 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/tags.rb +7 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/urls.rb +57 -0
- data/lib/carin_for_blue_button_test_kit/client/v2.0.0/user_input_response.rb +32 -0
- data/lib/carin_for_blue_button_test_kit/version.rb +1 -1
- data/lib/carin_for_blue_button_test_kit.rb +1 -0
- data/lib/inferno_requirements_tools/tasks/{map_requirements.rb → requirements_coverage.rb} +91 -60
- metadata +34 -4
- data/lib/inferno_requirements_tools/tasks/collect_requirements.rb +0 -196
@@ -0,0 +1,190 @@
|
|
1
|
+
require_relative 'user_input_response'
|
2
|
+
require_relative 'urls'
|
3
|
+
require_relative 'collection'
|
4
|
+
require_relative 'client_validation_test'
|
5
|
+
# require_relative 'metadata/mock_capability_statement'
|
6
|
+
|
7
|
+
module CarinForBlueButtonTestKit
|
8
|
+
# Serve responses to CARIN requests
|
9
|
+
#
|
10
|
+
# Note that there are numerous expected validation issues that can safely be ignored.
|
11
|
+
# See here for full list: https://hl7.org/fhir/us/carin-bb/STU2/qa.html#suppressed
|
12
|
+
|
13
|
+
module MockServer
|
14
|
+
include URLs
|
15
|
+
|
16
|
+
def server_proxy
|
17
|
+
@server_proxy ||= Faraday.new(
|
18
|
+
url: ENV.fetch('FHIR_REFERENCE_SERVER'),
|
19
|
+
params: {},
|
20
|
+
headers: { 'Content-Type' => 'application/json', 'Authorization' => 'Bearer SAMPLE_TOKEN',
|
21
|
+
'Host' => ENV.fetch('HOST_HEADER') }
|
22
|
+
) do |proxy|
|
23
|
+
proxy.use FaradayMiddleware::Gzip
|
24
|
+
proxy.options.params_encoder = Faraday::FlatParamsEncoder
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def token_response(request, _test = nil, _test_result = nil)
|
29
|
+
# Placeholder for a more complete mock token endpoint
|
30
|
+
response.body = { access_token: SecureRandom.hex, token_type: 'bearer', expires_in: 300 }.to_json
|
31
|
+
response.status = 200
|
32
|
+
end
|
33
|
+
|
34
|
+
def error_response_resource(request)
|
35
|
+
server_response = server_proxy.get('Patient', { _id: 888 })
|
36
|
+
response_resource = FHIR.from_contents(server_response.body)
|
37
|
+
response_resource.entry = [{ fullUrl: 'urn:uuid:2866af9c-137d-4458-a8a9-eeeec0ce5583',
|
38
|
+
resource: mock_operation_outcome_resource, search: { mode: 'outcome' } }]
|
39
|
+
response_resource.link.first.url = request.url # specific case for Operation Outcome handling
|
40
|
+
response.status = 403
|
41
|
+
response_resource
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_params(query_string)
|
45
|
+
params = {}
|
46
|
+
query_string.split('&').each do |param|
|
47
|
+
split_param = param.split('=')
|
48
|
+
params[split_param.first] = [] if params[split_param.first].nil?
|
49
|
+
params[split_param.first].append(split_param.last)
|
50
|
+
end
|
51
|
+
params
|
52
|
+
end
|
53
|
+
|
54
|
+
def carin_resource_response(request, test = nil, test_result = nil)
|
55
|
+
endpoint = resource_endpoint(request.url)
|
56
|
+
if endpoint
|
57
|
+
request_parameters = get_params(request.query_string)
|
58
|
+
params = match_request_to_expectation(endpoint, request_parameters)
|
59
|
+
if params.present?
|
60
|
+
server_response = server_proxy.get(endpoint, params)
|
61
|
+
response.status = server_response.status
|
62
|
+
response_resource = if response.status == 200
|
63
|
+
replace_bundle_urls(FHIR.from_contents(server_response.body))
|
64
|
+
else
|
65
|
+
FHIR.from_contents(server_response.body)
|
66
|
+
end
|
67
|
+
response.headers.merge!(server_response.headers)
|
68
|
+
remove_transfer_encoding_and_content_length_header(response.headers)
|
69
|
+
else
|
70
|
+
response_resource = error_response_resource(request)
|
71
|
+
end
|
72
|
+
else
|
73
|
+
response_resource = error_response_resource(request)
|
74
|
+
end
|
75
|
+
response.body = response_resource.to_json
|
76
|
+
end
|
77
|
+
|
78
|
+
def carin_resource_id_response(request)
|
79
|
+
endpoint = resource_id_endpoint(request.url)
|
80
|
+
if endpoint
|
81
|
+
server_response = server_proxy.get(endpoint)
|
82
|
+
response.status = server_response.status
|
83
|
+
response_resource = FHIR.from_contents(server_response.body)
|
84
|
+
response.headers.merge!(server_response.headers)
|
85
|
+
remove_transfer_encoding_and_content_length_header(response.headers)
|
86
|
+
else
|
87
|
+
response_resource = error_response_resource(request)
|
88
|
+
end
|
89
|
+
response.body = response_resource.to_json
|
90
|
+
end
|
91
|
+
|
92
|
+
def read_next_page(request, test = nil, test_result = nil)
|
93
|
+
server_response = server_proxy.get('', JSON.parse(request.params.to_json))
|
94
|
+
response.status = server_response.status
|
95
|
+
response.response_headers = remove_transfer_encoding_header(server_response.headers)
|
96
|
+
response.response_body = replace_bundle_urls(FHIR.from_contents(server_response.body)).to_json
|
97
|
+
end
|
98
|
+
|
99
|
+
def get_metadata
|
100
|
+
proc {
|
101
|
+
[200, { 'Content-Type' => 'application/fhir+json;charset=utf-8' },
|
102
|
+
[File.read('lib/carin_for_blue_button_test_kit/client/v2.0.0/metadata/mock_capability_statement.json')]]
|
103
|
+
}
|
104
|
+
end
|
105
|
+
|
106
|
+
def remove_transfer_encoding_and_content_length_header(headers)
|
107
|
+
headers.delete('transfer-encoding') if headers['transfer-encoding'].present?
|
108
|
+
|
109
|
+
return unless headers['Content-Length'].present?
|
110
|
+
|
111
|
+
headers.delete('Content-Length')
|
112
|
+
end
|
113
|
+
|
114
|
+
def match_request_to_expectation(resource_type, params)
|
115
|
+
matched_search = SEARCHES_BY_PRIORITY[resource_type.to_sym].select do |expectation|
|
116
|
+
(params.keys.map(&:to_s) & expectation).sort == expectation
|
117
|
+
end.map(&:first)
|
118
|
+
|
119
|
+
if matched_search.present?
|
120
|
+
return params.select do |key, value|
|
121
|
+
matched_search.include?(key.to_s) || key == '_revInclude' || key == '_include'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
nil
|
125
|
+
end
|
126
|
+
|
127
|
+
def extract_client_id(request)
|
128
|
+
URI.decode_www_form(request.body.read).to_h['client_id']
|
129
|
+
end
|
130
|
+
|
131
|
+
# Header expected to be a bearer token of the form "Bearer: <token>"
|
132
|
+
def extract_bearer_token(request)
|
133
|
+
request.headers['authorization']&.delete_prefix('Bearer ')
|
134
|
+
end
|
135
|
+
|
136
|
+
def extract_token_from_query_params(request)
|
137
|
+
request.query_parameters['token']
|
138
|
+
end
|
139
|
+
|
140
|
+
# Pull resource type from url
|
141
|
+
# e.g. http://example.org/fhir/Patient?_id=123 -> Patient
|
142
|
+
# @private
|
143
|
+
def resource_endpoint(url)
|
144
|
+
return unless url.start_with?('http://', 'https://')
|
145
|
+
|
146
|
+
match = %r{custom/c4bb_v200_client/fhir/(.*)\?}.match(url)
|
147
|
+
match[1] if match.present?
|
148
|
+
end
|
149
|
+
|
150
|
+
def resource_id_endpoint(url)
|
151
|
+
return unless url.start_with?('http://', 'https://')
|
152
|
+
|
153
|
+
match = %r{custom/c4bb_v200_client/fhir/(.*)}.match(url)
|
154
|
+
match[1] if match.present?
|
155
|
+
end
|
156
|
+
|
157
|
+
def mock_operation_outcome_resource
|
158
|
+
FHIR.from_contents(File.read(
|
159
|
+
'lib/carin_for_blue_button_test_kit/client/v2.0.0/metadata/mock_operation_outcome_resource.json'
|
160
|
+
))
|
161
|
+
end
|
162
|
+
|
163
|
+
def replace_bundle_urls(bundle)
|
164
|
+
reference_server_base = ENV.fetch('FHIR_REFERENCE_SERVER')
|
165
|
+
bundle&.link&.map! { |link| { relation: link.relation, url: link.url.gsub(reference_server_base, new_link) } }
|
166
|
+
bundle&.entry&.map! do |bundled_resource|
|
167
|
+
{ fullUrl: bundled_resource.fullUrl.gsub(reference_server_base, new_link),
|
168
|
+
resource: bundled_resource.resource,
|
169
|
+
search: bundled_resource.search }
|
170
|
+
end
|
171
|
+
bundle
|
172
|
+
end
|
173
|
+
|
174
|
+
def new_link
|
175
|
+
"#{Inferno::Application['base_url']}/custom/c4bb_v200_client/fhir"
|
176
|
+
end
|
177
|
+
|
178
|
+
# @private
|
179
|
+
def find_matching_entry(ref, entries, root_url = '')
|
180
|
+
ref = "#{root_url}/#{ref}" if relative_reference?(ref) && root_url&.present?
|
181
|
+
|
182
|
+
entries&.find { |entry| entry&.fullUrl == ref }
|
183
|
+
end
|
184
|
+
|
185
|
+
# @private
|
186
|
+
def relative_reference?(ref)
|
187
|
+
ref&.count('/') == 1
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative '../urls'
|
2
|
+
require_relative '../client_validation_test'
|
3
|
+
|
4
|
+
module CarinForBlueButtonTestKit
|
5
|
+
class C4BBClientCoverageRequiredSearches < Inferno::Test
|
6
|
+
include URLs
|
7
|
+
include CarinForBlueButtonTestKit::ClientValidationTest
|
8
|
+
|
9
|
+
id :coverage_required_searches
|
10
|
+
title 'Coverage required search parameters'
|
11
|
+
description %(
|
12
|
+
This test will look through all the requests to find a Coverage search request with each of the following
|
13
|
+
required search parameters specified for the Coverage resource in the
|
14
|
+
[CARIN for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#coverage)
|
15
|
+
and [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html)
|
16
|
+
Capability Statements:
|
17
|
+
* _id
|
18
|
+
* patient
|
19
|
+
)
|
20
|
+
input :access_token
|
21
|
+
|
22
|
+
verifies_requirements 'hl7.fhir.us.carin-bb_2.0.0@14'
|
23
|
+
|
24
|
+
def required_searches
|
25
|
+
[
|
26
|
+
'_id',
|
27
|
+
'patient'
|
28
|
+
]
|
29
|
+
end
|
30
|
+
|
31
|
+
run do
|
32
|
+
search_params = resource_previous_search_params(:CoverageSearch)
|
33
|
+
skip_if search_params.nil?, 'No search requests made for Coverage resource'
|
34
|
+
|
35
|
+
missing_params = []
|
36
|
+
required_searches.each do |search_param|
|
37
|
+
missing_params.append(search_param) unless search_params.include?(search_param)
|
38
|
+
end
|
39
|
+
assert(missing_params.empty?, %(
|
40
|
+
Did not find any requests made with the following required search parameters:
|
41
|
+
#{missing_params.join(', ')}
|
42
|
+
))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative '../urls'
|
2
|
+
require_relative '../client_validation_test'
|
3
|
+
|
4
|
+
module CarinForBlueButtonTestKit
|
5
|
+
class C4BBClientEOBRequiredSearches < Inferno::Test
|
6
|
+
include URLs
|
7
|
+
include CarinForBlueButtonTestKit::ClientValidationTest
|
8
|
+
|
9
|
+
id :eob_required_searches
|
10
|
+
title 'Explanation of Benefit required search parameters'
|
11
|
+
description %(
|
12
|
+
This test will look through all the requests to find an ExplanationOfBenefit search request with each of the
|
13
|
+
following required search parameters specified for the ExplanationOfBenefit resource in the
|
14
|
+
[CARIN for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#explanationofbenefit)
|
15
|
+
and [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html)
|
16
|
+
Capability Statements:
|
17
|
+
* _id
|
18
|
+
* patient
|
19
|
+
* identifier
|
20
|
+
* _lastUpdated
|
21
|
+
* service-date
|
22
|
+
* service-start-date
|
23
|
+
* billable-period-start
|
24
|
+
* type
|
25
|
+
* _include:
|
26
|
+
* ExplanationOfBenefit:patient
|
27
|
+
* ExplanationOfBenefit:provider
|
28
|
+
* ExplanationOfBenefit:care-team
|
29
|
+
* ExplanationOfBenefit:coverage
|
30
|
+
* ExplanationOfBenefit:insurer
|
31
|
+
* ExplanationOfBenefit:payee
|
32
|
+
* ExplanationOfBenefit:*
|
33
|
+
)
|
34
|
+
input :access_token
|
35
|
+
|
36
|
+
verifies_requirements 'hl7.fhir.us.carin-bb_2.0.0@14'
|
37
|
+
|
38
|
+
def required_searches
|
39
|
+
[
|
40
|
+
'_id',
|
41
|
+
'patient',
|
42
|
+
'identifier',
|
43
|
+
'_lastUpdated',
|
44
|
+
'service-date',
|
45
|
+
'service-start-date',
|
46
|
+
'billable-period-start',
|
47
|
+
'type',
|
48
|
+
'_include=ExplanationOfBenefit:patient',
|
49
|
+
'_include=ExplanationOfBenefit:provider',
|
50
|
+
'_include=ExplanationOfBenefit:care-team',
|
51
|
+
'_include=ExplanationOfBenefit:coverage',
|
52
|
+
'_include=ExplanationOfBenefit:insurer',
|
53
|
+
'_include=ExplanationOfBenefit:payee',
|
54
|
+
'_include=ExplanationOfBenefit:*'
|
55
|
+
]
|
56
|
+
end
|
57
|
+
|
58
|
+
run do
|
59
|
+
search_params = resource_previous_search_params(:ExplanationOfBenefitSearch)
|
60
|
+
skip_if search_params.nil?, 'No search requests made for Explanation of Benefit resource'
|
61
|
+
missing_params = []
|
62
|
+
required_searches.each do |search_param|
|
63
|
+
missing_params.append(search_param) unless search_params.include?(search_param)
|
64
|
+
end
|
65
|
+
assert(missing_params.empty?, %(
|
66
|
+
Did not find any requests made with the following required search parameters:
|
67
|
+
#{missing_params.join(', ')}
|
68
|
+
))
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require_relative '../urls'
|
2
|
+
require_relative '../client_validation_test'
|
3
|
+
|
4
|
+
module CarinForBlueButtonTestKit
|
5
|
+
class C4BBClientOrganizationRequiredSearches < Inferno::Test
|
6
|
+
include URLs
|
7
|
+
include CarinForBlueButtonTestKit::ClientValidationTest
|
8
|
+
|
9
|
+
id :organization_required_searches
|
10
|
+
title 'Organization required search parameters'
|
11
|
+
description %(
|
12
|
+
This test will look through all the requests to find a Organization search request with each of the following
|
13
|
+
required search parameters specified for the Organization resource in the
|
14
|
+
[CARIN for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#organization)
|
15
|
+
and [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html#organization)
|
16
|
+
Capability Statements:
|
17
|
+
* _id
|
18
|
+
* name
|
19
|
+
* address
|
20
|
+
)
|
21
|
+
input :access_token
|
22
|
+
|
23
|
+
verifies_requirements 'hl7.fhir.us.carin-bb_2.0.0@14'
|
24
|
+
|
25
|
+
def required_searches
|
26
|
+
[
|
27
|
+
'_id',
|
28
|
+
'name',
|
29
|
+
'address'
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
run do
|
34
|
+
search_params = resource_previous_search_params(:OrganizationSearch)
|
35
|
+
skip_if search_params.nil?, 'No search requests made for Organization resource'
|
36
|
+
|
37
|
+
missing_params = []
|
38
|
+
required_searches.each do |search_param|
|
39
|
+
missing_params.append(search_param) unless search_params.include?(search_param)
|
40
|
+
end
|
41
|
+
assert(missing_params.empty?, %(
|
42
|
+
Did not find any requests made with the following required search parameters:
|
43
|
+
#{missing_params.join(', ')}
|
44
|
+
))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative '../urls'
|
2
|
+
require_relative '../client_validation_test'
|
3
|
+
|
4
|
+
module CarinForBlueButtonTestKit
|
5
|
+
class C4BBClientPatientRequiredSearches < Inferno::Test
|
6
|
+
include URLs
|
7
|
+
include CarinForBlueButtonTestKit::ClientValidationTest
|
8
|
+
|
9
|
+
id :patient_required_searches
|
10
|
+
title 'Patient required search parameters'
|
11
|
+
description %(
|
12
|
+
This test will look through all the requests to find a Patient search request with each of the following
|
13
|
+
required search parameters specified for the Patient resource in the
|
14
|
+
[CARIN for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#patient)
|
15
|
+
and [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html#patient)
|
16
|
+
Capability Statements:
|
17
|
+
* _id
|
18
|
+
* birthdate
|
19
|
+
* family
|
20
|
+
* gender
|
21
|
+
* given
|
22
|
+
* identifier
|
23
|
+
* name
|
24
|
+
* birthdate+family
|
25
|
+
* family+gender
|
26
|
+
* birthdate+name
|
27
|
+
* gender+name
|
28
|
+
)
|
29
|
+
input :access_token
|
30
|
+
|
31
|
+
verifies_requirements 'hl7.fhir.us.carin-bb_2.0.0@14'
|
32
|
+
|
33
|
+
def required_searches
|
34
|
+
[
|
35
|
+
'_id',
|
36
|
+
'birthdate',
|
37
|
+
'family',
|
38
|
+
'gender',
|
39
|
+
'given',
|
40
|
+
'identifier',
|
41
|
+
'name',
|
42
|
+
'birthdate+family',
|
43
|
+
'family+gender',
|
44
|
+
'birthdate+name',
|
45
|
+
'gender+name'
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
run do
|
50
|
+
search_params = resource_previous_search_params(:PatientSearch)
|
51
|
+
skip_if search_params.nil?, 'No search requests made for Patient resource'
|
52
|
+
|
53
|
+
missing_params = []
|
54
|
+
required_searches.each do |search_param|
|
55
|
+
if search_param.include?('+')
|
56
|
+
split_param = search_param.split('+')
|
57
|
+
unless search_params.include?(split_param.first) && search_params.include?(split_param.last)
|
58
|
+
missing_params.append(search_param)
|
59
|
+
end
|
60
|
+
else
|
61
|
+
missing_params.append(search_param) unless search_params.include?(search_param)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
assert(missing_params.empty?, %(
|
66
|
+
Did not find any requests made with the following required search parameters:
|
67
|
+
#{missing_params.join(', ')}
|
68
|
+
))
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require_relative '../urls'
|
2
|
+
require_relative '../client_validation_test'
|
3
|
+
|
4
|
+
module CarinForBlueButtonTestKit
|
5
|
+
class C4BBClientPractitionerRequiredSearches < Inferno::Test
|
6
|
+
include URLs
|
7
|
+
include CarinForBlueButtonTestKit::ClientValidationTest
|
8
|
+
|
9
|
+
id :practitioner_required_searches
|
10
|
+
title 'Practitioner required search parameters'
|
11
|
+
description %(
|
12
|
+
This test will look through all the requests to find a Practitioner search request with each of the following
|
13
|
+
required search parameters specified for the Practitioner resource in the
|
14
|
+
[CARIN for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#practitioner)
|
15
|
+
and [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html#practitioner)
|
16
|
+
Capability Statements:
|
17
|
+
* _id
|
18
|
+
* name
|
19
|
+
* identifier
|
20
|
+
)
|
21
|
+
input :access_token
|
22
|
+
|
23
|
+
verifies_requirements 'hl7.fhir.us.carin-bb_2.0.0@14'
|
24
|
+
|
25
|
+
def required_searches
|
26
|
+
[
|
27
|
+
'_id',
|
28
|
+
'name',
|
29
|
+
'identifier'
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
run do
|
34
|
+
search_params = resource_previous_search_params(:PractitionerSearch)
|
35
|
+
skip_if search_params.nil?, 'No search requests made for Practitioner resource'
|
36
|
+
|
37
|
+
missing_params = []
|
38
|
+
required_searches.each do |search_param|
|
39
|
+
missing_params.append(search_param) unless search_params.include?(search_param)
|
40
|
+
end
|
41
|
+
assert(missing_params.empty?, %(
|
42
|
+
Did not find any requests made with the following required search parameters:
|
43
|
+
#{missing_params.join(', ')}
|
44
|
+
))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative '../urls'
|
2
|
+
require_relative '../client_validation_test'
|
3
|
+
|
4
|
+
module CarinForBlueButtonTestKit
|
5
|
+
class C4BBClientRelatedPersonRequiredSearches < Inferno::Test
|
6
|
+
include URLs
|
7
|
+
include CarinForBlueButtonTestKit::ClientValidationTest
|
8
|
+
|
9
|
+
id :relatedperson_required_searches
|
10
|
+
title 'RelatedPerson required search parameters'
|
11
|
+
description %(
|
12
|
+
This test will look through all the requests to find a RelatedPerson search request with each of the following
|
13
|
+
required search parameters specified for the RelatedPerson resource in the
|
14
|
+
[CARIN for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#relatedperson)
|
15
|
+
and [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html#practitioner)
|
16
|
+
Capability Statements:
|
17
|
+
* _id
|
18
|
+
)
|
19
|
+
input :access_token
|
20
|
+
|
21
|
+
verifies_requirements 'hl7.fhir.us.carin-bb_2.0.0@14'
|
22
|
+
|
23
|
+
def required_searches
|
24
|
+
[
|
25
|
+
'_id'
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
29
|
+
run do
|
30
|
+
search_params = resource_previous_search_params(:RelatedPersonSearch)
|
31
|
+
skip_if search_params.nil?, 'No search requests made for RelatedPerson resource'
|
32
|
+
|
33
|
+
missing_params = []
|
34
|
+
required_searches.each do |search_param|
|
35
|
+
missing_params.append(search_param) unless search_params.include?(search_param)
|
36
|
+
end
|
37
|
+
assert(missing_params.empty?, %(
|
38
|
+
Did not find any requests made with the following required search parameters:
|
39
|
+
#{missing_params.join(', ')}
|
40
|
+
))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module CarinForBlueButtonTestKit
|
2
|
+
TOKEN_PATH = '/mock_auth/token'
|
3
|
+
PATIENT_PATH = '/fhir/Patient'
|
4
|
+
RESOURCE_API_PATH = '/fhir/:endpoint'
|
5
|
+
RESOURCE_ID_PATH = '/fhir/:endpoint/:id'
|
6
|
+
METADATA_PATH = '/fhir/metadata'
|
7
|
+
BASE_FHIR_PATH = '/fhir'
|
8
|
+
RESUME_PASS_PATH = '/resume_pass'
|
9
|
+
RESUME_CLAIMS_DATA_PATH = '/resume_claims_data'
|
10
|
+
RESUME_FAIL_PATH = '/resume_fail'
|
11
|
+
|
12
|
+
module URLs
|
13
|
+
def base_url
|
14
|
+
@base_url ||= "#{Inferno::Application['base_url']}/custom/#{suite_id}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def token_url
|
18
|
+
@token_url ||= base_url + TOKEN_PATH
|
19
|
+
end
|
20
|
+
|
21
|
+
def base_fhir_url
|
22
|
+
@base_fhir_url ||= base_url + BASE_FHIR_PATH
|
23
|
+
end
|
24
|
+
|
25
|
+
def patient_url
|
26
|
+
@patient_url ||= base_url + PATIENT_PATH
|
27
|
+
end
|
28
|
+
|
29
|
+
def submit_url
|
30
|
+
@submit_url ||= base_url + RESOURCE_API_PATH
|
31
|
+
end
|
32
|
+
|
33
|
+
def resource_id_url
|
34
|
+
@resource_id_url ||= base_url + RESOURCE_ID_PATH
|
35
|
+
end
|
36
|
+
|
37
|
+
def metadata_url
|
38
|
+
@metadata_url ||= base_url + METADATA_PATH
|
39
|
+
end
|
40
|
+
|
41
|
+
def resume_pass_url
|
42
|
+
@resume_pass_url ||= base_url + RESUME_PASS_PATH
|
43
|
+
end
|
44
|
+
|
45
|
+
def resume_claims_data_url
|
46
|
+
@resume_claims_data_url ||= base_url + RESUME_CLAIMS_DATA_PATH
|
47
|
+
end
|
48
|
+
|
49
|
+
def resume_fail_url
|
50
|
+
@resume_fail_url ||= base_url + RESUME_FAIL_PATH
|
51
|
+
end
|
52
|
+
|
53
|
+
def suite_id
|
54
|
+
self.class.suite.id
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module CarinForBlueButtonTestKit
|
2
|
+
module UserInputResponse
|
3
|
+
def self.included(klass)
|
4
|
+
klass.extend ClassMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.user_inputted_response(configurable, result)
|
8
|
+
input_key = configurable.config.options[:respond_with]
|
9
|
+
return unless input_key.present?
|
10
|
+
|
11
|
+
JSON.parse(result.input_json)&.find { |i| i['name'] == input_key.to_s }&.dig('value')
|
12
|
+
rescue JSON::ParserError
|
13
|
+
nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def check_user_inputted_response(input_key, message = nil)
|
17
|
+
skip_if send(input_key).blank?,
|
18
|
+
message ||
|
19
|
+
"To run this test a response body must be provided in the '**#{input_title(input_key)}**' input"
|
20
|
+
end
|
21
|
+
|
22
|
+
def input_title(input_key)
|
23
|
+
config.inputs[input_key]&.title || config.inputs[input_key]&.name
|
24
|
+
end
|
25
|
+
|
26
|
+
module ClassMethods
|
27
|
+
def respond_with(key)
|
28
|
+
config options: { respond_with: key }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -2,3 +2,4 @@ require_relative 'inferno_requirements_tools/ext/inferno_core/runnable'
|
|
2
2
|
require_relative 'carin_for_blue_button_test_kit/generated/v1.1.0/c4bb_test_suite'
|
3
3
|
require_relative 'carin_for_blue_button_test_kit/generated/v2.0.0/c4bb_test_suite'
|
4
4
|
require_relative 'carin_for_blue_button_test_kit/generated/v2.0.0-dev-nonfinancial/c4bb_test_suite'
|
5
|
+
require_relative 'carin_for_blue_button_test_kit/client/v2.0.0/c4bb_client_test_suite'
|