service_base_url_test_kit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +201 -0
- data/lib/service_base_url_test_kit/examples/CapabilityStatement.json +76 -0
- data/lib/service_base_url_test_kit/service_base_url_retrieve_group.rb +40 -0
- data/lib/service_base_url_test_kit/service_base_url_test_group.rb +30 -0
- data/lib/service_base_url_test_kit/service_base_url_validate_group.rb +201 -0
- data/lib/service_base_url_test_kit/version.rb +5 -0
- data/lib/service_base_url_test_kit.rb +99 -0
- metadata +122 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 619db239e23eb6699a6847a837ec7840893d5939aee5efffb9f37ed15cf4cfa4
|
4
|
+
data.tar.gz: 55648c6628c3ec98490aa1ff02af8de88c82ad169eaa2230e348c106c85bd471
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: adfb40eb360a33a88ab0ecdbf80e690b089b13a2e92d45cddb8174761354f51b8b71f53ef010d1ed4ceddbb2534fc576a01dbfb20bf08538087cbb6c9ae8049f
|
7
|
+
data.tar.gz: a26014365cc48d8c9e707a5cdebeec43b34f9fddf0543db53b6ae1fee301102e9e4e092fe2bebadae82933036af00bcd94eadcf0fa6aabe3e238ee653da2851b
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
@@ -0,0 +1,76 @@
|
|
1
|
+
{
|
2
|
+
"resourceType": "CapabilityStatement",
|
3
|
+
"status": "active",
|
4
|
+
"date": "2021-11-18T19:22:48+00:00",
|
5
|
+
"publisher": "Boston Children's Hospital",
|
6
|
+
"kind": "instance",
|
7
|
+
"instantiates": [
|
8
|
+
"http://hl7.org/fhir/uv/bulkdata/CapabilityStatement/bulk-data"
|
9
|
+
],
|
10
|
+
"software": {
|
11
|
+
"name": "SMART Sample Bulk Data Server",
|
12
|
+
"version": "2.1.1"
|
13
|
+
},
|
14
|
+
"implementation": {
|
15
|
+
"description": "SMART Sample Bulk Data Server"
|
16
|
+
},
|
17
|
+
"fhirVersion": "4.0.1",
|
18
|
+
"acceptUnknown": "extensions",
|
19
|
+
"format": [
|
20
|
+
"json"
|
21
|
+
],
|
22
|
+
"rest": [
|
23
|
+
{
|
24
|
+
"mode": "server",
|
25
|
+
"security": {
|
26
|
+
"extension": [
|
27
|
+
{
|
28
|
+
"url": "http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris",
|
29
|
+
"extension": [
|
30
|
+
{
|
31
|
+
"url": "token",
|
32
|
+
"valueUri": "https://inferno.healthit.gov/bulk-data-server/auth/token"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"url": "register",
|
36
|
+
"valueUri": "https://inferno.healthit.gov/bulk-data-server/auth/register"
|
37
|
+
}
|
38
|
+
]
|
39
|
+
}
|
40
|
+
],
|
41
|
+
"service": [
|
42
|
+
{
|
43
|
+
"coding": [
|
44
|
+
{
|
45
|
+
"system": "http://hl7.org/fhir/restful-security-service",
|
46
|
+
"code": "SMART-on-FHIR",
|
47
|
+
"display": "SMART-on-FHIR"
|
48
|
+
}
|
49
|
+
],
|
50
|
+
"text": "OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)"
|
51
|
+
}
|
52
|
+
]
|
53
|
+
},
|
54
|
+
"resource": [
|
55
|
+
{
|
56
|
+
"type": "Patient",
|
57
|
+
"operation": [
|
58
|
+
{
|
59
|
+
"name": "export",
|
60
|
+
"definition": "http://hl7.org/fhir/uv/bulkdata/OperationDefinition/patient-export"
|
61
|
+
}
|
62
|
+
]
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"type": "Group",
|
66
|
+
"operation": [
|
67
|
+
{
|
68
|
+
"name": "export",
|
69
|
+
"definition": "http://hl7.org/fhir/uv/bulkdata/OperationDefinition/group-export"
|
70
|
+
}
|
71
|
+
]
|
72
|
+
}
|
73
|
+
]
|
74
|
+
}
|
75
|
+
]
|
76
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module ServiceBaseURLTestKit
|
2
|
+
class ServiceBaseURLEndpointQueryGroup < Inferno::TestGroup
|
3
|
+
id :service_base_url_retrieve_list
|
4
|
+
title 'Retrieve Service Base URL List'
|
5
|
+
description %(
|
6
|
+
A developer's Service Base URL list must be publicly available. This test
|
7
|
+
issues a HTTP GET request against the supplied URL and expects to receive
|
8
|
+
the service base url list at this location.
|
9
|
+
)
|
10
|
+
run_as_group
|
11
|
+
|
12
|
+
input :service_base_url_list_url,
|
13
|
+
title: 'Service Base URL List URL',
|
14
|
+
description: 'The URL to the developer\'s public Service Base URL List'
|
15
|
+
|
16
|
+
http_client do
|
17
|
+
url :service_base_url_list_url
|
18
|
+
headers 'Accept': 'application/json, application/fhir+json'
|
19
|
+
end
|
20
|
+
|
21
|
+
test do
|
22
|
+
id :service_base_url_retrieve_list_test
|
23
|
+
title 'Server returns publicly accessible Service Base URL List'
|
24
|
+
description %(
|
25
|
+
Verify that the developer's list of Service Base URLs can be publicly
|
26
|
+
accessed at the supplied URL location.
|
27
|
+
)
|
28
|
+
|
29
|
+
output :bundle_response
|
30
|
+
|
31
|
+
makes_request :bundle_request
|
32
|
+
|
33
|
+
run do
|
34
|
+
get
|
35
|
+
assert_response_status(200)
|
36
|
+
output bundle_response: resource.to_json
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative 'service_base_url_validate_group'
|
2
|
+
require_relative 'service_base_url_retrieve_group'
|
3
|
+
|
4
|
+
module ServiceBaseURLTestKit
|
5
|
+
class ServiceBaseURLGroup < Inferno::TestGroup
|
6
|
+
id :service_base_url_test_group
|
7
|
+
title 'Retrieve and Validate Service Base URL List'
|
8
|
+
description %(
|
9
|
+
Verify that the developer makes its Service Base URL list publicly available
|
10
|
+
in the Bundle resource format with valid Endpoint and Organization entries.
|
11
|
+
This test group will issue a HTTP GET request against the supplied URL to
|
12
|
+
retrieve the developer's Service Base URL list and ensure the list is
|
13
|
+
publicly accessible. It will then ensure that the returned service base URL
|
14
|
+
list is in the Bundle resource format containing its service base URLs and
|
15
|
+
related organizational details in valid Endpoint and Organization resources
|
16
|
+
that follow the specifications detailed in the HTI-1 rule in the API
|
17
|
+
Condition and Maintenance of Certification.
|
18
|
+
|
19
|
+
For systems that provide the service base URL Bundle at a URL, please run
|
20
|
+
all tests within this group. While it is the expectation of the
|
21
|
+
specification for the service base URL Bundle to be served at a
|
22
|
+
public-facing endpoint, testers can validate a Service Base URL Bundle not
|
23
|
+
served at a public endpoint by running Test 1.2: Validate Service Base URL
|
24
|
+
List validation individually.
|
25
|
+
)
|
26
|
+
|
27
|
+
group from: :service_base_url_retrieve_list
|
28
|
+
group from: :service_base_url_validate_list
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
module ServiceBaseURLTestKit
|
2
|
+
class ServiceBaseURLBundleTestGroup < Inferno::TestGroup
|
3
|
+
id :service_base_url_validate_list
|
4
|
+
title 'Validate Service Base URL List'
|
5
|
+
description %(
|
6
|
+
These tests ensure that the developer's Service Base URL list is in the
|
7
|
+
Bundle resource format, with its service base URLs and organizational
|
8
|
+
details contained in valid Endpoint and Organization entries that follow
|
9
|
+
the specifications detailed in the HTI-1 rule in the API Condition and
|
10
|
+
Maintenance of Certification.
|
11
|
+
)
|
12
|
+
run_as_group
|
13
|
+
|
14
|
+
input :bundle_response,
|
15
|
+
title: 'Service Base URL List Bundle',
|
16
|
+
description: 'The developer\'s Service Base URL List in the JSON string format',
|
17
|
+
type: 'textarea'
|
18
|
+
|
19
|
+
# @private
|
20
|
+
def find_referenced_org(bundle_resource, endpoint_id)
|
21
|
+
bundle_resource
|
22
|
+
.entry
|
23
|
+
.map(&:resource)
|
24
|
+
.select { |resource| resource.resourceType == 'Organization' }
|
25
|
+
.map { |resource| resource.endpoint }
|
26
|
+
.flatten
|
27
|
+
.map(&:reference)
|
28
|
+
.select { |reference| reference.include? endpoint_id }
|
29
|
+
end
|
30
|
+
|
31
|
+
# @private
|
32
|
+
def find_referenced_endpoint(bundle_resource, endpoint_id_ref)
|
33
|
+
bundle_resource
|
34
|
+
.entry
|
35
|
+
.map(&:resource)
|
36
|
+
.select { |resource| resource.resourceType == 'Endpoint' }
|
37
|
+
.map(&:id)
|
38
|
+
.select { |endpoint_id| endpoint_id_ref.include? endpoint_id }
|
39
|
+
end
|
40
|
+
|
41
|
+
# Valid BUNDLE TESTS
|
42
|
+
test do
|
43
|
+
id :service_base_url_valid_bundle
|
44
|
+
title 'Server returns valid Bundle resource according to FHIR v4.0.1'
|
45
|
+
description %(
|
46
|
+
Verify that the returned Bundle of Service Base URLs is a valid Bundle resource and that it is not empty.
|
47
|
+
)
|
48
|
+
|
49
|
+
run do
|
50
|
+
skip_if bundle_response.blank?, 'No Bundle response was provided'
|
51
|
+
|
52
|
+
bundle_resource = FHIR.from_contents(bundle_response)
|
53
|
+
assert_valid_resource(resource: bundle_resource)
|
54
|
+
|
55
|
+
assert_resource_type(:bundle, resource: bundle_resource)
|
56
|
+
info do
|
57
|
+
assert !bundle_resource.entry.empty?, %(
|
58
|
+
The given Bundle does not contain any resources
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# VALID ENDPOINT TESTS
|
65
|
+
test do
|
66
|
+
id :service_base_url_valid_endpoints
|
67
|
+
title 'Service Base URL List contains valid Endpoint resources'
|
68
|
+
description %(
|
69
|
+
Verify that Bundle of Service Base URLs contains Endpoints that are
|
70
|
+
valid Endpoint resources according to the format defined in FHIR v4.0.1.
|
71
|
+
|
72
|
+
Each Endpoint must:
|
73
|
+
- Contain must have elements including:
|
74
|
+
- status
|
75
|
+
- connectionType
|
76
|
+
- address
|
77
|
+
- Contain a URL in the address field
|
78
|
+
- Have at least one Organization resource in the Bundle that references it
|
79
|
+
)
|
80
|
+
|
81
|
+
run do
|
82
|
+
|
83
|
+
skip_if bundle_response.blank?, 'No Bundle response was provided'
|
84
|
+
|
85
|
+
bundle_resource = FHIR.from_contents(bundle_response)
|
86
|
+
|
87
|
+
skip_if bundle_resource.entry.empty?, 'The given Bundle does not contain any resources'
|
88
|
+
|
89
|
+
assert_valid_bundle_entries(bundle: bundle_resource,
|
90
|
+
resource_types: {
|
91
|
+
'Endpoint': nil
|
92
|
+
}
|
93
|
+
)
|
94
|
+
|
95
|
+
endpoint_ids =
|
96
|
+
bundle_resource
|
97
|
+
.entry
|
98
|
+
.map(&:resource)
|
99
|
+
.select { |resource| resource.resourceType == 'Endpoint' }
|
100
|
+
.map(&:id)
|
101
|
+
|
102
|
+
|
103
|
+
for endpoint_id in endpoint_ids
|
104
|
+
endpoint_referenced_orgs = find_referenced_org(bundle_resource, endpoint_id)
|
105
|
+
assert !endpoint_referenced_orgs.empty?, "Endpoint with id: #{endpoint_id} does not have any associated Organizations in the Bundle."
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
# ENDPOINT VALID URL TESTS
|
112
|
+
test do
|
113
|
+
id :service_base_url_valid_urls
|
114
|
+
title 'All Endpoint resource referenced URLS should be valid and available'
|
115
|
+
description %(
|
116
|
+
Verify that Bundle of Service Base URLs contains Endpoints that contain service base URLs that are both valid and available.
|
117
|
+
)
|
118
|
+
|
119
|
+
output :testing
|
120
|
+
|
121
|
+
run do
|
122
|
+
skip_if bundle_response.blank?, 'No Bundle response was provided'
|
123
|
+
|
124
|
+
bundle_resource = FHIR.from_contents(bundle_response)
|
125
|
+
|
126
|
+
skip_if bundle_resource.entry.empty?, 'The given Bundle does not contain any resources'
|
127
|
+
|
128
|
+
|
129
|
+
bundle_resource
|
130
|
+
.entry
|
131
|
+
.map(&:resource)
|
132
|
+
.select { |resource| resource.resourceType == 'Endpoint' }
|
133
|
+
.map(&:address)
|
134
|
+
.each do |address|
|
135
|
+
assert_valid_http_uri(address)
|
136
|
+
|
137
|
+
address = address.delete_suffix("/")
|
138
|
+
get("#{address}/metadata", client: nil, headers: {'Accept': 'application/json, application/fhir+json'})
|
139
|
+
assert_response_status(200)
|
140
|
+
assert_resource_type(:capability_statement)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
# ORGANIZATION TESTS
|
147
|
+
test do
|
148
|
+
id :service_base_url_valid_organizations
|
149
|
+
title 'Service Base URL List contains valid Organization resources'
|
150
|
+
description %(
|
151
|
+
|
152
|
+
Verify that Bundle of Service Base URLs contains Organizations that are valid Organization resources according to the format defined in FHIR v4.0.1.
|
153
|
+
|
154
|
+
Each Organization must:
|
155
|
+
- Contain must have elements including:
|
156
|
+
- active
|
157
|
+
- name
|
158
|
+
- Include the organization's name, location, and provider identifier
|
159
|
+
- Use the endpoint field to reference Endpoints associated with the Organization:
|
160
|
+
- Must reference only Endpoint resources in the endpoint field
|
161
|
+
- Must reference at least one Endpoint resource in the endpoint field
|
162
|
+
- Must reference only Endpoints that are contained in the Service Base URL Bundle
|
163
|
+
)
|
164
|
+
|
165
|
+
run do
|
166
|
+
skip_if bundle_response.blank?, 'No Bundle response was provided'
|
167
|
+
|
168
|
+
bundle_resource = FHIR.from_contents(bundle_response)
|
169
|
+
|
170
|
+
skip_if bundle_resource.entry.empty?, 'The given Bundle does not contain any resources'
|
171
|
+
|
172
|
+
assert_valid_bundle_entries(bundle: bundle_resource,
|
173
|
+
resource_types: {
|
174
|
+
'Organization': nil
|
175
|
+
}
|
176
|
+
)
|
177
|
+
|
178
|
+
endpoint_ids =
|
179
|
+
bundle_resource
|
180
|
+
.entry
|
181
|
+
.map(&:resource)
|
182
|
+
.select { |resource| resource.resourceType == 'Endpoint' }
|
183
|
+
.map(&:id)
|
184
|
+
|
185
|
+
|
186
|
+
for organization in bundle_resource.entry.map(&:resource).select { |resource| resource.resourceType == 'Organization' }
|
187
|
+
|
188
|
+
assert !organization.endpoint.empty?, "Organization with id: #{organization.id} does not have the endpoint field populated"
|
189
|
+
assert !organization.address.empty?, "Organization with id: #{organization.id} does not have the address field populated"
|
190
|
+
|
191
|
+
|
192
|
+
for endpoint_id_ref in organization.endpoint.map(&:reference)
|
193
|
+
organization_referenced_endpts = find_referenced_endpoint(bundle_resource, endpoint_id_ref)
|
194
|
+
assert !organization_referenced_endpts.empty?, "Organization with id: #{organization.id} references an Endpoint that is not contained in this bundle."
|
195
|
+
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require_relative 'service_base_url_test_kit/version'
|
2
|
+
require_relative 'service_base_url_test_kit/service_base_url_test_group'
|
3
|
+
require 'erb'
|
4
|
+
|
5
|
+
module ServiceBaseURLTestKit
|
6
|
+
class ServiceBaseURLTestSuite < Inferno::TestSuite
|
7
|
+
id :service_base_url_test_kit_suite
|
8
|
+
title 'Service Base URL Test Suite'
|
9
|
+
description %(
|
10
|
+
This test kit provides a draft set of tests to validate conformance to
|
11
|
+
[HTI-1](https://www.healthit.gov/topic/laws-regulation-and-policy/health-data-technology-and-interoperability-certification-program)
|
12
|
+
[rule](https://www.ecfr.gov/current/title-45/subtitle-A/subchapter-D/part-170/subpart-D/section-170.404#p-170.404(b)(2))
|
13
|
+
from the API Condition and Maintenance of Certification to include the
|
14
|
+
requirement for Certified API Developers with patient-facing apps to
|
15
|
+
publish their service base URLs in [a specified
|
16
|
+
format](https://www.federalregister.gov/d/2023-07229/p-2342).
|
17
|
+
|
18
|
+
A Certified API developer must publish, at no charge, the service base
|
19
|
+
URLs and related organizational details that can be used by patients to
|
20
|
+
access their electronic health information. This test kit will test that a
|
21
|
+
server's service base URL list conforms to the following:
|
22
|
+
- Service base URL list is publicly accessible
|
23
|
+
- Service based URLs are published in the Endpoint resource format
|
24
|
+
according to the standard adopted in § 170.215\(a\) - FHIR 4.0.1 release
|
25
|
+
- Organization details for each service base URL are published in the
|
26
|
+
Organization resource format according to the standard adopted in §
|
27
|
+
170.215\(a\) - FHIR 4.0.1 release
|
28
|
+
- Each Endpoint resource must:
|
29
|
+
- Have at least one Organization resource that references it in the Bundle
|
30
|
+
- Each Organization resource must:
|
31
|
+
- Have a populated Organization.endpoint field that contains
|
32
|
+
references to the Endpoint resources containing service base URLs
|
33
|
+
managed by this organization
|
34
|
+
- Contain the organization's name, location, and provider identifier
|
35
|
+
- Endpoint and Organization resources must be:
|
36
|
+
- Collected into a Bundle resource formatted according to the standard
|
37
|
+
adopted in FHIR v4.0.1: § 170.215\(a\) for publication
|
38
|
+
|
39
|
+
This test kit is provided as a preview for feedback and is not currently
|
40
|
+
intended for certification. A version of these tests will be migrated into
|
41
|
+
a future version of the [ONC (g)(10) Standardized API Test
|
42
|
+
Kit](https://github.com/onc-healthit/onc-certification-g10-test-kit).
|
43
|
+
|
44
|
+
While these tests do not specifically verify conformance to
|
45
|
+
[Patient-Access
|
46
|
+
Brands](https://build.fhir.org/ig/HL7/smart-app-launch/brands.html) within
|
47
|
+
the draft SMART App Launch v2.2.0 standard, systems that implement that
|
48
|
+
standard should pass these tests. Please report an issue if there are any
|
49
|
+
problems.
|
50
|
+
|
51
|
+
The tests within this test kit are available for developers that would
|
52
|
+
like to evaluate their service list against the specified format. This is
|
53
|
+
a draft set of tests and may contain errors or issues. Please provide
|
54
|
+
feedback on these tests by reporting an issue in
|
55
|
+
[GitHub](https://github.com/inferno-framework/service-base-url-test-kit/issues),
|
56
|
+
or by reaching out to the team on the [Inferno FHIR Zulip
|
57
|
+
channel](https://chat.fhir.org/#narrow/stream/179309-inferno).
|
58
|
+
)
|
59
|
+
version VERSION
|
60
|
+
|
61
|
+
links [
|
62
|
+
{
|
63
|
+
label: 'Report Issue',
|
64
|
+
url: 'https://github.com/inferno-framework/service-base-url-test-kit/issues'
|
65
|
+
},
|
66
|
+
{
|
67
|
+
label: 'Open Source',
|
68
|
+
url: 'https://github.com/inferno-framework/service-base-url-test-kit'
|
69
|
+
}
|
70
|
+
]
|
71
|
+
|
72
|
+
Dir.each_child(File.join(__dir__, '/service_base_url_test_kit/examples/')) do |filename|
|
73
|
+
my_bundle = File.read(File.join(__dir__, 'service_base_url_test_kit/examples/', filename))
|
74
|
+
if filename.end_with?('.erb')
|
75
|
+
erb_template = ERB.new(my_bundle)
|
76
|
+
my_bundle = JSON.parse(erb_template.result).to_json
|
77
|
+
filename = filename.delete_suffix('.erb')
|
78
|
+
end
|
79
|
+
if filename.include?("CapabilityStatement")
|
80
|
+
filename = filename.delete_suffix('.json') + "/metadata"
|
81
|
+
end
|
82
|
+
my_bundle_route_handler = proc { [200, { 'Content-Type' => 'application/json' }, [my_bundle]] }
|
83
|
+
|
84
|
+
# Serve a JSON file at INFERNO_PATH/custom/service_base_url_test_kit_suite/examples/filename
|
85
|
+
route :get, File.join('/examples/', filename), my_bundle_route_handler
|
86
|
+
end
|
87
|
+
|
88
|
+
# All FHIR validation requests will use this FHIR validator
|
89
|
+
validator :default do
|
90
|
+
url ENV.fetch('VALIDATOR_URL', 'http://validator_service:4567')
|
91
|
+
|
92
|
+
exclude_message do |message|
|
93
|
+
message.message.include?('A resource should have narrative for robust management')
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
group from: :service_base_url_test_group
|
98
|
+
end
|
99
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: service_base_url_test_kit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Inferno Team
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-02-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: inferno_core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.4.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.4.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: database_cleaner-sequel
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: factory_bot
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '6.1'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '6.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.11'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.11'
|
83
|
+
description: Inferno Service Base URL Test Kit
|
84
|
+
email:
|
85
|
+
- inferno@groups.mitre.org
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- LICENSE
|
91
|
+
- lib/service_base_url_test_kit.rb
|
92
|
+
- lib/service_base_url_test_kit/examples/CapabilityStatement.json
|
93
|
+
- lib/service_base_url_test_kit/service_base_url_retrieve_group.rb
|
94
|
+
- lib/service_base_url_test_kit/service_base_url_test_group.rb
|
95
|
+
- lib/service_base_url_test_kit/service_base_url_validate_group.rb
|
96
|
+
- lib/service_base_url_test_kit/version.rb
|
97
|
+
homepage: https://github.com/inferno-framework/service-base-url-test-kit
|
98
|
+
licenses:
|
99
|
+
- Apache-2.0
|
100
|
+
metadata:
|
101
|
+
homepage_uri: https://github.com/inferno-framework/service-base-url-test-kit
|
102
|
+
source_code_uri: https://github.com/inferno-framework/service-base-url-test-kit
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: 3.1.2
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
requirements: []
|
118
|
+
rubygems_version: 3.3.7
|
119
|
+
signing_key:
|
120
|
+
specification_version: 4
|
121
|
+
summary: Inferno Service Base URL Test Kit
|
122
|
+
test_files: []
|