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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/c4bb_client_test_suite.rb +227 -0
  3. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/client_claims_data_attestation_test.rb +32 -0
  4. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/coverage_claims_data_request_test.rb +25 -0
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/organization_claims_data_request_test.rb +26 -0
  11. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/patient_claims_data_request_test.rb +24 -0
  12. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/practitioner_claims_data_request_test.rb +25 -0
  13. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/claim_data_request_tests/relatedperson_claims_data_request_test.rb +25 -0
  14. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/client_validation_test.rb +93 -0
  15. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/collection.rb +19 -0
  16. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/endpoints/next_page_endpoint.rb +24 -0
  17. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/endpoints/resource_api_endpoint.rb +74 -0
  18. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/endpoints/resource_id_endpoint.rb +24 -0
  19. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/endpoints/token_endpoint.rb +24 -0
  20. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/initial_wait_test.rb +76 -0
  21. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/metadata/mock_capability_statement.json +535 -0
  22. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/metadata/mock_operation_outcome_resource.json +16 -0
  23. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/mock_server.rb +190 -0
  24. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/coverage_required_searches.rb +45 -0
  25. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/eob_required_searches.rb +71 -0
  26. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/organization_required_searches.rb +47 -0
  27. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/patient_required_searches.rb +71 -0
  28. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/practitioner_required_searches.rb +47 -0
  29. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/required_searches_tests/relatedperson_required_searches.rb +43 -0
  30. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/tags.rb +7 -0
  31. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/urls.rb +57 -0
  32. data/lib/carin_for_blue_button_test_kit/client/v2.0.0/user_input_response.rb +32 -0
  33. data/lib/carin_for_blue_button_test_kit/version.rb +1 -1
  34. data/lib/carin_for_blue_button_test_kit.rb +1 -0
  35. data/lib/inferno_requirements_tools/tasks/{map_requirements.rb → requirements_coverage.rb} +91 -60
  36. metadata +34 -4
  37. data/lib/inferno_requirements_tools/tasks/collect_requirements.rb +0 -196
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64361067f120249c1ee01c85806474242013e54242635f81b5f7cf2f2e0b1992
4
- data.tar.gz: 796e6f5f879a90a7cb8e0fd885852f177d98fd88780c31590a7fc4090e0eecf5
3
+ metadata.gz: b975a4081bc825131e5c1ba84dbebf4a20ce7d95e494ba9d83bec8448c6b2510
4
+ data.tar.gz: 1d3f165ba5a3c5786af032b27c59f5fd338c98c43905666889a1357cc096ec09
5
5
  SHA512:
