bulk_data_test_kit 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/lib/bulk_data_test_kit/bulk_data_jwks.json +58 -0
  4. data/lib/bulk_data_test_kit/bulk_data_test_kit_properties.rb +20 -0
  5. data/lib/bulk_data_test_kit/bulk_export_validation_tester.rb +214 -0
  6. data/lib/bulk_data_test_kit/export_cancel_tests.rb +43 -0
  7. data/lib/bulk_data_test_kit/export_kick_off_performer.rb +26 -0
  8. data/lib/bulk_data_test_kit/export_operation_tests.rb +171 -0
  9. data/lib/bulk_data_test_kit/export_parameters_tests.rb +49 -0
  10. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_export_cancel_test.rb +35 -0
  11. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_export_kick_off_test.rb +37 -0
  12. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_export_operation_support_test.rb +46 -0
  13. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_export_tests_test_group.rb +41 -0
  14. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_group_export_test_group.rb +24 -0
  15. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_multiple_patients_test.rb +23 -0
  16. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_ndjson_download_test.rb +33 -0
  17. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_no_auth_test.rb +35 -0
  18. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_output_check_test.rb +45 -0
  19. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_patient_export_test_group.rb +24 -0
  20. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_smart_backend_services_group.rb +21 -0
  21. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_status_check_test.rb +43 -0
  22. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_system_export_test_group.rb +24 -0
  23. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_test_suite.rb +166 -0
  24. data/lib/bulk_data_test_kit/v1.0.1/bulk_data_valid_resources_test.rb +30 -0
  25. data/lib/bulk_data_test_kit/v1.0.1/group/bulk_data_group_export_cancel_group.rb +32 -0
  26. data/lib/bulk_data_test_kit/v1.0.1/group/bulk_data_group_export_group.rb +102 -0
  27. data/lib/bulk_data_test_kit/v1.0.1/group/bulk_data_group_export_validation_group.rb +51 -0
  28. data/lib/bulk_data_test_kit/v1.0.1/patient/bulk_data_patient_export_cancel_group.rb +32 -0
  29. data/lib/bulk_data_test_kit/v1.0.1/patient/bulk_data_patient_export_group.rb +108 -0
  30. data/lib/bulk_data_test_kit/v1.0.1/patient/bulk_data_patient_export_validation_group.rb +63 -0
  31. data/lib/bulk_data_test_kit/v1.0.1/system_export/bulk_data_system_export_cancel_group.rb +32 -0
  32. data/lib/bulk_data_test_kit/v1.0.1/system_export/bulk_data_system_export_group.rb +108 -0
  33. data/lib/bulk_data_test_kit/v1.0.1/system_export/bulk_data_system_export_validation_group.rb +63 -0
  34. data/lib/bulk_data_test_kit/v2.0.0/bulk_data_export_cancel_test.rb +28 -0
  35. data/lib/bulk_data_test_kit/v2.0.0/bulk_data_export_tests_test_group.rb +41 -0
  36. data/lib/bulk_data_test_kit/v2.0.0/bulk_data_group_export_test_group.rb +35 -0
  37. data/lib/bulk_data_test_kit/v2.0.0/bulk_data_outputFormat_param_test.rb +36 -0
  38. data/lib/bulk_data_test_kit/v2.0.0/bulk_data_patient_export_test_group.rb +35 -0
  39. data/lib/bulk_data_test_kit/v2.0.0/bulk_data_since_param_test.rb +48 -0
  40. data/lib/bulk_data_test_kit/v2.0.0/bulk_data_system_export_test_group.rb +35 -0
  41. data/lib/bulk_data_test_kit/v2.0.0/bulk_data_test_suite.rb +165 -0
  42. data/lib/bulk_data_test_kit/v2.0.0/group/bulk_data_group_export_cancel_group.rb +15 -0
  43. data/lib/bulk_data_test_kit/v2.0.0/group/bulk_data_group_export_parameters_group.rb +40 -0
  44. data/lib/bulk_data_test_kit/v2.0.0/patient/bulk_data_patient_export_cancel_group.rb +18 -0
  45. data/lib/bulk_data_test_kit/v2.0.0/patient/bulk_data_patient_export_parameters_group.rb +37 -0
  46. data/lib/bulk_data_test_kit/v2.0.0/system_export/bulk_data_system_export_cancel_group.rb +18 -0
  47. data/lib/bulk_data_test_kit/v2.0.0/system_export/bulk_data_system_export_parameters_group.rb +37 -0
  48. data/lib/bulk_data_test_kit/version.rb +5 -0
  49. data/lib/bulk_data_test_kit.rb +4 -0
  50. metadata +289 -0
