davinci_pdex_test_kit 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/pdex_payer_server_fhir_foundry_ri_preset.json +2 -2
  3. data/config/presets/pdex_payer_server_inferno_ri_preset.json +2 -2
  4. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_member_match_tests/client_member_match_validation_test.rb +7 -5
  5. data/lib/davinci_pdex_test_kit/pdex_payer_client/client_workflow_interaction_test.rb +8 -7
  6. data/lib/davinci_pdex_test_kit/pdex_payer_client_suite.rb +8 -10
  7. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_must_support_test.rb +50 -0
  8. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_patient_search_test.rb +68 -0
  9. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_patient_type_search_test.rb +54 -0
  10. data/lib/davinci_pdex_test_kit/pdex_payer_server/{explanation_of_benefit/explanation_of_benefit_provenance_revinclude_search_test.rb → device/device_provenance_revinclude_search_test.rb} +7 -7
  11. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_read_test.rb +26 -0
  12. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_reference_resolution_test.rb +42 -0
  13. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/device_validation_test.rb +39 -0
  14. data/lib/davinci_pdex_test_kit/pdex_payer_server/device/metadata.yml +154 -0
  15. data/lib/davinci_pdex_test_kit/pdex_payer_server/device_group.rb +88 -0
  16. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_id_search_test.rb +7 -24
  17. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_identifier_search_test.rb +10 -24
  18. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_must_support_test.rb +37 -5
  19. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_lastupdated_search_test.rb +48 -0
  20. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_search_test.rb +62 -0
  21. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_service_date_search_test.rb +7 -23
  22. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_type_search_test.rb +6 -23
  23. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_reference_resolution_test.rb +7 -4
  24. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_validation_test.rb +9 -10
  25. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/metadata.yml +276 -264
  26. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit_group.rb +62 -64
  27. data/lib/davinci_pdex_test_kit/pdex_payer_server/export_patient_group.rb +8 -9
  28. data/lib/davinci_pdex_test_kit/pdex_payer_server/export_validation_group.rb +1 -2
  29. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_must_support_test.rb +42 -0
  30. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_patient_search_test.rb +64 -0
  31. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_patient_status_search_test.rb +54 -0
  32. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_patient_status_type_search_test.rb +55 -0
  33. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_provenance_revinclude_search_test.rb +54 -0
  34. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_read_test.rb +26 -0
  35. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_reference_resolution_test.rb +42 -0
  36. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/medication_dispense_validation_test.rb +39 -0
  37. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense/metadata.yml +206 -0
  38. data/lib/davinci_pdex_test_kit/pdex_payer_server/medication_dispense_group.rb +69 -0
  39. data/lib/davinci_pdex_test_kit/pdex_payer_server/multiple_member_matches_group.rb +36 -36
  40. data/lib/davinci_pdex_test_kit/pdex_payer_server/no_member_matches_group.rb +30 -30
  41. data/lib/davinci_pdex_test_kit/pdex_payer_server/patient_operation_in_capability_statement_validation.rb +15 -13
  42. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance/metadata.yml +173 -0
  43. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance/provenance_must_support_test.rb +51 -0
  44. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance/provenance_read_test.rb +26 -0
  45. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance/provenance_reference_resolution_test.rb +46 -0
  46. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance/provenance_validation_test.rb +39 -0
  47. data/lib/davinci_pdex_test_kit/pdex_payer_server/provenance_group.rb +59 -0
  48. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_clinical_data_group.rb +22 -11
  49. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_everything_group.rb +19 -6
  50. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_export_group.rb +22 -16
  51. data/lib/davinci_pdex_test_kit/pdex_payer_server/workflow_member_match_group.rb +44 -25
  52. data/lib/davinci_pdex_test_kit/pdex_payer_server_suite.rb +123 -110
  53. data/lib/davinci_pdex_test_kit/pdex_provider_client_suite.rb +8 -8
  54. data/lib/davinci_pdex_test_kit/requirements/davinci-pdex-test-kit_out_of_scope_requirements.csv +1 -0
  55. data/lib/davinci_pdex_test_kit/requirements/davinci-pdex-test-kit_requirements.csv +64 -0
  56. data/lib/davinci_pdex_test_kit/requirements/generated/davinci-pdex-test-kit_requirements_coverage.csv +64 -0
  57. data/lib/davinci_pdex_test_kit/version.rb +2 -2
  58. data/lib/davinci_pdex_test_kit.rb +1 -0
  59. data/lib/inferno_requirements_tools/ext/inferno_core/runnable.rb +22 -0
  60. data/lib/inferno_requirements_tools/rake/rakefile_template +19 -0
  61. data/lib/inferno_requirements_tools/tasks/requirements_coverage.rb +284 -0
  62. data/lib/requirements_config.yaml +17 -0
  63. metadata +56 -11
  64. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_last_updated_search_test.rb +0 -64
  65. data/lib/davinci_pdex_test_kit/pdex_payer_server/explanation_of_benefit/explanation_of_benefit_patient_use_search_test.rb +0 -69
