davinci_pdex_test_kit 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +201 -0
  3. data/lib/davinci_pdex_test_kit/docs/payer_client_suite_description_v200.md +91 -0
  4. data/lib/davinci_pdex_test_kit/docs/payer_server_suite_description_v200.md +119 -0
  5. data/lib/davinci_pdex_test_kit/ext/inferno_core/record_response_route.rb +98 -0
  6. data/lib/davinci_pdex_test_kit/ext/inferno_core/request.rb +19 -0
  7. data/lib/davinci_pdex_test_kit/ext/inferno_core/runnable.rb +18 -0
  8. data/lib/davinci_pdex_test_kit/fhir_resource_navigation.rb +154 -0
  9. data/lib/davinci_pdex_test_kit/group_metadata.rb +109 -0
  10. data/lib/davinci_pdex_test_kit/metadata/mock_capability_statement.json +1052 -0
  11. data/lib/davinci_pdex_test_kit/metadata/mock_operation_outcome_resource.json +16 -0
  12. data/lib/davinci_pdex_test_kit/mock_server.rb +247 -0
  13. data/lib/davinci_pdex_test_kit/must_support_test.rb +252 -0
  14. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_member_match_tests/client_member_match_submit_test.rb +24 -0
  15. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_member_match_tests/client_member_match_validation_test.rb +23 -0
  16. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_must_support_tests/client_member_match_must_support_submit_test.rb +26 -0
  17. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_must_support_tests/client_member_match_must_support_validation_test.rb +32 -0
  18. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_validation_test.rb +94 -0
  19. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/allergyintolerance_clinical_data_request_test.rb +23 -0
  20. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/careplan_clinical_data_request_test.rb +23 -0
  21. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/careteam_clinical_data_request_test.rb +23 -0
  22. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/condition_clinical_data_request_test.rb +23 -0
  23. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/device_clinical_data_request_test.rb +23 -0
  24. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/diagnosticreport_clinical_data_request_test.rb +23 -0
  25. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/documentreference_clinical_data_request_test.rb +23 -0
  26. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/encounter_clinical_data_request_test.rb +23 -0
  27. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/explanationofbenefit_clinical_data_request_test.rb +23 -0
  28. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/goal_clinical_data_request_test.rb +23 -0
  29. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/immunization_clinical_data_request_test.rb +23 -0
  30. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/initial_scratch_storing.rb +34 -0
  31. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/initial_wait_test.rb +28 -0
  32. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/location_clinical_data_request_test.rb +23 -0
  33. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/medicationdispense_clinical_data_request_test.rb +23 -0
  34. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/medicationrequest_clinical_data_request_test.rb +23 -0
  35. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/observation_clinical_data_request_test.rb +23 -0
  36. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/organization_clinical_data_request_test.rb +23 -0
  37. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/patient_clinical_data_request_test.rb +23 -0
  38. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/practitioner_clinical_data_request_test.rb +23 -0
  39. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/practitionerrole_clinical_data_request_test.rb +23 -0
  40. data/lib/davinci_pdex_test_kit/pdex_payer_client/clinical_data_request_tests/procedure_clinical_data_request_test.rb +23 -0
  41. data/lib/davinci_pdex_test_kit/pdex_payer_client/collection.rb +46 -0
  42. data/lib/davinci_pdex_test_kit/pdex_payer_client_suite.rb +152 -0
  43. data/lib/davinci_pdex_test_kit/pdex_payer_server/abstract_member_match_request_conformance_test.rb +33 -0
  44. data/lib/davinci_pdex_test_kit/pdex_payer_server/abstract_member_match_request_local_references_test.rb +35 -0
  45. data/lib/davinci_pdex_test_kit/pdex_payer_server/coverage_to_link_has_minimal_data_test.rb +52 -0
  46. data/lib/davinci_pdex_test_kit/pdex_payer_server/coverage_to_link_must_support_test.rb +28 -0
  47. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_id_search_test.rb +58 -0
  48. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_identifier_search_test.rb +58 -0
  49. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_must_support_test.rb +40 -0
  50. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_last_updated_search_test.rb +63 -0
  51. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_service_date_search_test.rb +63 -0
  52. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_type_search_test.rb +63 -0
  53. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_use_search_test.rb +68 -0
  54. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_provenance_revinclude_search_test.rb +52 -0
  55. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_read_test.rb +26 -0
  56. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_reference_resolution_test.rb +43 -0
  57. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_validation_test.rb +40 -0
  58. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit_group.rb +105 -0
  59. data/lib/davinci_pdex_test_kit/pdex_payer_server/export_patient_group.rb +103 -0
  60. data/lib/davinci_pdex_test_kit/pdex_payer_server/export_validation_group.rb +59 -0
  61. data/lib/davinci_pdex_test_kit/pdex_payer_server/multiple_member_matches_group.rb +66 -0
  62. data/lib/davinci_pdex_test_kit/pdex_payer_server/no_member_matches_group.rb +69 -0
  63. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_clinical_data.rb +66 -0
  64. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_everything.rb +184 -0
  65. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_export.rb +67 -0
  66. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_member_match.rb +171 -0
  67. data/lib/davinci_pdex_test_kit/pdex_payer_server_suite.rb +158 -0
  68. data/lib/davinci_pdex_test_kit/pdex_provider_client_suite.rb +36 -0
  69. data/lib/davinci_pdex_test_kit/tags.rb +9 -0
  70. data/lib/davinci_pdex_test_kit/urls.rb +67 -0
  71. data/lib/davinci_pdex_test_kit/user_input_response.rb +32 -0
  72. data/lib/davinci_pdex_test_kit/version.rb +5 -0
  73. data/lib/davinci_pdex_test_kit.rb +8 -0
  74. metadata +218 -0