@@ -0,0 +1,108 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tls_test_kit'
4
+ require_relative '../bulk_data_export_operation_support_test'
5
+ require_relative '../bulk_data_no_auth_test'
6
+ require_relative '../bulk_data_export_kick_off_test'
7
+ require_relative '../bulk_data_status_check_test'
8
+ require_relative '../bulk_data_output_check_test'
9
+
10
+ module BulkDataTestKit
11
+ module BulkDataV101
12
+ class BulkDataSystemExportGroup < Inferno::TestGroup
13
+ title 'System Level Export Tests'
14
+ short_description 'Verify that the server supports system level bulk data export.'
15
+ description <<~DESCRIPTION
16
+ Verify that system level export on the Bulk Data server follow the Bulk Data Access Implementation Guide
17
+ DESCRIPTION
18
+ id :bulk_data_system_export_group
19
+
20
+ input :bearer_token,
21
+ title: 'Bulk Data Authorization Bearer Token',
22
+ description: 'The authorization bearer token for the Bulk FHIR server. If not required, leave blank.',
23
+ optional: true
24
+ input :bulk_server_url,
25
+ title: 'Bulk Data FHIR URL',
26
+ description: 'The URL of the Bulk FHIR server.'
27
+ input :bulk_timeout,
28
+ title: 'Export Times Out after (1-600)',
29
+ description: <<~DESCRIPTION,
30
+ While testing, Inferno waits for the server to complete the exporting task. If the calculated totalTime is
31
+ greater than the timeout value specified here, Inferno bulk client stops testing. Please enter an integer
32
+ for the maximum wait time in seconds. If timeout is less than 1, Inferno uses default value 180. If the
33
+ timeout is greater than 600 (10 minutes), Inferno uses the maximum value 600.
34
+ DESCRIPTION
35
+ default: 180
36
+
37
+ output :system_requires_access_token, :system_status_output, :system_bulk_download_url
38
+
39
+ test from: :bulk_data_export_operation_support do
40
+ title 'Bulk Data Server declares support for system level export operation in CapabilityStatement'
41
+ description <<~DESCRIPTION
42
+ This test verifies that the Bulk Data Server declares support for
43
+ `/$export` operation in its server CapabilityStatement.
44
+
45
+ Given flexibility in the FHIR specification for declaring constrained
46
+ OperationDefinitions, this test only verifies that the server declares
47
+ any operation within the Capability Statement's server operation list.
48
+ It does not verify that it declares the standard system level export
49
+ OperationDefinition provided in the Bulk Data specification, nor does
50
+ it attempt to resolve any non-standard OperationDefinitions to verify if
51
+ it is a constrained version of the standard OperationDefintion.
52
+
53
+ This test will provide a warning if no operations are declared at
54
+ `/$export`, via the
55
+ `CapabilityStatement.rest.operation.name` element. It will
56
+ also provide an informational message if an operation within the Capability
57
+ Statement's server operation list exists, but does not point to the standard
58
+ OperationDefinition canonical URL:
59
+ http://hl7.org/fhir/uv/bulkdata/OperationDefinition/export
60
+
61
+ Additionally, this test provides a warning if the bulk data server does
62
+ not include the following URL in its `CapabilityStatement.instantiates`
63
+ element: http://hl7.org/fhir/uv/bulkdata/CapabilityStatement/bulk-data
64
+ DESCRIPTION
65
+ id :bulk_data_system_export_operation_support
66
+
67
+ config(
68
+ options: { resource_type: 'system' }
69
+ )
70
+ end
71
+
72
+ test from: :bulk_data_no_auth_reject,
73
+ id: :bulk_data_system_no_auth_reject,
74
+ config: {
75
+ options: { resource_type: 'system', bulk_export_url: '$export' }
76
+ }
77
+
78
+ test from: :bulk_data_kick_off,
79
+ id: :bulk_data_system_kick_off,
80
+ config: {
81
+ outputs: { polling_url: { name: :system_polling_url } },
82
+ options: { resource_type: 'system', bulk_export_url: '$export' }
83
+ }
84
+
85
+ test from: :bulk_data_status_check,
86
+ id: :bulk_data_system_status_check,
87
+ config: {
88
+ inputs: { polling_url: { name: :system_polling_url } },
89
+ outputs: {
90
+ status_response: { name: :system_status_response },
91
+ requires_access_token: { name: :system_requires_access_token }
92
+ },
93
+ options: { resource_type: 'system' }
94
+ }
95
+
96
+ test from: :bulk_data_output_check,
97
+ id: :bulk_data_system_output_check,
98
+ config: {
99
+ inputs: { status_response: { name: :system_status_response } },
100
+ outputs: {
101
+ status_output: { name: :system_status_output },
102
+ bulk_download_url: { name: :system_bulk_download_url }
103
+ },
104
+ options: { resource_type: 'system' }
105
+ }
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../bulk_data_multiple_patients_test'
4
+ require_relative '../bulk_data_ndjson_download_test'
5
+ require_relative '../bulk_data_valid_resources_test'
6
+
7
+ module BulkDataTestKit
8
+ module BulkDataV101
9
+ class BulkDataSystemExportValidation < Inferno::TestGroup
10
+ title 'System Level Export Validation Tests'
11
+ short_description 'Verify that the data returned from system level export conforms to the base FHIR standard.'
12
+ description <<~DESCRIPTION
13
+ Verify that system level export from the Bulk Data server follow the base FHIR standard
14
+ DESCRIPTION
15
+
16
+ id :bulk_data_system_export_validation
17
+
18
+ input :system_status_output, :system_requires_access_token, :bearer_token, :system_bulk_download_url
19
+ input :lines_to_validate,
20
+ title: 'Limit validation to a maximum resource count',
21
+ description: 'To validate all, leave blank.',
22
+ optional: true
23
+
24
+ test from: :tls_version_test do
25
+ title 'Bulk Data Server is secured by transport layer security'
26
+ description <<~DESCRIPTION
27
+ [§170.315(g)(10) Test Procedure]
28
+ (https://www.healthit.gov/test-method/standardized-api-patient-and-population-services)
29
+ requires that all exchanges described herein between a client and a
30
+ server SHALL be secured using Transport Layer Security (TLS)
31
+ Protocol Version 1.2 (RFC5246).
32
+ DESCRIPTION
33
+ id :bulk_file_server_tls_version
34
+
35
+ config(
36
+ inputs: { url: { name: :system_bulk_download_url } },
37
+ options: { minimum_allowed_version: OpenSSL::SSL::TLS1_2_VERSION }
38
+ )
39
+ end
40
+
41
+ test from: :bulk_data_ndjson_download,
42
+ id: :bulk_data_system_ndjson_download,
43
+ config: {
44
+ inputs: {
45
+ bulk_download_url: { name: :system_bulk_download_url },
46
+ requires_access_token: { name: :system_requires_access_token }
47
+ }
48
+ }
49
+
50
+ test from: :bulk_data_valid_resources,
51
+ id: :bulk_data_system_valid_resources,
52
+ config: {
53
+ inputs: {
54
+ status_output: { name: :system_status_output },
55
+ requires_access_token: { name: :system_requires_access_token }
56
+ }
57
+ }
58
+
59
+ test from: :bulk_data_multiple_patients,
60
+ id: :bulk_data_system_multiple_patients
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../export_cancel_tests'
4
+
5
+ module BulkDataTestKit
6
+ module BulkDataV200
7
+ class BulkDataExportCancelTest < Inferno::Test
8
+ include BulkDataTestKit::BulkDataExportCancelTests
9
+
10
+ title 'Bulk Data Server returns a 404 and OperationOutcome for polling requests to cancelled exports'
11
+ description <<~DESCRIPTION
12
+ > Following the delete request, when subsequent requests are made to the
13
+ polling location, the server SHALL return a 404 Not Found error and an
14
+ associated FHIR OperationOutcome in JSON format.
15
+
16
+ http://hl7.org/fhir/uv/bulkdata/STU2/export.html#bulk-data-delete-request
17
+ DESCRIPTION
18
+
19
+ id :bulk_data_export_cancel_stu2
20
+
21
+ input :cancelled_polling_url
22
+
23
+ run do
24
+ perform_cancelled_polling_test(cancelled_polling_url)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'bulk_data_group_export_test_group'
4
+ require_relative 'bulk_data_patient_export_test_group'
5
+ require_relative 'bulk_data_system_export_test_group'
6
+
7
+ module BulkDataTestKit
8
+ module BulkDataV200
9
+ class BulkDataSmartBackendServicesGroupV200 < Inferno::TestGroup
10
+ id :bulk_data_export_tests_v200
11
+ title 'Bulk Data Export Tests'
12
+
13
+ group do
14
+ id :bulk_data_server_tests_stu2
15
+ title 'Bulk Data Server TLS Tests'
16
+ run_as_group
17
+
18
+ test from: :tls_version_test do
19
+ title 'Bulk Data Server is secured by transport layer security'
20
+ description <<~DESCRIPTION
21
+ [§170.315(g)(10) Test
22
+ Procedure](https://www.healthit.gov/test-method/standardized-api-patient-and-population-services)
23
+ requires that all exchanges described herein between a client and a
24
+ server SHALL be secured using Transport Layer Security (TLS) Protocol
25
+ Version 1.2 (RFC5246).
26
+ DESCRIPTION
27
+ id :bulk_data_server_tls_version_stu2
28
+
29
+ config(
30
+ inputs: { url: { name: :bulk_server_url } },
31
+ options: { minimum_allowed_version: OpenSSL::SSL::TLS1_2_VERSION }
32
+ )
33
+ end
34
+ end
35
+
36
+ group from: :bulk_data_group_export_v200
37
+ group from: :bulk_data_patient_export_v200
38
+ group from: :bulk_data_system_export_v200
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'group/bulk_data_group_export_cancel_group'
4
+ require_relative 'group/bulk_data_group_export_parameters_group'
5
+ require_relative '../v1.0.1/group/bulk_data_group_export_group'
6
+ require_relative '../v1.0.1/group/bulk_data_group_export_validation_group'
7
+
8
+ module BulkDataTestKit
9
+ module BulkDataV200
10
+ class BulkDataGroupTestGroup < Inferno::TestGroup
11
+ title 'Bulk Data Group API Tests'
12
+ id :bulk_data_group_export_v200
13
+ run_as_group
14
+
15
+ description %(
16
+ The Bulk Data Access API Tests evaluate the ability of a system (Bulk Data Server)
17
+ to support required Bulk Data Group $export operation.
18
+ )
19
+
20
+ group from: :bulk_data_group_export_group,
21
+ title: 'Group Compartment Export Tests STU2',
22
+ id: :bulk_data_group_export_group_stu2,
23
+ config: {
24
+ options: { require_absolute_urls_in_output: true }
25
+ }
26
+
27
+ group from: :bulk_data_group_export_validation,
28
+ title: 'Group Compartment Export Validation Tests STU2',
29
+ id: :bulk_data_group_export_validation_stu2
30
+
31
+ group from: :bulk_data_group_export_cancel_group_stu2
32
+ group from: :bulk_data_group_export_parameters_group
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../export_parameters_tests'
4
+
5
+ module BulkDataTestKit
6
+ module BulkDataV200
7
+ class BulkDataOutputFormatParamTest < Inferno::Test
8
+ include BulkDataTestKit::BulkDataExportParametersTests
9
+ include BulkDataTestKit::ExportKickOffPerformer
10
+
11
+ id :output_format_in_export_response
12
+
13
+ title 'Bulk Data Server supports "_outputFormat" query parameter for bulk data export'
14
+ description <<~DESCRIPTION
15
+ [_outputFormat](http://hl7.org/fhir/uv/bulkdata/STU2/export.html#query-parameters):
16
+ The format for the requested Bulk Data files to be
17
+ generated as per FHIR Asynchronous Request Pattern. Defaults to
18
+ application/fhir+ndjson. The server SHALL support Newline Delimited
19
+ JSON, but MAY choose to support additional output formats. The server
20
+ SHALL accept the full content type of application/fhir+ndjson as well
21
+ as the abbreviated representations application/ndjson and ndjson.
22
+ DESCRIPTION
23
+
24
+ def self.properties
25
+ @properties ||= BulkDataTestKitProperties.new(
26
+ resource_type: config.options[:resource_type],
27
+ bulk_export_url: config.options[:bulk_export_url]
28
+ )
29
+ end
30
+
31
+ run do
32
+ perform_outputFormat_param_test
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'patient/bulk_data_patient_export_cancel_group'
4
+ require_relative 'patient/bulk_data_patient_export_parameters_group'
5
+ require_relative '../v1.0.1/patient/bulk_data_patient_export_group'
6
+ require_relative '../v1.0.1/patient/bulk_data_patient_export_validation_group'
7
+
8
+ module BulkDataTestKit
9
+ module BulkDataV200
10
+ class BulkDataPatientTestGroup < Inferno::TestGroup
11
+ title 'Bulk Data Patient API Tests'
12
+ id :bulk_data_patient_export_v200
13
+ run_as_group
14
+
15
+ description %(
16
+ The Bulk Data Access API Tests evaluate the ability of a system (Bulk Data Server)
17
+ to support required Bulk Data $export operation.
18
+ )
19
+
20
+ group from: :bulk_data_patient_export_group,
21
+ title: 'Patient Export Tests STU2',
22
+ id: :bulk_data_patient_export_group_stu2,
23
+ config: {
24
+ options: { require_absolute_urls_in_output: true }
25
+ }
26
+
27
+ group from: :bulk_data_patient_export_validation,
28
+ title: 'All Patient Export Validation Tests STU2',
29
+ id: :bulk_data_patient_export_validation_stu2
30
+
31
+ group from: :bulk_data_patient_export_cancel_group_stu2
32
+ group from: :bulk_data_patient_export_parameters_group
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../export_parameters_tests'
4
+
5
+ module BulkDataTestKit
6
+ module BulkDataV200
7
+ class BulkDataSinceParamTest < Inferno::Test
8
+ include BulkDataTestKit::BulkDataExportParametersTests
9
+ include BulkDataTestKit::ExportKickOffPerformer
10
+
11
+ id :since_in_export_response
12
+
13
+ title 'Bulk Data Server supports "_since" query parameter for bulk data export'
14
+ description <<~DESCRIPTION
15
+ This test verifies that the server accepts an export request with the
16
+ `[_since](http://hl7.org/fhir/uv/bulkdata/STU2/export.html#query-parameters)`
17
+ query parameter. It initiates a new export using a _since parameter of
18
+ one week ago, and ensures that the export was initiated succesfully.
19
+
20
+ The test does not attempt to verify that resources returned were
21
+ modified after the _since date that was requested, because the Bulk Data
22
+ specification provides latitude in determining exactly what data is
23
+ returned by the server. The purpose of this test is to ensure that
24
+ export requests with this parameter are accepted and to highlight that
25
+ support of this parameter is required.
26
+
27
+ After the export was successfully initiated, it is then cancelled.
28
+ DESCRIPTION
29
+
30
+ input :since_timestamp,
31
+ title: 'Timestamp for _since parameter',
32
+ description: 'A timestamp formatted as a FHIR instant which will be used to test the ' \
33
+ "server's support for the `_since` query parameter",
34
+ default: 1.week.ago.iso8601
35
+
36
+ def self.properties
37
+ @properties ||= BulkDataTestKitProperties.new(
38
+ resource_type: config.options[:resource_type],
39
+ bulk_export_url: config.options[:bulk_export_url]
40
+ )
41
+ end
42
+
43
+ run do
44
+ perform_since_param_test(since_timestamp)
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'system_export/bulk_data_system_export_cancel_group'
4
+ require_relative 'system_export/bulk_data_system_export_parameters_group'
5
+ require_relative '../v1.0.1/system_export/bulk_data_system_export_group'
6
+ require_relative '../v1.0.1/system_export/bulk_data_system_export_validation_group'
7
+
8
+ module BulkDataTestKit
9
+ module BulkDataV200
10
+ class BulkDataSystemExportTestGroup < Inferno::TestGroup
11
+ title 'Bulk Data System Level Export API Tests'
12
+ id :bulk_data_system_export_v200
13
+ run_as_group
14
+
15
+ description %(
16
+ The Bulk Data Access API Tests evaluate the ability of a system (Bulk
17
+ Data Server) to support required Bulk Data $export operation.
18
+ )
19
+
20
+ group from: :bulk_data_system_export_group,
21
+ title: 'System Level Export Tests STU2',
22
+ id: :bulk_data_system_export_group_stu2,
23
+ config: {
24
+ options: { require_absolute_urls_in_output: true }
25
+ }
26
+
27
+ group from: :bulk_data_system_export_validation,
28
+ title: 'System Level Export Validation Tests STU2',
29
+ id: :bulk_data_system_export_validation_stu2
30
+
31
+ group from: :bulk_data_system_export_cancel_group_stu2
32
+ group from: :bulk_data_system_export_parameters_group
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,165 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../version'
4
+ require_relative '../v1.0.1/bulk_data_smart_backend_services_group'
5
+ require_relative 'bulk_data_export_tests_test_group'
6
+
7
+ module BulkDataTestKit
8
+ module BulkDataV200
9
+ class BulkDataTestSuite < Inferno::TestSuite
10
+ title 'Bulk Data Access v2.0.0'
11
+ version VERSION
12
+ id :bulk_data_v200
13
+ links [
14
+ {
15
+ label: 'Report Issue',
16
+ url: 'https://github.com/onc-healthit/bulk_data_test_kit/issues/'
17
+ },
18
+ {
19
+ label: 'Open Source',
20
+ url: 'https://github.com/onc-healthit/bulk_data_test_kit/'
21
+ },
22
+ {
23
+ label: 'Download',
24
+ url: 'https://github.com/onc-healthit/bulk_data_test_kit/releases'
25
+ }
26
+ ]
27
+
28
+ VALIDATION_MESSAGE_FILTERS = [
29
+ /Observation\.effective\.ofType\(Period\): .*vs-1:/ # Invalid invariant in FHIR v4.0.1
30
+ ].freeze
31
+
32
+ VERSION_SPECIFIC_MESSAGE_FILTERS = [].freeze
33
+
34
+ validator do
35
+ url ENV.fetch('BULK_DATA_VALIDATOR_URL', 'http://validator_service:4567')
36
+
37
+ message_filters = VALIDATION_MESSAGE_FILTERS + VERSION_SPECIFIC_MESSAGE_FILTERS
38
+
39
+ $num_messages = 0
40
+ $capped_message = false
41
+ $num_errors = 0
42
+ $capped_errors = false
43
+
44
+ exclude_message do |message|
45
+ if message.type != 'error'
46
+ $num_messages += 1
47
+ else
48
+ $num_errors += 1
49
+ end
50
+
51
+ message_filters.any? { |filter| filter.match? message.message } ||
52
+ (message.type != 'error' && $num_messages > 50 && !message.message.include?('Inferno is only showing the first')) ||
53
+ (message.type == 'error' && $num_errors > 20 && !message.message.include?('Inferno is only showing the first'))
54
+ end
55
+
56
+ perform_additional_validation do
57
+ if $num_messages > 50 && !$capped_message
58
+ $capped_message = true
59
+ { type: 'info', message: 'Inferno is only showing the first 50 validation info and warning messages.' }
60
+ elsif $num_errors > 20 && !$capped_errors
61
+ $capped_errors = true
62
+ { type: 'error', message: 'Inferno is only showing the first 20 validation error messages.' }
63
+ end
64
+ end
65
+ end
66
+
67
+ def self.jwks_json
68
+ bulk_data_jwks = JSON.parse(File.read(
69
+ ENV.fetch('BULK_DATA_JWKS',
70
+ File.join(File.expand_path('..', __dir__), 'bulk_data_jwks.json'))
71
+ ))
72
+ @jwks_json ||= JSON.pretty_generate(
73
+ { keys: bulk_data_jwks['keys'].select { |key| key['key_ops']&.include?('verify') } }
74
+ )
75
+ end
76
+
77
+ def self.well_known_route_handler
78
+ ->(_env) { [200, { 'Content-Type' => 'application/json' }, [jwks_json]] }
79
+ end
80
+
81
+ route(
82
+ :get,
83
+ '/.well-known/jwks.json',
84
+ well_known_route_handler
85
+ )
86
+
87
+ config(
88
+ inputs: {
89
+ client_auth_encryption_method: {
90
+ title: 'Client Authentication Encryption Method',
91
+ locked: true
92
+ }
93
+ },
94
+ options: {
95
+ post_authorization_uri: "#{Inferno::Application['base_url']}/custom/smart_stu2/post_auth"
96
+ }
97
+ )
98
+
99
+ description %(
100
+ The Bulk Data Access Test Kit is a testing tool that will demonstrate
101
+ the ability to exporting bulk data from a FHIR server to a
102
+ pre-authorized client following the criterion from the [FHIR Bulk Data
103
+ Access IG](http://build.fhir.org/ig/HL7/bulk-data).
104
+
105
+ This test kit is split into three different types of bulk data export:
106
+ - All Patients: FHIR Operation to obtain a detailed set of FHIR resources
107
+ of diverse resource types pertaining to all patients
108
+ - Group of Patients: FHIR Operation to obtain a detailed set of FHIR
109
+ resources of diverse resource types pertaining to all members of a
110
+ specified Group
111
+ - System Level Export: FHIR Operation to export data from a FHIR server,
112
+ whether or not it is associated with a patient
113
+
114
+ This test kit uses [Backend Services
115
+ Authorization](https://www.hl7.org/fhir/smart-app-launch/backend-services.html)
116
+ to obtain an access token from the server. After authorization, a group
117
+ level, patient level, and system level bulk data export request is
118
+ initialized, and for each type of export, the tests read exported NDJSON
119
+ files from the server and validate the resources in each file. It is
120
+ expected the server will provide Encounter, Location, Organization, and
121
+ Practitioner resources as they are referenced as must support elements
122
+ in required resources.
123
+
124
+ To get started, if your server supports SMART backend services
125
+ authorization, please first register Inferno with the following JWK Set
126
+ URL:
127
+
128
+ * `#{Inferno::Application[:base_url]}/custom/bulk_data_v200/.well-known/jwks.json`
129
+
130
+ Then, run the full Bulk Data Access test suite containing both the SMART
131
+ Backend Services test group and the Bulk Data Export Tests test group.
132
+ Otherwise, if your server does not support SMART Backend Services
133
+ authorization, only run the second test group, Bulk Data Export Tests.
134
+ )
135
+
136
+ input_instructions %(
137
+ Register Inferno as a bulk data client with the following information,
138
+ and enter the client id and client registration in the appropriate
139
+ fields. This set of tests only checks the Group export. Enter the group
140
+ export information in the appropriate box.
141
+
142
+ Register Inferno with the following JWK Set Url:
143
+
144
+ * `#{Inferno::Application[:base_url]}/custom/bulk_data_v200/.well-known/jwks.json`
145
+ )
146
+
147
+ input :bulk_server_url,
148
+ title: 'Bulk Data FHIR URL',
149
+ description: 'The URL of the Bulk FHIR server.'
150
+
151
+ fhir_client :bulk_server do
152
+ url :bulk_server_url
153
+ end
154
+
155
+ http_client :bulk_server do
156
+ url :bulk_server_url
157
+ end
158
+
159
+ group from: :bulk_data_smart_backend_services,
160
+ id: :bulk_data_smart_backend_services_v200
161
+
162
+ group from: :bulk_data_export_tests_v200
163
+ end
164
+ end
165
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../v1.0.1/group/bulk_data_group_export_cancel_group'
4
+ require_relative '../bulk_data_export_cancel_test'
5
+
6
+ module BulkDataTestKit
7
+ module BulkDataV200
8
+ class BulkDataGroupExportCancelGroup < BulkDataV101::BulkDataGroupExportCancelGroup
9
+ id :bulk_data_group_export_cancel_group_stu2
10
+
11
+ test from: :bulk_data_export_cancel_stu2,
12
+ id: :bulk_data_group_export_cancel_stu2
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../export_kick_off_performer'
4
+ require_relative '../bulk_data_outputFormat_param_test'
5
+ require_relative '../bulk_data_since_param_test'
6
+
7
+ module BulkDataTestKit
8
+ module BulkDataV200
9
+ class BulkDataGroupExportParameters < Inferno::TestGroup
10
+ id :bulk_data_group_export_parameters_group
11
+ title 'Group Compartment Export Parameters Tests'
12
+ description %(
13
+ Verify that the Bulk Data server supports required query parameters for Group export.
14
+ )
15
+
16
+ input :bearer_token,
17
+ title: 'Bulk Data Authorization Bearer Token',
18
+ description: 'The authorization bearer token for the Bulk FHIR server. If not required, leave blank.',
19
+ optional: true
20
+ input :bulk_server_url,
21
+ title: 'Bulk Data FHIR URL',
22
+ description: 'The URL of the Bulk FHIR server.'
23
+ input :group_id,
24
+ title: 'Group ID',
25
+ description: 'The Group ID associated with the group of patients to be exported.'
26
+
27
+ test from: :output_format_in_export_response,
28
+ id: :output_format_in_group_export_response,
29
+ config: {
30
+ options: { resource_type: 'Group', bulk_export_url: 'Group/[group_id]/$export' }
31
+ }
32
+
33
+ test from: :since_in_export_response,
34
+ id: :since_in_group_export_response,
35
+ config: {
36
+ options: { resource_type: 'Group', bulk_export_url: 'Group/[group_id]/$export' }
37
+ }
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../v1.0.1/patient/bulk_data_patient_export_cancel_group'
4
+ require_relative '../bulk_data_export_cancel_test'
5
+
6
+ module BulkDataTestKit
7
+ module BulkDataV200
8
+ class BulkDataPatientExportCancelGroup < BulkDataV101::BulkDataPatientExportCancelGroup
9
+ id :bulk_data_patient_export_cancel_group_stu2
10
+
11
+ test from: :bulk_data_export_cancel_stu2,
12
+ id: :bulk_data_patient_export_cancel_stu2,
13
+ config: {
14
+ inputs: { cancelled_polling_url: { name: :patient_cancelled_polling_url } }
15
+ }
16
+ end
17
+ end
18
+ end