@@ -1,103 +1,101 @@
1
- require 'us_core_test_kit/generator/group_metadata'
2
- require_relative 'explanation_of_benefit/explanation_of_benefit_patient_use_search_test'
1
+ require_relative 'explanation_of_benefit/explanation_of_benefit_patient_search_test'
3
2
  require_relative 'explanation_of_benefit/explanation_of_benefit_id_search_test'
4
- require_relative 'explanation_of_benefit/explanation_of_benefit_patient_last_updated_search_test'
5
- require_relative 'explanation_of_benefit/explanation_of_benefit_patient_service_date_search_test'
3
+ require_relative 'explanation_of_benefit/explanation_of_benefit_patient_lastupdated_search_test'
6
4
  require_relative 'explanation_of_benefit/explanation_of_benefit_patient_type_search_test'
7
5
  require_relative 'explanation_of_benefit/explanation_of_benefit_identifier_search_test'
6
+ require_relative 'explanation_of_benefit/explanation_of_benefit_patient_service_date_search_test'
8
7
  require_relative 'explanation_of_benefit/explanation_of_benefit_read_test'
9
- require_relative 'explanation_of_benefit/explanation_of_benefit_provenance_revinclude_search_test'
10
8
  require_relative 'explanation_of_benefit/explanation_of_benefit_validation_test'
11
9
  require_relative 'explanation_of_benefit/explanation_of_benefit_must_support_test'
12
10
  require_relative 'explanation_of_benefit/explanation_of_benefit_reference_resolution_test'
13
11
 
14
12
  module DaVinciPDexTestKit
15
13
  module PDexPayerServer
16
-
17
- # PDex PriorAuthorization Profile for ExplanationOfBenefit Resource Test Group
18
14
  class ExplanationOfBenefitGroup < Inferno::TestGroup
19
- id :pdex_eob
20
15
  title 'PDex Prior Authorization Tests'