6
- metadata.gz: 80496d24d7473e13e90e9485f494454aa3a90b67047663cfb69298bb4e41f96c2c3800a31a6b099b4077d2a935e6da18475db91baabcf9cc69684857619b7eb4
7
- data.tar.gz: 2d0e6083bf8e6e78292c69d3a6a6968ad680564cead0ba4f3bc34aeafaa4950bb834b2aab15070167cae3988790442b4039c1fd4f126ce8ca0b1b76dcc292c4f
6
+ metadata.gz: 1b4e98e70806496adc7a6aa48dd4894ca8aeb3b5da2ba322d50022410eb2f25b4e2dcc26b0e86da4bb1eb65671f03c54ac2665496c2f0930059297219a80c33f
7
+ data.tar.gz: 6d70082e44ba1534d1dbd1496b99fb6618aa74ae12726f8881b06efed10c9647c4da4de3e0cb6023d82a27264d116f3c08d89d62197cf55e27ed5a9facd6a6d7
@@ -0,0 +1,227 @@
1
+ require 'inferno/dsl/oauth_credentials'
2
+ require_relative 'endpoints/resource_api_endpoint'
3
+ require_relative 'endpoints/token_endpoint'
4
+ require_relative 'endpoints/next_page_endpoint'
5
+ require_relative 'endpoints/resource_id_endpoint'
6
+
7
+ require_relative 'urls'
8
+ require_relative 'mock_server'
9
+ require_relative 'tags'
10
+ require_relative 'collection'
11
+ require_relative 'client_validation_test'
12
+
13
+ require_relative 'initial_wait_test'
14
+
15
+ require_relative 'claim_data_request_tests/patient_claims_data_request_test'
16
+ require_relative 'claim_data_request_tests/coverage_claims_data_request_test'
17
+ require_relative 'claim_data_request_tests/organization_claims_data_request_test'
18
+ require_relative 'claim_data_request_tests/practitioner_claims_data_request_test'
19
+ require_relative 'claim_data_request_tests/relatedperson_claims_data_request_test'
20
+ require_relative 'claim_data_request_tests/eob_inpatient_claims_data_request_test'
21
+ require_relative 'claim_data_request_tests/eob_outpatient_claims_data_request_test'
22
+ require_relative 'claim_data_request_tests/eob_oral_claims_data_request_test'
23
+ require_relative 'claim_data_request_tests/eob_pharmacy_claims_data_request_test'
24
+ require_relative 'claim_data_request_tests/eob_professional_claims_data_request_test'
25
+
26
+ require_relative 'required_searches_tests/patient_required_searches'
27
+ require_relative 'required_searches_tests/coverage_required_searches'
28
+ require_relative 'required_searches_tests/organization_required_searches'
29
+ require_relative 'required_searches_tests/practitioner_required_searches'
30
+ require_relative 'required_searches_tests/relatedperson_required_searches'
31
+ require_relative 'required_searches_tests/eob_required_searches'
32
+
33
+ require_relative 'claim_data_request_tests/client_claims_data_attestation_test'
34
+
35
+ module CarinForBlueButtonTestKit
36
+ class C4BBV200ClientSuite < Inferno::TestSuite
37
+ extend MockServer
38
+ extend ClientValidationTest
39
+
40
+ id :c4bb_v200_client
41
+ title 'CARIN IG for Blue Button® v2.0.0 Client Test Suite'
42
+ description File.read(File.join(__dir__, '..', '..', 'docs',
43
+ 'carin_for_blue_button_v2.0.0_client_suite_description.md'))
44
+
45
+ def self.test_resumes?(test)
46
+ !test.config.options[:accepts_multiple_requests]
47
+ end
48
+
49
+ links [
50
+ {
51
+ label: 'Report Issue',
52
+ url: 'https://github.com/inferno-framework/carin-for-blue-button-test-kit/issues'
53
+ },
54
+ {
55
+ label: 'Open Source',
56
+ url: 'https://github.com/inferno-framework/carin-for-blue-button-test-kit'
57
+ },
58
+ {
59
+ label: 'Download',
60
+ url: 'https://github.com/inferno-framework/carin-for-blue-button-test-kit/releases'
61
+ },
62
+ {
63
+ label: 'Implementation Guide',
64
+ url: 'http://hl7.org/fhir/us/carin-bb/STU2'
65
+ }
66
+ ]
67
+
68
+ VALIDATION_MESSAGE_FILTERS = [
69
+ /\A\S+: \S+: URL value '.*' does not resolve/
70
+ ].freeze
71
+
72
+ fhir_resource_validator do
73
+ igs 'igs/carin4bb-200.tgz'
74
+
75
+ exclude_message do |message|
76
+ VALIDATION_MESSAGE_FILTERS.any? { |filter| filter.match? message.message }
77
+ end
78
+ end
79
+
80
+ suite_endpoint :post, TOKEN_PATH, TokenEndpoint
81
+
82
+ suite_endpoint :get, PATIENT_PATH, ResourceAPIEndpoint
83
+
84
+ suite_endpoint :get, RESOURCE_API_PATH, ResourceAPIEndpoint
85
+
86
+ suite_endpoint :get, RESOURCE_ID_PATH, ResourceIDEndpoint
87
+
88
+ suite_endpoint :get, BASE_FHIR_PATH, NextPageEndpoint
89
+
90
+ resume_test_route :get, RESUME_PASS_PATH do |request|
91
+ C4BBV200ClientSuite.extract_token_from_query_params(request)
92
+ end
93
+
94
+ resume_test_route :get, RESUME_CLAIMS_DATA_PATH do |request|
95
+ C4BBV200ClientSuite.extract_token_from_query_params(request)
96
+ end
97
+
98
+ resume_test_route :get, RESUME_FAIL_PATH, result: 'fail' do |request|
99
+ C4BBV200ClientSuite.extract_token_from_query_params(request)
100
+ end
101
+
102
+ route(:get, METADATA_PATH, get_metadata)
103
+
104
+ group do
105
+ run_as_group
106
+ title 'Wait for Claims Data and Search Requests'
107
+ description %(
108
+ This test will wait for the client system under test to submit requests for resources for each of the
109
+ [CARIN for Blue Button profiles](https://hl7.org/fhir/us/carin-bb/STU2/artifacts.html#structures-resource-profiles),
110
+ and for requests including all of the required search parameters for each resource type specified in the
111
+ [C4BB CapabilityStatement](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html) and the
112
+ [US Core Client CapabilityStatement](https://hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html).
113
+ )
114
+
115
+ test from: :initial_wait_test
116
+ end
117
+
118
+ group do
119
+ title 'C4BB Patient Profile claims data and search request tests'
120
+ description %(
121
+ These tests look through all the requests sent in from the client system to ensure a request was made that
122
+ returned a Patient resource implementing the CARIN for Blue Button [Patient profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-Patient.html).
123
+ It will also verify that the client made a request using each required search parameter for the Patient resource
124
+ specified in the [CARIN IG for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#patient)
125
+ and the [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html#patient)
126
+ Capability Statements.
127
+ )
128
+
129
+ test from: :patient_claims_data_request_test
130
+ test from: :patient_required_searches
131
+ end
132
+
133
+ group do
134
+ title 'C4BB Coverage Profile claims data and search request tests'
135
+ description %(
136
+ These tests look through all the requests sent in from the client system to ensure a request was made that
137
+ returned a Coverage resource implementing the CARIN for Blue Button [Coverage profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-Coverage.html).
138
+ It will also verify that the client made a request using each required search parameter for the Coverage
139
+ resource specified in the [CARIN IG for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#coverage)
140
+ and the [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html)
141
+ Capability Statements.
142
+ )
143
+
144
+ test from: :coverage_claims_data_request_test
145
+ test from: :coverage_required_searches
146
+ end
147
+
148
+ group do
149
+ title 'C4BB Organization Profile claims data and search request tests'
150
+ description %(
151
+ These tests look through all the requests sent in from the client system to ensure a request was made that
152
+ returned a Organization resource implementing the CARIN for Blue Button [Organization profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-Organization.html).
153
+ It will also verify that the client made a request using each required search parameter for the Organization
154
+ resource specified in the [CARIN IG for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#organization)
155
+ and the [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html#organization)
156
+ Capability Statements.
157
+ )
158
+ optional
159
+
160
+ test from: :organization_claims_data_request_test
161
+ test from: :organization_required_searches
162
+ end
163
+
164
+ group do
165
+ title 'C4BB Practitioner Profile claims data and search request tests'
166
+ description %(
167
+ These tests look through all the requests sent in from the client system to ensure a request was made that
168
+ returned a Practitioner resource implementing the CARIN for Blue Button [Practitioner profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-Practitioner.html).
169
+ It will also verify that the client made a request using each required search parameter for the Practitioner
170
+ resource specified in the [CARIN IG for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#practitioner)
171
+ and the [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html#practitioner)
172
+ Capability Statements.
173
+ )
174
+ optional
175
+
176
+ test from: :practitioner_claims_data_request_test
177
+ test from: :practitioner_required_searches
178
+ end
179
+
180
+ group do
181
+ title 'C4BB RelatedPerson Profile claims data and search request tests'
182
+ description %(
183
+ These tests look through all the requests sent in from the client system to ensure a request was made that
184
+ returned a RelatedPerson resource implementing the CARIN for Blue Button [RelatedPerson profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-RelatedPerson.html).
185
+ It will also verify that the client made a request using each required search parameter for the RelatedPerson
186
+ resource specified in the [CARIN IG for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#relatedperson)
187
+ and the [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html)
188
+ Capability Statements.
189
+ )
190
+ optional
191
+
192
+ test from: :relatedperson_claims_data_request_test
193
+ test from: :relatedperson_required_searches
194
+ end
195
+
196
+ group do
197
+ title 'C4BB ExplanationOfBenefit Profiles claims data and search request tests'
198
+ description %(
199
+ These tests look through all the requests sent in from the client system to ensure a request was made that
200
+ returned ExplanationOfBenefit resources implementing each of the
201
+ CARIN for Blue Button [ExplanationOfBenefit profiles](https://hl7.org/fhir/us/carin-bb/STU2/artifacts.html#structures-resource-profiles).
202
+ It will also verify that the client made a request using each required search parameter for the
203
+ ExplanationOfBenefit resource specified in the [CARIN IG for Blue Button](https://hl7.org/fhir/us/carin-bb/STU2/CapabilityStatement-c4bb.html#explanationofbenefit)
204
+ and the [US Core Client](https://www.hl7.org/fhir/us/core/STU3.1.1/CapabilityStatement-us-core-client.html)
205
+ Capability Statements.
206
+ )
207
+
208
+ test from: :eob_inpatient_claims_data_request_test
209
+ test from: :eob_outpatient_claims_data_request_test
210
+ test from: :eob_oral_claims_data_request_test
211
+ test from: :eob_pharmacy_claims_data_request_test
212
+ test from: :eob_professional_claims_data_request_test
213
+ test from: :eob_required_searches
214
+ end
215
+
216
+ group do
217
+ run_as_group
218
+ title 'CARIN For Blue Button Client Attestation'
219
+ description %(
220
+ Attest that the client system under test was able to sucessfully process all of the requested resources for
221
+ each of the CARIN for Blue Button profiles.
222
+ )
223
+
224
+ test from: :client_claims_data_attestation
225
+ end
226
+ end
227
+ end
@@ -0,0 +1,32 @@
1
+ require_relative '../urls'
2
+
3
+ module CarinForBlueButtonTestKit
4
+ class ClientAttestationTest < Inferno::Test
5
+ include URLs
6
+ title 'CARIN Claims Data Client Attestation'
7
+ description %(
8
+ Attest that the all claims data was able to be received and processed by the client.
9
+ )
10
+ id :client_claims_data_attestation
11
+
12
+ verifies_requirements 'hl7.fhir.us.carin-bb_2.0.0@3',
13
+ 'hl7.fhir.us.carin-bb_2.0.0@13'
14
+
15
+ run do
16
+ identifier = SecureRandom.hex(32)
17
+ wait(
18
+ identifier:,
19
+ message: %(
20
+ I attest that the client system under test was able to receive, process, and retain all of the requested
21
+ CARIN for Blue Button claims data, including all of the profile data elements that have a minimum cardinality
22
+ greater than or equal to 1 and/or flagged as Must Support as defined by that profiles StructureDefinition
23
+ for each resource.
24
+
25
+ [Click here](#{resume_pass_url}?token=#{identifier}) if the system **meets** this requirement.
26
+
27
+ [Click here](#{resume_fail_url}?token=#{identifier}) if the system **does not meet** this requirement.
28
+ )
29
+ )
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,25 @@
1
+ require_relative '../urls'
2
+ require_relative '../client_validation_test'
3
+
4
+ module CarinForBlueButtonTestKit
5
+ class C4BBClientCoverageSubmitClaimsDataRequestTest < Inferno::Test
6
+ include URLs
7
+ include CarinForBlueButtonTestKit::ClientValidationTest
8
+
9
+ id :coverage_claims_data_request_test
10
+ title 'Coverage resources related to CARIN claims data are gathered'
11
+ description %(
12
+ This test verifies that an instance returned by requests made by the client is a Coverage resource
13
+ that conforms to the CARIN for Blue Button [Coverage profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-Coverage.html).
14
+ )
15
+ input :access_token
16
+
17
+ run do
18
+ resources = previous_resource_requests(:Coverage)
19
+ skip_if resources.nil?, 'No requests made for Coverage resources'
20
+
21
+ assert resources.any? { |resource| resource.id == 'c4bb-Coverage' },
22
+ 'Unable to find expected resource: c4bb-Coverage'
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ require_relative '../urls'
2
+ require_relative '../client_validation_test'
3
+
4
+ module CarinForBlueButtonTestKit
5
+ class C4BBClientEOBInpatientSubmitClaimsDataRequestTest < Inferno::Test
6
+ include URLs
7
+ include CarinForBlueButtonTestKit::ClientValidationTest
8
+
9
+ id :eob_inpatient_claims_data_request_test
10
+ title 'Inpatient Institutional ExplanationOfBenefit resources related to CARIN claims data are gathered'
11
+ description %(
12
+ This test verifies that an instance returned by requests made by the client is an ExplanationOfBenefit resource
13
+ that conforms to the CARIN for Blue Button [Outpatient Institutional ExplanationOfBenefit profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-ExplanationOfBenefit-Outpatient-Institutional.html).
14
+ )
15
+ input :access_token
16
+
17
+ run do
18
+ resources = previous_resource_requests(:ExplanationOfBenefit_Inpatient_Institutional)
19
+ skip_if resources.nil?,
20
+ 'No requests made for ExplanationOfBenefit resources'
21
+
22
+ assert resources.any? { |resource| resource.id == 'c4bb-EOBInpatient' },
23
+ 'Unable to find expected resource: c4bb-EOBInpatient'
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ require_relative '../urls'
2
+ require_relative '../client_validation_test'
3
+
4
+ module CarinForBlueButtonTestKit
5
+ class C4BBClientEOBOralSubmitClaimsDataRequestTest < Inferno::Test
6
+ include URLs
7
+ include CarinForBlueButtonTestKit::ClientValidationTest
8
+
9
+ id :eob_oral_claims_data_request_test
10
+ title 'Oral ExplanationOfBenefit resources related to CARIN claims data are gathered'
11
+ description %(
12
+ This test verifies that an instance returned by requests made by the client is an ExplanationOfBenefit resource
13
+ that conforms to the CARIN for Blue Button [Oral ExplanationOfBenefit profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-ExplanationOfBenefit-Oral.html).
14
+ )
15
+ input :access_token
16
+
17
+ run do
18
+ resources = previous_resource_requests(:ExplanationOfBenefit_Oral)
19
+ skip_if resources.nil?, 'No requests made for ExplanationOfBenefit resources'
20
+
21
+ assert resources.any? { |resource| resource.id == 'c4bb-EOBOral' },
22
+ 'Unable to find expected resource: c4bb-EOBOral'
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ require_relative '../urls'
2
+ require_relative '../client_validation_test'
3
+
4
+ module CarinForBlueButtonTestKit
5
+ class C4BBClientEOBOutpatientSubmitClaimsDataRequestTest < Inferno::Test
6
+ include URLs
7
+ include CarinForBlueButtonTestKit::ClientValidationTest
8
+
9
+ id :eob_outpatient_claims_data_request_test
10
+ title 'Outpatient Institutional ExplanationOfBenefit resources related to CARIN claims data are gathered'
11
+ description %(
12
+ This test verifies that an instance returned by requests made by the client is an ExplanationOfBenefit resource
13
+ that conforms to the CARIN for Blue Button [Outpatient Institutional ExplanationOfBenefit profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-ExplanationOfBenefit-Outpatient-Institutional.html).
14
+ )
15
+ input :access_token
16
+
17
+ run do
18
+ resources = previous_resource_requests(:ExplanationOfBenefit_Outpatient_Institutional)
19
+ skip_if resources.nil?,
20
+ 'No requests made for ExplanationOfBenefit resources'
21
+
22
+ assert resources.any? { |resource|
23
+ resource.id == 'c4bb-EOBOutpatient'
24
+ },
25
+ 'Unable to find expected resource: c4bb-EOBOutpatient'
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ require_relative '../urls'
2
+ require_relative '../client_validation_test'
3
+
4
+ module CarinForBlueButtonTestKit
5
+ class C4BBClientEOBPharmacySubmitClaimsDataRequestTest < Inferno::Test
6
+ include URLs
7
+ include CarinForBlueButtonTestKit::ClientValidationTest
8
+
9
+ id :eob_pharmacy_claims_data_request_test
10
+ title 'Pharmacy ExplanationOfBenefit resources related to CARIN claims data are gathered'
11
+ description %(
12
+ This test verifies that an instance returned by requests made by the client is an ExplanationOfBenefit resource
13
+ that conforms to the CARIN for Blue Button [Pharmacy ExplanationOfBenefit profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-ExplanationOfBenefit-Pharmacy.html).
14
+ )
15
+ input :access_token
16
+
17
+ run do
18
+ resources = previous_resource_requests(:ExplanationOfBenefit_Pharmacy)
19
+ skip_if resources.nil?, 'No requests made for ExplanationOfBenefit resources'
20
+
21
+ assert resources.any? { |resource| resource.id == 'c4bb-EOBPharmacy' },
22
+ 'Unable to find expected resource: c4bb-EOBPharmacyt'
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ require_relative '../urls'
2
+ require_relative '../client_validation_test'
3
+
4
+ module CarinForBlueButtonTestKit
5
+ class C4BBClientEOBProfessionalSubmitClaimsDataRequestTest < Inferno::Test
6
+ include URLs
7
+ include CarinForBlueButtonTestKit::ClientValidationTest
8
+
9
+ id :eob_professional_claims_data_request_test
10
+ title 'Professional NonClinician ExplanationOfBenefit resources related to CARIN claims data are gathered'
11
+ description %(
12
+ This test verifies that an instance returned by requests made by the client is an ExplanationOfBenefit resource
13
+ that conforms to the CARIN for Blue Button [Professional NonClinician ExplanationOfBenefit profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-ExplanationOfBenefit-Professional-NonClinician.html).
14
+ )
15
+ input :access_token
16
+
17
+ run do
18
+ resources = previous_resource_requests(:ExplanationOfBenefit_Professional_NonClinician)
19
+ skip_if resources.nil?,
20
+ 'No requests made for ExplanationOfBenefit resources'
21
+
22
+ assert resources.any? { |resource|
23
+ resource.id == 'c4bb-EOBProfessional'
24
+ }, 'Unable to find expected resource: c4bb-EOBProfessional'
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ require_relative '../urls'
2
+ require_relative '../client_validation_test'
3
+
4
+ module CarinForBlueButtonTestKit
5
+ class C4BBClientOrganizationSubmitClaimsDataRequestTest < Inferno::Test
6
+ include URLs
7
+ include CarinForBlueButtonTestKit::ClientValidationTest
8
+
9
+ id :organization_claims_data_request_test
10
+ title 'Organization resources related to CARIN claims data are gathered'
11
+ description %(
12
+ This test verifies that an instance returned by requests made by the client is an Organization resource
13
+ that conforms to the CARIN for Blue Button [Organization profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-Organization.html).
14
+ )
15
+ input :access_token
16
+
17
+ run do
18
+ resources = previous_resource_requests(:Organization)
19
+ skip_if resources.nil?, 'No requests made for Organization resources'
20
+
21
+ assert resources.any? { |resource|
22
+ resource.id == 'c4bb-Organization'
23
+ }, 'Unable to find expected resource: c4bb-Organization'
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,24 @@
1
+ require_relative '../urls'
2
+ require_relative '../client_validation_test'
3
+
4
+ module CarinForBlueButtonTestKit
5
+ class C4BBClientPatientSubmitClaimsDataRequestTest < Inferno::Test
6
+ include URLs
7
+ include CarinForBlueButtonTestKit::ClientValidationTest
8
+
9
+ id :patient_claims_data_request_test
10
+ title 'Patient resources related to the patient matched are gathered'
11
+ description %(
12
+ This test verifies that an instance returned by requests made by the client is a Patient resource
13
+ that conforms to the CARIN for Blue Button [Patient profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-Patient.html).
14
+ )
15
+ input :access_token
16
+
17
+ run do
18
+ resources = previous_resource_requests(:Patient)
19
+ skip_if resources.nil?, 'No requests made for Patient resources'
20
+
21
+ assert resources.any? { |resource| resource.id == '888' }, 'Unable to find expected resource: 888'
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ require_relative '../urls'
2
+ require_relative '../client_validation_test'
3
+
4
+ module CarinForBlueButtonTestKit
5
+ class C4BBClientPractitionerSubmitClaimsDataRequestTest < Inferno::Test
6
+ include URLs
7
+ include CarinForBlueButtonTestKit::ClientValidationTest
8
+
9
+ id :practitioner_claims_data_request_test
10
+ title 'Practitioner resources related to CARIN claims data are gathered'
11
+ description %(
12
+ This test verifies that an instance returned by requests made by the client is a Practitioner resource
13
+ that conforms to the CARIN for Blue Button [Practitioner profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-Practitioner.html).
14
+ )
15
+ input :access_token
16
+
17
+ run do
18
+ resources = previous_resource_requests(:Practitioner)
19
+ skip_if resources.nil?, 'No requests made for Practitioner resources'
20
+
21
+ assert resources.any? { |resource| resource.id == 'c4bb-Practitioner' },
22
+ 'Unable to find expected resource: c4bb-Practitioner'
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require_relative '../urls'
2
+ require_relative '../client_validation_test'
3
+
4
+ module CarinForBlueButtonTestKit
5
+ class C4BBClientRelatedPersonSubmitClaimsDataRequestTest < Inferno::Test
6
+ include URLs
7
+ include CarinForBlueButtonTestKit::ClientValidationTest
8
+
9
+ id :relatedperson_claims_data_request_test
10
+ title 'RelatedPerson resources related to CARIN claims data are gathered'
11
+ description %(
12
+ This test verifies that an instance returned by requests made by the client is a RelatedPerson resource
13
+ that conforms to the CARIN for Blue Button [RelatedPerson profile](https://hl7.org/fhir/us/carin-bb/STU2/StructureDefinition-C4BB-RelatedPerson.html).
14
+ )
15
+ input :access_token
16
+
17
+ run do
18
+ resources = previous_resource_requests(:RelatedPerson)
19
+ skip_if resources.nil?, 'No requests made for RelatedPerson resources'
20
+
21
+ assert resources.any? { |resource| resource.id == 'c4bb-RelatedPerson' },
22
+ 'Unable to find expected resource: c4bb-RelatedPerson'
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,93 @@
1
+ module CarinForBlueButtonTestKit
2
+ module ClientValidationTest
3
+ def all_resource_types
4
+ ['Patient', 'Coverage', 'Organization', 'Practitioner', 'RelatedPerson',
5
+ 'ExplanationOfBenefit_Inpatient_Institutional', 'ExplanationOfBenefit_Outpatient_Institutional',
6
+ 'ExplanationOfBenefit_Oral', 'ExplanationOfBenefit_Pharmacy', 'ExplanationOfBenefit_Professional_NonClinician']
7
+ end
8
+
9
+ def previous_claims_data_request_resources(resource_type_tag)
10
+ hash = Hash.new { |hash, key| hash[key] = [] }
11
+ previous_claims_data_requests(resource_type_tag).each_with_object(hash) do |request, request_resource_hash|
12
+ request_resources =
13
+ if request.status == 200
14
+ request.resource.entry.map(&:resource)
15
+ else
16
+ []
17
+ end
18
+ request_resource_hash[request].concat(request_resources)
19
+ end
20
+ end
21
+
22
+ def extract_eob_profile(resource)
23
+ profile_url = resource.meta.profile.find do |profile|
24
+ profile.include?('StructureDefinition/C4BB-ExplanationOfBenefit')
25
+ end
26
+ match = %r{http://hl7.org/fhir/us/carin-bb/StructureDefinition/(.*)}.match(profile_url)
27
+ return unless match.present?
28
+
29
+ match[1].delete_prefix('C4BB-ExplanationOfBenefit-').split('|')[0].gsub('-', '_')
30
+ end
31
+
32
+ def previous_claims_data_request_resources_scratch(resource_type_tag)
33
+ previous_claims_data_request_resources(resource_type_tag).each do |request, resources|
34
+ resources.each do |resource|
35
+ next unless resource_type_tag.to_s.include?(resource.resourceType)
36
+
37
+ if resource.resourceType == 'ExplanationOfBenefit'
38
+ profile = extract_eob_profile(resource)
39
+ identifier = "#{resource.resourceType}_#{profile}"
40
+ scratch[identifier.to_sym] ||= []
41
+ scratch[identifier.to_sym] |= [resource]
42
+ end
43
+ scratch[resource.resourceType.to_sym] ||= []
44
+ scratch[resource.resourceType.to_sym] |= [resource]
45
+ end
46
+ end
47
+ end
48
+
49
+ def previous_resource_requests(resource_type_tag)
50
+ previous_claims_data_request_resources_scratch(resource_type_tag)
51
+ scratch[resource_type_tag]
52
+ end
53
+
54
+ def previous_claims_data_search_parameters_scratch(resource_type_tag)
55
+ previous_claims_data_request_resources(resource_type_tag).each_key do |request|
56
+ endpoint_resource = resource_type_endpoint(request.url)
57
+ search_params = request.tags - [RESOURCE_API_TAG, resource_type_tag.to_s] - all_resource_types
58
+
59
+ scratch[:"#{endpoint_resource}Search"] ||= []
60
+ search_params.each do |search_param|
61
+ unless scratch[:"#{endpoint_resource}Search"].include?(search_param)
62
+ scratch[:"#{endpoint_resource}Search"].append(search_param)
63
+ end
64
+ end
65
+ end
66
+ scratch[:SavedSearchParams] = true
67
+ end
68
+
69
+ def resource_previous_search_params(resource_tag)
70
+ previous_claims_data_search_parameters_scratch(resource_tag)
71
+ scratch[resource_tag]
72
+ end
73
+
74
+ def resource_type_endpoint(url)
75
+ return unless url.start_with?('http://', 'https://')
76
+
77
+ match = %r{custom/c4bb_v200_client/fhir/(.*)\?}.match(url)
78
+ match[1] if match.present?
79
+ end
80
+
81
+ def connect_bundle(export_binary)
82
+ export_binary.split(/(?<=}\n)(?={)/).map { |str| FHIR.from_contents(str) }
83
+ end
84
+
85
+ def previous_claims_data_requests(resource_type_tag = nil)
86
+ load_tagged_requests(RESOURCE_API_TAG, resource_type_tag.to_s)
87
+ end
88
+
89
+ def flattened_all_resources
90
+ @flattened_all_resources ||= previous_claims_data_request_resources.values.flatten
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,19 @@
1
+ module CarinForBlueButtonTestKit
2
+ SET_TO_BE_GATHERED = { Coverage: ['c4bb-Coverage'],
3
+ ExplanationOfBenefit: ['c4bb-EOBInpatient', 'c4bb-EOBOral', 'c4bb-EOBOutpatient',
4
+ 'c4bb-EOBPharmacy', 'c4bb-EOBProfessional'],
5
+ Organization: ['c4bb-Organization'],
6
+ Patient: ['888'],
7
+ Practitioner: ['c4bb-Practitioner'],
8
+ RelatedPerson: ['c4bb-RelatedPerson'] }.freeze
9
+
10
+ SEARCHES_BY_PRIORITY = { Coverage: [['_id'], ['_lastUpdated'], ['patient']],
11
+ ExplanationOfBenefit: [['_id'], ['patient'], ['identifier'], ['_lastUpdated'],
12
+ ['service-date'], ['service-start-date'], ['billable-period-start'],
13
+ ['type'], ['_include']],
14
+ Organization: [['_id'], ['_lastUpdated'], ['name'], ['address']],
15
+ Patient: [['_id'], ['_lastUpdated'], ['birthdate'], ['family'], ['gender'], ['given'],
16
+ ['identifier'], ['name']],
17
+ Practitioner: [['_id'], ['_lastUpdated'], ['name'], ['identifier']],
18
+ RelatedPerson: [['_id'], ['_lastUpdated'], ['patient']] }.freeze
19
+ end