@@ -0,0 +1,63 @@
1
+ require 'us_core_test_kit/search_test'
2
+ require 'us_core_test_kit/search_test_properties'
3
+ require 'us_core_test_kit/generator/group_metadata'
4
+
5
+ module DaVinciPDexTestKit
6
+ module PDexPayerServer
7
+ class ExplanationOfBenefitPatientTypeSearchTest < Inferno::Test
8
+ include USCoreTestKit::SearchTest
9
+
10
+ title 'Server returns valid results for ExplanationOfBenefit search by patient + type'
11
+ description %(
12
+ A server SHALL support searching by
13
+ patient + type on the ExplanationOfBenefit resource. This test
14
+ will pass if resources are returned and match the search criteria. If
15
+ none are returned, the test is skipped.
16
+
17
+ This test verifies that the server supports searching by reference using
18
+ the form `patient=[id]` as well as `patient=Patient/[id]`. The two
19
+ different forms are expected to return the same number of results. US
20
+ Core requires that both forms are supported by US Core responders, and
21
+ PDex expands upon US Core.
22
+
23
+ Because this is the first search of the sequence, resources in the
24
+ response will be used for subsequent tests.
25
+
26
+ Additionally, this test will check that GET and POST search methods
27
+ return the same number of results. Search by POST is required by the
28
+ FHIR R4 specification, and these tests interpret search by GET as a
29
+ requirement of PDex v2.0.0.
30
+
31
+ [PDex Server CapabilityStatement](https://hl7.org/fhir/us/davinci-pdex/STU2/CapabilityStatement-pdex-server.html)
32
+
33
+ )
34
+
35
+ id :pdex_explanation_of_benefit_patient_type_search_test
36
+
37
+ input :patient_ids,
38
+ title: 'Patient IDs',
39
+ description: 'Comma separated list of patient IDs that in sum contain all MUST SUPPORT elements'
40
+
41
+ def self.properties
42
+ @properties ||= USCoreTestKit::SearchTestProperties.new(
43
+ resource_type: 'ExplanationOfBenefit',
44
+ search_param_names: ['patient', 'type'],
45
+ test_post_search: true
46
+ # TODO other properties?
47
+ )
48
+ end
49
+
50
+ def self.metadata
51
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
52
+ end
53
+
54
+ def scratch_resources
55
+ scratch[:explanation_of_benefit_resources] ||= {}
56
+ end
57
+
58
+ run do
59
+ run_search_test
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,68 @@
1
+ require 'us_core_test_kit/search_test'
2
+ require 'us_core_test_kit/search_test_properties'
3
+ require 'us_core_test_kit/generator/group_metadata'
4
+
5
+ module DaVinciPDexTestKit
6
+ module PDexPayerServer
7
+ class ExplanationOfBenefitPatientUseSearchTest < Inferno::Test
8
+ include USCoreTestKit::SearchTest
9
+
10
+ title 'Server returns valid results for ExplanationOfBenefit search by patient + use'
11
+ description %(
12
+ A server SHALL support searching by
13
+ patient + use on the ExplanationOfBenefit resource. This test
14
+ will pass if resources are returned and match the search criteria. If
15
+ none are returned, the test is skipped.
16
+
17
+ This test verifies that the server supports searching by reference using
18
+ the form `patient=[id]` as well as `patient=Patient/[id]`. The two
19
+ different forms are expected to return the same number of results. US
20
+ Core requires that both forms are supported by US Core responders, and
21
+ PDex expands upon US Core.
22
+
23
+ Because this is the first search of the sequence, resources in the
24
+ response will be used for subsequent tests.
25
+
26
+ Additionally, this test will check that GET and POST search methods
27
+ return the same number of results. Search by POST is required by the
28
+ FHIR R4 specification, and these tests interpret search by GET as a
29
+ requirement of PDex v2.0.0.
30
+
31
+ [PDex Server CapabilityStatement](https://hl7.org/fhir/us/davinci-pdex/STU2/CapabilityStatement-pdex-server.html)
32
+
33
+ )
34
+
35
+ id :pdex_explanation_of_benefit_patient_use_search_test
36
+
37
+ input :patient_ids,
38
+ title: 'Patient IDs',
39
+ description: 'Comma separated list of patient IDs that in sum contain all MUST SUPPORT elements'
40
+
41
+ def self.properties
42
+ @properties ||= USCoreTestKit::SearchTestProperties.new(
43
+ first_search: true,
44
+ fixed_value_search: true,
45
+ resource_type: 'ExplanationOfBenefit',
46
+ search_param_names: ['patient', 'use'],
47
+ saves_delayed_references: true,
48
+ possible_status_search: true,
49
+ token_search_params: ['use'],
50
+ test_reference_variants: true,
51
+ test_post_search: true
52
+ )
53
+ end
54
+
55
+ def self.metadata
56
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
57
+ end
58
+
59
+ def scratch_resources
60
+ scratch[:explanation_of_benefit_resources] ||= {}
61
+ end
62
+
63
+ run do
64
+ run_search_test
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,52 @@
1
+ require 'us_core_test_kit/search_test'
2
+ require 'us_core_test_kit/search_test_properties'
3
+ require 'us_core_test_kit/generator/group_metadata'
4
+
5
+ module USCoreTestKit
6
+ module USCoreV311
7
+ class ExplanationOfBenefitProvenanceRevincludeSearchTest < Inferno::Test
8
+ include USCoreTestKit::SearchTest
9
+
10
+ title 'Server returns Provenance resources from ExplanationOfBenefit search by patient + revInclude:Provenance:target'
11
+ description %(
12
+ A server SHALL be capable of supporting _revIncludes:Provenance:target.
13
+
14
+ This test will perform a search by patient + revInclude:Provenance:target and
15
+ will pass if a Provenance resource is found in the response.
16
+ %)
17
+
18
+ id :pdex_explanation_of_benefit_provenance_revinclude_search_test
19
+
20
+ input :patient_ids,
21
+ title: 'Patient IDs',
22
+ description: 'Comma separated list of patient IDs that in sum contain all MUST SUPPORT elements'
23
+
24
+ def properties
25
+ @properties ||= USCoreTestKit::SearchTestProperties.new(
26
+ resource_type: 'ExplanationOfBenefit',
27
+ search_param_names: ['patient']
28
+ )
29
+ end
30
+
31
+ def self.metadata
32
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml')))
33
+ end
34
+
35
+ def self.provenance_metadata
36
+ @provenance_metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, '..', 'provenance', 'metadata.yml'), aliases: true))
37
+ end
38
+
39
+ def scratch_resources
40
+ scratch[:explanation_of_benefit_resources] ||= {}
41
+ end
42
+
43
+ def scratch_provenance_resources
44
+ scratch[:provenance_resources] ||= {}
45
+ end
46
+
47
+ run do
48
+ run_provenance_revinclude_search_test
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,26 @@
1
+ require 'us_core_test_kit/read_test'
2
+
3
+ module DaVinciPDexTestKit
4
+ module PDexPayerServer
5
+ class ExplanationOfBenefitReadTest < Inferno::Test
6
+ include USCoreTestKit::ReadTest
7
+
8
+ title 'Server returns correct ExplanationOfBenefit resource from ExplanationOfBenefit read interaction'
9
+ description 'A server SHALL support the ExplanationOfBenefit read interaction.'
10
+
11
+ id :pdex_explanation_of_benefit_read_test
12
+
13
+ def resource_type
14
+ 'ExplanationOfBenefit'
15
+ end
16
+
17
+ def scratch_resources
18
+ scratch[:explanation_of_benefit_resources] ||= {}
19
+ end
20
+
21
+ run do
22
+ perform_read_test(all_scratch_resources)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,43 @@
1
+ require 'us_core_test_kit/reference_resolution_test'
2
+ require 'us_core_test_kit/generator/group_metadata'
3
+
4
+ module DaVinciPDexTestKit
5
+ module PDexPayerServer
6
+ class ExplanationOfBenefitReferenceResolutionTest < Inferno::Test
7
+ include USCoreTestKit::ReferenceResolutionTest
8
+
9
+ title 'MustSupport references within ExplanationOfBenefit resources are valid'
10
+ description %(
11
+ This test will attempt to read external references provided within elements
12
+ marked as 'MustSupport', if any are available.
13
+
14
+ It verifies that at least one external reference for each MustSupport Reference element
15
+ can be accessed by the test client, and conforms to corresponding US Core or PDex profile.
16
+
17
+ Elements which may provide external references include:
18
+
19
+ #### TODO: list out all references:
20
+
21
+ * ...
22
+ )
23
+
24
+ id :pdex_explanation_of_benefit_reference_resolution_test
25
+
26
+ def resource_type
27
+ 'ExplanationOfBenefit'
28
+ end
29
+
30
+ def self.metadata
31
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'), aliases: true))
32
+ end
33
+
34
+ def scratch_resources
35
+ scratch[:explanation_of_benefit_resources] ||= {}
36
+ end
37
+
38
+ run do
39
+ perform_reference_resolution_test(scratch_resources[:all])
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,40 @@
1
+ require 'us_core_test_kit/validation_test'
2
+
3
+ module DaVinciPDexTestKit
4
+ module PDexPayerServer
5
+ class ExplanationOfBenefitValidationTest < Inferno::Test
6
+ include USCoreTestKit::ValidationTest
7
+
8
+ id :pdex_explanation_of_benefit_validation_test
9
+ title 'ExplanationOfBenefit resources returned during previous tests conform to the US Core ExplanationOfBenefit Profile'
10
+ description %(
11
+ This test verifies resources returned from the first search conform to
12
+ the [PDex ExplanationOfBenefit Profile](http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/pdex-priorauthorization).
13
+ Systems must demonstrate at least one valid example in order to pass this test.
14
+
15
+ It verifies the presence of mandatory elements and that elements with
16
+ required bindings contain appropriate values. CodeableConcept element
17
+ bindings will fail if none of their codings have a code/system belonging
18
+ to the bound ValueSet. Quantity, Coding, and code element bindings will
19
+ fail if their code/system are not found in the valueset.
20
+ )
21
+
22
+ output :dar_code_found, :dar_extension_found
23
+
24
+ def resource_type
25
+ 'ExplanationOfBenefit'
26
+ end
27
+
28
+ def scratch_resources
29
+ scratch[:explanation_of_benefit_resources] ||= {}
30
+ end
31
+
32
+ run do
33
+ perform_validation_test(scratch_resources[:all] || [],
34
+ 'http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/pdex-priorauthorization',
35
+ '2.0.0',
36
+ skip_if_empty: true)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'us_core_test_kit/generator/group_metadata'
4
+ require_relative 'explanation_of_benefit/explanation_of_benefit_patient_use_search_test'
5
+ require_relative 'explanation_of_benefit/explanation_of_benefit_id_search_test'
6
+ require_relative 'explanation_of_benefit/explanation_of_benefit_patient_last_updated_search_test'
7
+ require_relative 'explanation_of_benefit/explanation_of_benefit_patient_service_date_search_test'
8
+ require_relative 'explanation_of_benefit/explanation_of_benefit_patient_type_search_test'
9
+ require_relative 'explanation_of_benefit/explanation_of_benefit_identifier_search_test'
10
+ require_relative 'explanation_of_benefit/explanation_of_benefit_read_test'
11
+ require_relative 'explanation_of_benefit/explanation_of_benefit_provenance_revinclude_search_test'
12
+ require_relative 'explanation_of_benefit/explanation_of_benefit_validation_test'
13
+ require_relative 'explanation_of_benefit/explanation_of_benefit_must_support_test'
14
+ require_relative 'explanation_of_benefit/explanation_of_benefit_reference_resolution_test'
15
+
16
+ module DaVinciPDexTestKit
17
+ module PDexPayerServer
18
+
19
+ # PDex PriorAuthorization Profile for ExplanationOfBenefit Resource Test Group
20
+ class ExplanationOfBenefitTestGroup < Inferno::TestGroup
21
+ title 'PDex Prior Authorization Tests'
22
+ short_description 'Verify support for the server capabilities required by the PDex Prior Authorization Profile.'
23
+ description %(
24
+ # Background
25
+
26
+ The PDex Prior Authorization sequence verifies that the system under test is
27
+ able to provide correct responses for ExplanationOfBenefit queries. These queries
28
+ must contain resources conforming to the PDex Prior Authorization Profile as
29
+ specified in the Da Vinci PDex v2.0.0 Implementation Guide.
30
+
31
+ # Testing Methodology
32
+ ## Searching
33
+ This test sequence will first perform each required search associated
34
+ with this resource. This sequence will perform searches with the
35
+ following parameters:
36
+
37
+ * patient + use
38
+ * _id
39
+ * patient + _lastUpdated
40
+ * patient + service-date
41
+ * patient + type
42
+ * identifier
43
+
44
+ ### Search Parameters
45
+ The first search uses the selected patient(s) from the Patient Tests group.
46
+ Any subsequent searches will look for its parameter values
47
+ from the results of the first search. For example, the `provider`
48
+ search in this sequence is performed by looking for an existing
49
+ `ExplanationOfBenefit.provider` from any of the resources returned in the `patient`
50
+ search. If a value cannot be found this way, the search is skipped.
51
+
52
+ ### Search Validation
53
+ Inferno will retrieve up to the first 20 bundle pages of the reply for
54
+ ExplanationOfBenefit resources and save them for subsequent tests. Each of
55
+ these resources is then checked to see if it matches the searched
56
+ parameters in accordance with [FHIR search
57
+ guidelines](https://www.hl7.org/fhir/search.html). The test will fail,
58
+ for example, if a Patient search for `gender=male` returns a `female`
59
+ patient.
60
+
61
+ ## Must Support
62
+ Each profile contains elements marked as "must support". This test
63
+ sequence expects to see each of these elements at least once. If at
64
+ least one cannot be found, the test will fail. The test will look
65
+ through the ExplanationOfBenefit resources found in the first test for these
66
+ elements.
67
+
68
+ ## Profile Validation
69
+ Each resource returned from the first search is expected to conform to
70
+ the [PDex Prior Authorization Profile](http://hl7.org/fhir/us/davinci-pdex/StructureDefinition-pdex-priorauthorization.html).
71
+ Each element is checked against teminology binding and cardinality requirements.
72
+
73
+ Elements with a required binding are validated against their bound
74
+ ValueSet. If the code/system in the element is not part of the ValueSet,
75
+ then the test will fail.
76
+
77
+ ## Reference Validation
78
+ At least one instance of each external reference in elements marked as
79
+ "must support" within the resources provided by the system must resolve.
80
+ The test will attempt to read each reference found and will fail if no
81
+ read succeeds.
82
+ )
83
+
84
+ id :pdex_explanation_of_benefit
85
+ run_as_group
86
+
87
+ def self.metadata
88
+ # TODO: create metadata.yml to fit GroupMetadata OR circumvent metadata
89
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'explanation_of_benefit', 'metadata.yml')), aliases: true)
90
+ end
91
+
92
+ test from: :pdex_explanation_of_benefit_patient_use_search_test
93
+ test from: :pdex_explanation_of_benefit__id_search_test
94
+ test from: :pdex_explanation_of_benefit_patient__last_updated_search_test
95
+ test from: :pdex_explanation_of_benefit_patient_service_date_search_test
96
+ test from: :pdex_explanation_of_benefit_patient_type_search_test
97
+ test from: :pdex_explanation_of_benefit_identifier_search_test
98
+ test from: :pdex_explanation_of_benefit_read_test
99
+ test from: :pdex_explanation_of_benefit_provenance_revinclude_search_test
100
+ test from: :pdex_explanation_of_benefit_validation_test
101
+ test from: :pdex_explanation_of_benefit_must_support_test
102
+ # test from: :pdex_explanation_of_benefit_reference_resolution_test
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tls_test_kit'
4
+
5
+ require 'bulk_data_test_kit/v1.0.1/bulk_data_export_operation_support_test'
6
+ require 'bulk_data_test_kit/v1.0.1/bulk_data_no_auth_test'
7
+ require 'bulk_data_test_kit/v1.0.1/bulk_data_export_kick_off_test'
8
+ require 'bulk_data_test_kit/v1.0.1/bulk_data_status_check_test'
9
+ require 'bulk_data_test_kit/v1.0.1/bulk_data_output_check_test'
10
+
11
+ module DaVinciPDexTestKit
12
+ module PDexPayerServer
13
+ class ExportPatientGroup < Inferno::TestGroup
14
+ title 'Patient Export Tests'
15
+ short_description 'Verify that the system supports bulk export of Patient Data'
16
+ description <<~DESCRIPTION
17
+ Verify that patient level export on the Bulk Data server follow the Bulk Data Access Implementation Guide
18
+ DESCRIPTION
19
+ id :pdex_patient_export_group
20
+ optional
21
+
22
+ run_as_group
23
+
24
+ input :bearer_token,
25
+ title: 'Bulk Data Authorization Bearer Token',
26
+ description: 'The authorization bearer token for the Bulk FHIR server. If not required, leave blank.',
27
+ optional: true
28
+ input :bulk_timeout,
29
+ title: 'Export Times Out after (1-600)',
30
+ description: <<~DESCRIPTION,
31
+ While testing, Inferno waits for the server to complete the exporting task. If the calculated totalTime is
32
+ greater than the timeout value specified here, Inferno bulk client stops testing. Please enter an integer
33
+ for the maximum wait time in seconds. If timeout is less than 1, Inferno uses default value 180. If the
34
+ timeout is greater than 600 (10 minutes), Inferno uses the maximum value 600.
35
+ DESCRIPTION
36
+ default: 180
37
+
38
+ output :patient_requires_access_token, :patient_status_output, :patient_bulk_download_url
39
+
40
+ test from: :bulk_data_export_operation_support do
41
+ title 'Bulk Data Server declares support for Patient export operation in CapabilityStatement'
42
+ description <<~DESCRIPTION
43
+ This test verifies that the Bulk Data Server declares support for
44
+ `Patient/$export` operation in its server CapabilityStatement.
45
+
46
+ Given flexibility in the FHIR specification for declaring constrained
47
+ OperationDefinitions, this test only verifies that the server declares
48
+ any operation on the Patient resource. It does not verify that it
49
+ declares the standard Patient export OperationDefinition provided in the
50
+ Bulk Data specification, nor does it attempt to resolve any non-standard
51
+ OperationDefinitions to verify if it is a constrained version of the
52
+ standard OperationDefintion.
53
+
54
+ This test will provide a warning if no operations are declared at
55
+ `Patient/$export`, via the
56
+ `CapabilityStatement.rest.resource.operation.name` element. It will
57
+ also provide an informational message if an operation on the Patient
58
+ resource exists, but does not point to the standard OperationDefinition
59
+ canonical URL:
60
+ http://hl7.org/fhir/uv/bulkdata/OperationDefinition/patient-export
61
+
62
+ Additionally, this test provides a warning if the bulk data server does
63
+ not include the following URL in its `CapabilityStatement.instantiates`
64
+ element: http://hl7.org/fhir/uv/bulkdata/CapabilityStatement/bulk-data
65
+ DESCRIPTION
66
+ id :bulk_data_patient_export_operation_support
67
+
68
+ config(
69
+ options: { resource_type: 'Patient', require_absolute_urls_in_output: true }
70
+ )
71
+ end
72
+
73
+ test from: :bulk_data_kick_off,
74
+ id: :pdex_export_patient_kick_off,
75
+ config: {
76
+ outputs: { polling_url: { name: :patient_polling_url } },
77
+ options: { resource_type: 'Patient', bulk_export_url: 'Patient/$export' }
78
+ }
79
+
80
+ test from: :bulk_data_status_check,
81
+ id: :pdex_export_patient_status_check,
82
+ config: {
83
+ inputs: { polling_url: { name: :patient_polling_url } },
84
+ outputs: {
85
+ status_response: { name: :patient_status_response },
86
+ requires_access_token: { name: :patient_requires_access_token }
87
+ },
88
+ options: { resource_type: 'Patient' }
89
+ }
90
+
91
+ test from: :bulk_data_output_check,
92
+ id: :pdex_export_patient_output_check,
93
+ config: {
94
+ inputs: { status_response: { name: :patient_status_response } },
95
+ outputs: {
96
+ status_output: { name: :patient_status_output },
97
+ bulk_download_url: { name: :patient_bulk_download_url }
98
+ },
99
+ options: { resource_type: 'Patient' }
100
+ }
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,59 @@
1
+ # export_validation_group.rb
2
+
3
+ # frozen_string_literal: true
4
+
5
+ # require 'bulk_data_test_kit/v1.0.1/bulk_data_multiple_patients_test'
6
+ require 'bulk_data_test_kit/v1.0.1/bulk_data_ndjson_download_test'
7
+ require 'bulk_data_test_kit/v1.0.1/bulk_data_valid_resources_test'
8
+
9
+ module DaVinciPDexTestKit
10
+ module PDexPayerServer
11
+ class ExportValidation < Inferno::TestGroup
12
+ title 'Patient Export Validation Tests'
13
+ short_description 'Verify that the data from the export of all Patients conforms to the base FHIR standard.'
14
+ description <<~DESCRIPTION
15
+ Verify that All Patient export from the Bulk Data server follow the base FHIR standard
16
+ DESCRIPTION
17
+
18
+ id :pdex_export_validation
19
+
20
+ input :patient_status_output, :patient_requires_access_token, :bearer_token, :patient_bulk_download_url
21
+ input :lines_to_validate,
22
+ title: 'Limit validation to a maximum resource count',
23
+ description: 'To validate all, leave blank.',
24
+ optional: true
25
+
26
+ input :patient_id # from workflow_export.rb
27
+
28
+ run_as_group
29
+
30
+ test from: :tls_version_test do
31
+ title 'Bulk Data Server is secured by transport layer security'
32
+ description <<~DESCRIPTION
33
+ [§170.315(g)(10) Test Procedure]
34
+ (https://www.healthit.gov/test-method/standardized-api-patient-and-population-services)
35
+ requires that all exchanges described herein between a client and a
36
+ server SHALL be secured using Transport Layer Security (TLS)
37
+ Protocol Version 1.2 (RFC5246).
38
+ DESCRIPTION
39
+ id :bulk_file_server_tls_version
40
+
41
+ config(
42
+ inputs: { url: { name: :patient_bulk_download_url } },
43
+ options: { minimum_allowed_version: OpenSSL::SSL::TLS1_2_VERSION }
44
+ )
45
+ end
46
+
47
+ test from: :bulk_data_valid_resources,
48
+ id: :bulk_data_patient_valid_resources,
49
+ config: {
50
+ inputs: {
51
+ status_output: { name: :patient_status_output },
52
+ requires_access_token: { name: :patient_requires_access_token }
53
+ }
54
+ }
55
+
56
+ # NOTE: removed bulk_data_multiple_patients test, hence we need this file
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+ require_relative 'abstract_member_match_request_conformance_test'
3
+ require_relative 'abstract_member_match_request_local_references_test'
4
+ require_relative 'coverage_to_link_has_minimal_data_test'
5
+ require_relative 'coverage_to_link_must_support_test'
6
+
7
+ module DaVinciPDexTestKit
8
+ module PDexPayerServer
9
+ class MultipleMemberMatchesGroup < Inferno::TestGroup
10
+
11
+ id :multiple_member_matches_group
12
+ title '$member-match with multiple matches'
13
+
14
+ run_as_group
15
+
16
+ input :multiple_member_match_request,
17
+ title: 'Member Match Request for multiple matches',
18
+ description: "A JSON payload for server's $member-match endpoint that has **more than one match**",
19
+ type: 'textarea',
20
+ optional: true
21
+
22
+ group_config = { inputs: { member_match_request: { name: :multiple_member_match_request } } }
23
+
24
+ test from: :abstract_member_match_request_conformance do
25
+ id :multiple_member_match_request_conformance
26
+ config(group_config)
27
+ title '[USER INPUT VALIDATION] Member match request for multiple matches is valid'
28
+ description %{
29
+ This test validates the conformity of the user input to the
30
+ [HRex Member Match Request Profile](https://hl7.org/fhir/us/davinci-hrex/STU1/StructureDefinition-hrex-parameters-member-match-in.html),
31
+ ensuring subsequent tests can accurately simulate content. It also checks conformance to the [Parameters Resource](https://hl7.org/fhir/R4/parameters.html),
32
+ mandatory elements, and terminology. It also checks that the Patient reference with the Consent and CoverageToMatch parameters are local references.
33
+ }
34
+
35
+ # Inherits
36
+ end
37
+
38
+ test from: :abstract_member_match_request_local_references do
39
+ id :multiple_member_match_request_local_references
40
+ config(group_config)
41
+ end
42
+
43
+ test from: :coverage_to_link_has_minimal_data, config: group_config
44
+ test from: :coverage_to_link_must_support, config: group_config
45
+
46
+ test do
47
+ id :member_match_has_multiple_matches
48
+ title 'Server $member-match operation returns 422 Unprocessable Content if multiple matches are found'
49
+ description %{
50
+ See [member matching logic](https://hl7.org/fhir/us/davinci-hrex/STU1/OperationDefinition-member-match.html#member-matching-logic)
51
+ for specification.
52
+ }
53
+
54
+ run do
55
+ skip_if !multiple_member_match_request, "No member match request inputted for multiple-match tests."
56
+
57
+ member_match_request_resource = FHIR.from_contents(multiple_member_match_request)
58
+
59
+ fhir_operation('/Patient/$member-match', body: member_match_request_resource)
60
+ assert_response_status(422)
61
+ end
62
+ end
63
+
64
+ end
65
+ end
66
+ end