21
- short_description 'Verify support for the server capabilities required by the PDex Prior Authorization Profile.'
16
+ short_description 'Verify support for the server capabilities required by the PDex Prior Authorization.'
22
17
  description %(
23
- # Background
18
+ # Background
24
19
 
25
- The PDex Prior Authorization sequence verifies that the system under test is
26
- able to provide correct responses for ExplanationOfBenefit queries. These queries
27
- must contain resources conforming to the PDex Prior Authorization Profile as
28
- specified in the Da Vinci PDex v2.0.0 Implementation Guide.
20
+ The PDex Prior Authorization sequence verifies that the system under test is
21
+ able to provide correct responses for ExplanationOfBenefit queries. These queries
22
+ must contain resources conforming to the PDex Prior Authorization as
23
+ specified in the PDex v2.0.0 Implementation Guide.
29
24
 
30
- # Testing Methodology
31
- ## Searching
32
- This test sequence will first perform each required search associated
33
- with this resource. This sequence will perform searches with the
34
- following parameters:
25
+ # Testing Methodology
26
+ ## Searching
27
+ This test sequence will first perform each required search associated
28
+ with this resource. This sequence will perform searches with the
29
+ following parameters:
35
30
 
36
- * patient + use
37
- * _id
38
- * patient + _lastUpdated
39
- * patient + service-date
40
- * patient + type
41
- * identifier
31
+ * patient
32
+ * _id
33
+ * patient + _lastUpdated
34
+ * patient + type
35
+ * identifier
36
+ * patient + service-date
42
37
 
43
- ### Search Parameters
44
- The first search uses the selected patient(s) from the Patient Tests group.
45
- Any subsequent searches will look for its parameter values
46
- from the results of the first search. For example, the `provider`
47
- search in this sequence is performed by looking for an existing
48
- `ExplanationOfBenefit.provider` from any of the resources returned in the `patient`
49
- search. If a value cannot be found this way, the search is skipped.
38
+ ### Search Parameters
39
+ The first search uses the selected patient(s) from the prior launch
40
+ sequence. Any subsequent searches will look for its parameter values
41
+ from the results of the first search. For example, the `identifier`
42
+ search in the patient sequence is performed by looking for an existing
43
+ `Patient.identifier` from any of the resources returned in the `_id`
44
+ search. If a value cannot be found this way, the search is skipped.
50
45
 
51
- ### Search Validation
52
- Inferno will retrieve up to the first 20 bundle pages of the reply for
53
- ExplanationOfBenefit resources and save them for subsequent tests. Each of
54
- these resources is then checked to see if it matches the searched
55
- parameters in accordance with [FHIR search
56
- guidelines](https://www.hl7.org/fhir/search.html). The test will fail,
57
- for example, if a Patient search for `gender=male` returns a `female`
58
- patient.
46
+ ### Search Validation
47
+ Inferno will retrieve up to the first 20 bundle pages of the reply for
48
+ ExplanationOfBenefit resources and save them for subsequent tests. Each of
49
+ these resources is then checked to see if it matches the searched
50
+ parameters in accordance with [FHIR search
51
+ guidelines](https://www.hl7.org/fhir/search.html). The test will fail,
52
+ for example, if a Patient search for `gender=male` returns a `female`
53
+ patient.
59
54
 
60
- ## Must Support
61
- Each profile contains elements marked as "must support". This test
62
- sequence expects to see each of these elements at least once. If at
63
- least one cannot be found, the test will fail. The test will look
64
- through the ExplanationOfBenefit resources found in the first test for these
65
- elements.
66
55
 
67
- ## Profile Validation
68
- Each resource returned from the first search is expected to conform to
69
- the [PDex Prior Authorization Profile](http://hl7.org/fhir/us/davinci-pdex/StructureDefinition-pdex-priorauthorization.html).
70
- Each element is checked against teminology binding and cardinality requirements.
56
+ ## Must Support
57
+ Each profile contains elements marked as "must support". This test
58
+ sequence expects to see each of these elements at least once. If at
59
+ least one cannot be found, the test will fail. The test will look
60
+ through the ExplanationOfBenefit resources found in the first test for these
61
+ elements.
71
62
 
72
- Elements with a required binding are validated against their bound
73
- ValueSet. If the code/system in the element is not part of the ValueSet,
74
- then the test will fail.
63
+ ## Profile Validation
64
+ Each resource returned from the first search is expected to conform to
65
+ the [PDex Prior Authorization](http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/pdex-priorauthorization). Each element is checked against
66
+ teminology binding and cardinality requirements.
75
67
 
76
- ## Reference Validation
77
- At least one instance of each external reference in elements marked as
78
- "must support" within the resources provided by the system must resolve.
79
- The test will attempt to read each reference found and will fail if no
80
- read succeeds.
68
+ Elements with a required binding are validated against their bound
69
+ ValueSet. If the code/system in the element is not part of the ValueSet,
70
+ then the test will fail.
71
+
72
+ ## Reference Validation
73
+ At least one instance of each external reference in elements marked as
74
+ "must support" within the resources provided by the system must resolve.
75
+ The test will attempt to read each reference found and will fail if no
76
+ read succeeds.
81
77
  )
82
78
 
79
+ id :pdex_eob
83
80
  run_as_group
84
81
 
85
82
  def self.metadata
86
- # TODO: create metadata.yml to fit GroupMetadata OR circumvent metadata
87
- @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'explanation_of_benefit', 'metadata.yml')), aliases: true)
83
+ @metadata ||= USCoreTestKit::USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(
84
+ File.join(__dir__, 'explanation_of_benefit',
85
+ 'metadata.yml'), aliases: true
86
+ ))
88
87
  end
89
88
 
90
- test from: :pdex_eob_patient_use_search
89
+ test from: :pdex_eob_patient_search
91
90
  test from: :pdex_eob_id_search
92
91
  test from: :pdex_eob_patient_last_updated_search
93
- test from: :pdex_eob_patient_service_date_search
94
92
  test from: :pdex_eob_patient_type_search
95
93
  test from: :pdex_eob_identifier_search
94
+ test from: :pdex_eob_patient_service_date_search
96
95
  test from: :pdex_eob_read
97
- test from: :pdex_eob_provenance_revinclude_search
98
96
  test from: :pdex_eob_validation
99
97
  test from: :pdex_eob_must_support
100
- # test from: :pdex_eob_ref_resolution
98
+ test from: :pdex_eob_ref_resolution
101
99
  end
102
100
  end
103
101
  end
@@ -1,7 +1,5 @@
1
1
  require 'tls_test_kit'
2
2
 
3
- # require 'bulk_data_test_kit/v1.0.1/bulk_data_export_operation_support_test'
4
- require 'bulk_data_test_kit/v1.0.1/bulk_data_no_auth_test'
5
3
  require 'bulk_data_test_kit/v1.0.1/bulk_data_export_kick_off_test'
6
4
  require 'bulk_data_test_kit/v1.0.1/bulk_data_status_check_test'
7
5
  require 'bulk_data_test_kit/v1.0.1/bulk_data_output_check_test'
@@ -21,10 +19,8 @@ module DaVinciPDexTestKit
21
19
 
22
20
  run_as_group
23
21
 
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
22
+ verifies_requirements 'hl7.fhir.us.davinci-pdex_2.0.0@42'
23
+
28
24
  input :bulk_timeout,
29
25
  title: 'Export Times Out after (1-600)',
30
26
  description: <<~DESCRIPTION,
@@ -41,8 +37,9 @@ module DaVinciPDexTestKit
41
37
  id: :pdex_patient_export_in_cap_stmt,
42
38
  title: 'Bulk Data Server declares support for Patient export operation in CapabilityStatement',
43
39
  config: {
44
- options: { operation_name: 'export', operation_url: 'http://hl7.org/fhir/uv/bulkdata/OperationDefinition/patient-export' }
45
- }
40
+ options: { operation_name: 'export', operation_url: 'http://hl7.org/fhir/uv/bulkdata/OperationDefinition/patient-export', client: :bulk_server }
41
+ },
42
+ verifies_requirements: 'hl7.fhir.us.davinci-pdex_2.0.0@47'
46
43
 
47
44
  test from: :bulk_data_kick_off,
48
45
  id: :pdex_export_patient_kick_off,
@@ -54,7 +51,9 @@ module DaVinciPDexTestKit
54
51
  test from: :bulk_data_status_check,
55
52
  id: :pdex_export_patient_status_check,
56
53
  config: {
57
- inputs: { polling_url: { name: :patient_polling_url } },
54
+ inputs: {
55
+ polling_url: { name: :patient_polling_url },
56
+ },
58
57
  outputs: {
59
58
  status_response: { name: :patient_status_response },
60
59
  requires_access_token: { name: :patient_requires_access_token }
@@ -1,4 +1,3 @@
1
- # require 'bulk_data_test_kit/v1.0.1/bulk_data_multiple_patients_test'
2
1
  require 'bulk_data_test_kit/v1.0.1/bulk_data_ndjson_download_test'
3
2
  require 'bulk_data_test_kit/v1.0.1/bulk_data_valid_resources_test'
4
3
 
@@ -13,7 +12,7 @@ module DaVinciPDexTestKit
13
12
 
14
13
  id :pdex_export_validation
15
14
 
16
- input :patient_status_output, :patient_requires_access_token, :bearer_token, :patient_bulk_download_url
15
+ input :patient_status_output, :patient_requires_access_token, :patient_bulk_download_url
17
16
  input :lines_to_validate,
18
17
  title: 'Limit validation to a maximum resource count',
19
18
  description: 'To validate all, leave blank.',
@@ -0,0 +1,42 @@
1
+ require 'us_core_test_kit/must_support_test'
2
+ require 'us_core_test_kit/generator/group_metadata'
3
+
4
+ module DaVinciPDexTestKit
5
+ module PDexPayerServer
6
+ class MedicationDispenseMustSupportTest < Inferno::Test
7
+ include USCoreTestKit::MustSupportTest
8
+
9
+ title 'All must support elements are provided in the MedicationDispense resources returned'
10
+ description %(
11
+ PDex Responders SHALL be capable of populating all data elements as
12
+ part of the query results as specified by the PDex Server Capability
13
+ Statement. This test will look through the MedicationDispense resources
14
+ found previously for the following must support elements:
15
+
16
+ * MedicationDispense.status
17
+ * MedicationDispense.subject
18
+ * MedicationDispense.substitution
19
+ * MedicationDispense.substitution.wasSubstituted
20
+ )
21
+
22
+ id :pdex_medication_dispense_must_support
23
+
24
+ def resource_type
25
+ 'MedicationDispense'
26
+ end
27
+
28
+ def self.metadata
29
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'),
30
+ aliases: true))
31
+ end
32
+
33
+ def scratch_resources
34
+ scratch[:medication_dispense_resources] ||= {}
35
+ end
36
+
37
+ run do
38
+ perform_must_support_test(all_scratch_resources)
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,64 @@
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 MedicationDispensePatientSearchTest < Inferno::Test
8
+ include USCoreTestKit::SearchTest
9
+
10
+ title 'Server returns valid results for MedicationDispense search by patient'
11
+ description %(
12
+ A server SHALL support searching by
13
+ patient on the MedicationDispense 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 PDex responders.
21
+
22
+ Because this is the first search of the sequence, resources in the
23
+ response will be used for subsequent tests.
24
+
25
+ Additionally, this test will check that GET and POST search methods
26
+ return the same number of results. Search by POST is required by the
27
+ FHIR R4 specification, and these tests interpret search by GET as a
28
+ requirement of PDex v2.0.0.
29
+
30
+ [PDex Server CapabilityStatement](https://hl7.org/fhir/us/davinci-pdex/STU2/CapabilityStatement-pdex-server.html)
31
+ )
32
+
33
+ id :pdex_medication_dispense_patient_search
34
+ input :patient_ids,
35
+ title: 'Patient IDs',
36
+ description: 'Comma separated list of patient IDs that in sum contain all MUST SUPPORT elements'
37
+
38
+ def self.properties
39
+ @properties ||= USCoreTestKit::SearchTestProperties.new(
40
+ first_search: true,
41
+ resource_type: 'MedicationDispense',
42
+ search_param_names: ['patient'],
43
+ test_medication_inclusion: true,
44
+ test_reference_variants: true,
45
+ multiple_or_search_params: ['status'],
46
+ test_post_search: true
47
+ )
48
+ end
49
+
50
+ def self.metadata
51
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'),
52
+ aliases: true))
53
+ end
54
+
55
+ def scratch_resources
56
+ scratch[:medication_dispense_resources] ||= {}
57
+ end
58
+
59
+ run do
60
+ run_search_test
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,54 @@
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 MedicationDispensePatientStatusSearchTest < Inferno::Test
8
+ include USCoreTestKit::SearchTest
9
+
10
+ title 'Server returns valid results for MedicationDispense search by patient + status'
11
+ description %(
12
+ A server SHOULD support searching by
13
+ patient + status on the MedicationDispense 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
+ If any MedicationDispense resources use external references to
18
+ Medications, the search will be repeated with
19
+ `_include=MedicationDispense:medication`.
20
+
21
+ [PDex Server CapabilityStatement](https://hl7.org/fhir/us/davinci-pdex/STU2/CapabilityStatement-pdex-server.html)
22
+ )
23
+
24
+ id :pdex_medication_dispense_patient_status_search
25
+ optional
26
+
27
+ input :patient_ids,
28
+ title: 'Patient IDs',
29
+ description: 'Comma separated list of patient IDs that in sum contain all MUST SUPPORT elements'
30
+
31
+ def self.properties
32
+ @properties ||= USCoreTestKit::SearchTestProperties.new(
33
+ resource_type: 'MedicationDispense',
34
+ search_param_names: ['patient', 'status'],
35
+ test_medication_inclusion: true,
36
+ multiple_or_search_params: ['status']
37
+ )
38
+ end
39
+
40
+ def self.metadata
41
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'),
42
+ aliases: true))
43
+ end
44
+
45
+ def scratch_resources
46
+ scratch[:medication_dispense_resources] ||= {}
47
+ end
48
+
49
+ run do
50
+ run_search_test
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,55 @@
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 MedicationDispensePatientStatusTypeSearchTest < Inferno::Test
8
+ include USCoreTestKit::SearchTest
9
+
10
+ title 'Server returns valid results for MedicationDispense search by patient + status + type'
11
+ description %(
12
+ A server SHOULD support searching by
13
+ patient + status + type on the MedicationDispense 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
+ If any MedicationDispense resources use external references to
18
+ Medications, the search will be repeated with
19
+ `_include=MedicationDispense:medication`.
20
+
21
+ [PDex Server CapabilityStatement](https://hl7.org/fhir/us/davinci-pdex/STU2/CapabilityStatement-pdex-server.html)
22
+ )
23
+
24
+ id :pdex_medication_dispense_patient_status_type_search
25
+ optional
26
+
27
+ input :patient_ids,
28
+ title: 'Patient IDs',
29
+ description: 'Comma separated list of patient IDs that in sum contain all MUST SUPPORT elements'
30
+
31
+ def self.properties
32
+ @properties ||= USCoreTestKit::SearchTestProperties.new(
33
+ resource_type: 'MedicationDispense',
34
+ search_param_names: ['patient', 'status', 'type'],
35
+ test_medication_inclusion: true,
36
+ token_search_params: ['type'],
37
+ multiple_or_search_params: ['status', 'type']
38
+ )
39
+ end
40
+
41
+ def self.metadata
42
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'),
43
+ aliases: true))
44
+ end
45
+
46
+ def scratch_resources
47
+ scratch[:medication_dispense_resources] ||= {}
48
+ end
49
+
50
+ run do
51
+ run_search_test
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,54 @@
1
+ require 'us_core_test_kit/search_test'
2
+ require 'us_core_test_kit/generator/group_metadata'
3
+
4
+ module DaVinciPDexTestKit
5
+ module PDexPayerServer
6
+ class MedicationDispenseProvenanceRevincludeSearchTest < Inferno::Test
7
+ include USCoreTestKit::SearchTest
8
+
9
+ title 'Server returns Provenance resources from MedicationDispense search by patient + status + revInclude:Provenance:target'
10
+ description %(
11
+ A server SHALL be capable of supporting _revIncludes:Provenance:target.
12
+
13
+ This test will perform a search by patient + status + revInclude:Provenance:target and
14
+ will pass if a Provenance resource is found in the response.
15
+ %)
16
+
17
+ id :pdex_medication_dispense_provenance_revinclude_search
18
+
19
+ input :patient_ids,
20
+ title: 'Patient IDs',
21
+ description: 'Comma separated list of patient IDs that in sum contain all MUST SUPPORT elements'
22
+
23
+ def properties
24
+ @properties ||= USCoreTestKit::SearchTestProperties.new(
25
+ resource_type: 'MedicationDispense',
26
+ search_param_names: ['patient', 'status']
27
+ )
28
+ end
29
+
30
+ def self.metadata
31
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml')))
32
+ end
33
+
34
+ def self.provenance_metadata
35
+ @provenance_metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(
36
+ File.join(__dir__, '..', 'provenance',
37
+ 'metadata.yml'), aliases: true
38
+ ))
39
+ end
40
+
41
+ def scratch_resources
42
+ scratch[:medication_dispense_resources] ||= {}
43
+ end
44
+
45
+ def scratch_provenance_resources
46
+ scratch[:provenance_resources] ||= {}
47
+ end
48
+
49
+ run do
50
+ run_provenance_revinclude_search_test
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,26 @@
1
+ require 'us_core_test_kit/read_test'
2
+
3
+ module DaVinciPDexTestKit
4
+ module PDexPayerServer
5
+ class MedicationDispenseReadTest < Inferno::Test
6
+ include USCoreTestKit::ReadTest
7
+
8
+ title 'Server returns correct MedicationDispense resource from MedicationDispense read interaction'
9
+ description 'A server SHALL support the MedicationDispense read interaction.'
10
+
11
+ id :pdex_medication_dispense_read
12
+
13
+ def resource_type
14
+ 'MedicationDispense'
15
+ end
16
+
17
+ def scratch_resources
18
+ scratch[:medication_dispense_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,42 @@
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 MedicationDispenseReferenceResolutionTest < Inferno::Test
7
+ include USCoreTestKit::ReferenceResolutionTest
8
+
9
+ title 'MustSupport references within MedicationDispense 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 PDex profile.
16
+
17
+ Elements which may provide external references include:
18
+
19
+ * MedicationDispense.subject
20
+ )
21
+
22
+ id :pdex_medication_dispense_ref_resolution
23
+
24
+ def resource_type
25
+ 'MedicationDispense'
26
+ end
27
+
28
+ def self.metadata
29
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'),
30
+ aliases: true))
31
+ end
32
+
33
+ def scratch_resources
34
+ scratch[:medication_dispense_resources] ||= {}
35
+ end
36
+
37
+ run do
38
+ perform_reference_resolution_test(scratch_resources[:all])
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,39 @@
1
+ require 'us_core_test_kit/validation_test'
2
+
3
+ module DaVinciPDexTestKit
4
+ module PDexPayerServer
5
+ class MedicationDispenseValidationTest < Inferno::Test
6
+ include USCoreTestKit::ValidationTest
7
+
8
+ id :pdex_medication_dispense_validation
9
+ title 'MedicationDispense resources returned during previous tests conform to the PDex MedicationDispense'
10
+ description %(
11
+ This test verifies resources returned from the first search conform to
12
+ the [PDex MedicationDispense](http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/pdex-medicationdispense).
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
+ output :dar_code_found, :dar_extension_found
22
+
23
+ def resource_type
24
+ 'MedicationDispense'
25
+ end
26
+
27
+ def scratch_resources
28
+ scratch[:medication_dispense_resources] ||= {}
29
+ end
30
+
31
+ run do
32
+ perform_validation_test(scratch_resources[:all] || [],
33
+ 'http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/pdex-medicationdispense',
34
+ '2.0.0',
35
+ skip_if_empty: true)
36
+ end
37
+ end
38
+ end
39
+ end