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
@@ -0,0 +1,51 @@
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 ProvenanceMustSupportTest < Inferno::Test
7
+ include USCoreTestKit::MustSupportTest
8
+
9
+ title 'All must support elements are provided in the Provenance 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 Provenance resources
14
+ found previously for the following must support elements:
15
+
16
+ * Provenance.agent
17
+ * Provenance.agent.onBehalfOf
18
+ * Provenance.agent.type
19
+ * Provenance.agent.who
20
+ * Provenance.agent:ProvenanceAuthor
21
+ * Provenance.agent:ProvenanceAuthor.type
22
+ * Provenance.agent:ProvenanceAuthor.who
23
+ * Provenance.agent:ProvenanceTransmitter
24
+ * Provenance.agent:ProvenanceTransmitter.type
25
+ * Provenance.agent:ProvenanceTransmitter.who
26
+ * Provenance.entity.extension:sourceFormat
27
+ * Provenance.recorded
28
+ * Provenance.target
29
+ )
30
+
31
+ id :pdex_provenance_must_support
32
+
33
+ def resource_type
34
+ 'Provenance'
35
+ end
36
+
37
+ def self.metadata
38
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'),
39
+ aliases: true))
40
+ end
41
+
42
+ def scratch_resources
43
+ scratch[:provenance_resources] ||= {}
44
+ end
45
+
46
+ run do
47
+ perform_must_support_test(all_scratch_resources)
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,26 @@
1
+ require 'us_core_test_kit/read_test'
2
+
3
+ module DaVinciPDexTestKit
4
+ module PDexPayerServer
5
+ class ProvenanceReadTest < Inferno::Test
6
+ include USCoreTestKit::ReadTest
7
+
8
+ title 'Server returns correct Provenance resource from Provenance read interaction'
9
+ description 'A server SHALL support the Provenance read interaction.'
10
+
11
+ id :pdex_provenance_read
12
+
13
+ def resource_type
14
+ 'Provenance'
15
+ end
16
+
17
+ def scratch_resources
18
+ scratch[:provenance_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,46 @@
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 ProvenanceReferenceResolutionTest < Inferno::Test
7
+ include USCoreTestKit::ReferenceResolutionTest
8
+
9
+ title 'MustSupport references within Provenance 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
+ * Provenance.agent.onBehalfOf
20
+ * Provenance.agent.who
21
+ * Provenance.agent:ProvenanceAuthor.who
22
+ * Provenance.agent:ProvenanceTransmitter.who
23
+ * Provenance.target
24
+ )
25
+
26
+ id :pdex_provenance_ref_resolution
27
+
28
+ def resource_type
29
+ 'Provenance'
30
+ end
31
+
32
+ def self.metadata
33
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'),
34
+ aliases: true))
35
+ end
36
+
37
+ def scratch_resources
38
+ scratch[:provenance_resources] ||= {}
39
+ end
40
+
41
+ run do
42
+ perform_reference_resolution_test(scratch_resources[:all])
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,39 @@
1
+ require 'us_core_test_kit/validation_test'
2
+
3
+ module DaVinciPDexTestKit
4
+ module PDexPayerServer
5
+ class ProvenanceValidationTest < Inferno::Test
6
+ include USCoreTestKit::ValidationTest
7
+
8
+ id :pdex_provenance_validation
9
+ title 'Provenance resources returned during previous tests conform to the PDex Provenance'
10
+ description %(
11
+ This test verifies resources returned from the first search conform to
12
+ the [PDex Provenance](http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/pdex-provenance).
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
+ 'Provenance'
25
+ end
26
+
27
+ def scratch_resources
28
+ scratch[:provenance_resources] ||= {}
29
+ end
30
+
31
+ run do
32
+ perform_validation_test(scratch_resources[:all] || [],
33
+ 'http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/pdex-provenance',
34
+ '2.0.0',
35
+ skip_if_empty: true)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,59 @@
1
+ require_relative 'provenance/provenance_read_test'
2
+ require_relative 'provenance/provenance_validation_test'
3
+ require_relative 'provenance/provenance_must_support_test'
4
+ require_relative 'provenance/provenance_reference_resolution_test'
5
+
6
+ module DaVinciPDexTestKit
7
+ module PDexPayerServer
8
+ class ProvenanceGroup < Inferno::TestGroup
9
+ title 'PDex Provenance Tests'
10
+ short_description 'Verify support for the server capabilities required by the PDex Provenance.'
11
+ description %(
12
+ # Background
13
+
14
+ The PDex Provenance sequence verifies that the system under test is
15
+ able to provide correct responses for Provenance queries. These queries
16
+ must contain resources conforming to the PDex Provenance as
17
+ specified in the PDex v2.0.0 Implementation Guide.
18
+
19
+ # Testing Methodology
20
+
21
+
22
+ ## Must Support
23
+ Each profile contains elements marked as "must support". This test
24
+ sequence expects to see each of these elements at least once. If at
25
+ least one cannot be found, the test will fail. The test will look
26
+ through the Provenance resources found in the first test for these
27
+ elements.
28
+
29
+ ## Profile Validation
30
+ Each resource returned from the first search is expected to conform to
31
+ the [PDex Provenance](http://hl7.org/fhir/us/davinci-pdex/StructureDefinition/pdex-provenance). Each element is checked against
32
+ teminology binding and cardinality requirements.
33
+
34
+ Elements with a required binding are validated against their bound
35
+ ValueSet. If the code/system in the element is not part of the ValueSet,
36
+ then the test will fail.
37
+
38
+ ## Reference Validation
39
+ At least one instance of each external reference in elements marked as
40
+ "must support" within the resources provided by the system must resolve.
41
+ The test will attempt to read each reference found and will fail if no
42
+ read succeeds.
43
+ )
44
+
45
+ id :pdex_provenance
46
+ run_as_group
47
+
48
+ def self.metadata
49
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'provenance', 'metadata.yml'),
50
+ aliases: true))
51
+ end
52
+
53
+ test from: :pdex_provenance_read
54
+ test from: :pdex_provenance_validation
55
+ test from: :pdex_provenance_must_support
56
+ test from: :pdex_provenance_ref_resolution
57
+ end
58
+ end
59
+ end
@@ -18,25 +18,37 @@ module DaVinciPDexTestKit
18
18
  for this test. If neither is available tests are skipped.
19
19
  }
20
20
 
21
+ verifies_requirements 'hl7.fhir.us.davinci-pdex_2.0.0@42'
22
+
21
23
  input :patient_id,
22
- title: 'Patient ID',
23
- description: 'Manual Patient ID for testing Clinical Query and $everything without $member-match.',
24
- optional: true
24
+ title: 'Patient ID',
25
+ description: 'Manual Patient ID for testing Clinical Query and $everything without $member-match.',
26
+ optional: true
27
+
28
+ input :smart_auth_info,
29
+ title: 'OAuth Credentials',
30
+ type: :auth_info,
31
+ optional: true
32
+
33
+ fhir_client do
34
+ url :url
35
+ auth_info :smart_auth_info
36
+ end
25
37
 
26
38
  test do
27
39
  id :pdex_workflow_clinical_encounter_query_test
28
40
  title 'Server can provide clinical Encounter data from matched member identifier'
29
- description %{
41
+ description %(
30
42
  Server receives request `GET [baseURL]/Encounter?subject=Patient/[id]` and returns 200.
31
- }
43
+ )
32
44
 
33
45
  makes_request :pdex_clinical_query
34
46
 
35
47
  run do
36
48
  skip_if !patient_id,
37
- 'No Patient FHIR ID was derived from $member-match response or supplied by user input'
49
+ 'No Patient FHIR ID was derived from $member-match response or supplied by user input'
38
50
 
39
- fhir_search(FHIR::Encounter, params: {patient: "Patient/#{patient_id}"}, name: :pdex_clinical_query)
51
+ fhir_search(FHIR::Encounter, params: { patient: "Patient/#{patient_id}" }, name: :pdex_clinical_query)
40
52
  assert_response_status(200)
41
53
  end
42
54
  end
@@ -44,9 +56,9 @@ module DaVinciPDexTestKit
44
56
  test do
45
57
  id :pdex_workflow_clinical_encounter_test
46
58
  title 'Server returned Search bundle with valid Encounter data'
47
- description %{
59
+ description %(
48
60
  Server returned search Bundle of Encounters with least 1 resource entry.
49
- }
61
+ )
50
62
 
51
63
  uses_request :pdex_clinical_query
52
64
 
@@ -54,11 +66,10 @@ module DaVinciPDexTestKit
54
66
  assert_valid_resource
55
67
  assert_resource_type('Bundle')
56
68
  assert resource.entry.length > 0, 'Response Bundle must have at least one entry'
57
- assert resource.entry.map{|entry| entry.resource}.all? { |res| res.resourceType == 'Encounter' },
69
+ assert resource.entry.map { |entry| entry.resource }.all? { |res| res.resourceType == 'Encounter' },
58
70
  'Response Bundle must only have Encounter resources'
59
71
  end
60
72
  end
61
73
  end
62
74
  end
63
75
  end
64
-
@@ -19,11 +19,22 @@ module DaVinciPDexTestKit
19
19
  This test sequence takes a patient id input and executes the `$everything` FHIR operation on it.
20
20
  }
21
21
 
22
+ verifies_requirements 'hl7.fhir.us.davinci-pdex_2.0.0@42'
22
23
 
23
24
  input :patient_id,
24
- title: 'Patient ID',
25
- description: 'Manual Patient ID for testing Clinical Query and $everything $export without $member-match.',
26
- optional: true
25
+ title: 'Patient ID',
26
+ description: 'Manual Patient ID for testing Clinical Query and $everything $export without $member-match.',
27
+ optional: true
28
+
29
+ input :smart_auth_info,
30
+ title: 'OAuth Credentials',
31
+ type: :auth_info,
32
+ optional: true
33
+
34
+ fhir_client do
35
+ url :url
36
+ auth_info :smart_auth_info
37
+ end
27
38
 
28
39
  test from: :pdex_patient_operation_in_cap_stmt_validation,
29
40
  title: 'Server declares support for Patient everything operation in CapabilityStatement',
@@ -34,11 +45,13 @@ module DaVinciPDexTestKit
34
45
  test do
35
46
  title 'Server can handle GET /Patient/[ID]/$everything'
36
47
 
48
+ verifies_requirements 'hl7.fhir.us.davinci-pdex_2.0.0@46'
49
+
37
50
  makes_request :pdex_patient_everything
38
51
 
39
52
  run do
40
53
  skip_if !patient_id,
41
- "No Patient FHIR ID was derived from $member-match response or supplied by user input"
54
+ 'No Patient FHIR ID was derived from $member-match response or supplied by user input'
42
55
 
43
56
  fhir_operation("/Patient/#{patient_id}/$everything", operation_method: :get, name: :pdex_patient_everything)
44
57
 
@@ -55,7 +68,7 @@ module DaVinciPDexTestKit
55
68
 
56
69
  run do
57
70
  skip_if !patient_id
58
- 'No Patient ID was derived from $member-match nor supplied from user input'
71
+ 'No Patient ID was derived from $member-match nor supplied from user input'
59
72
  skip_if response[:status] != 200, 'Skipped because previous test did not pass'
60
73
 
61
74
  assert_valid_resource
@@ -69,7 +82,7 @@ module DaVinciPDexTestKit
69
82
  end
70
83
  end
71
84
 
72
- # TODO: convert to attestation
85
+ # TODO: convert to attestation
73
86
  # test do
74
87
  # title %{
75
88
  # The resources returned SHALL include all the data covered by the meaningful use common data elements as
@@ -1,5 +1,4 @@
1
1
  require 'bulk_data_test_kit/v2.0.0/bulk_data_patient_export_test_group'
2
- # require 'bulk_data_test_kit/v1.0.1/patient/bulk_data_patient_export_group'
3
2
  require_relative 'export_patient_group'
4
3
  require_relative 'export_validation_group'
5
4
 
@@ -25,33 +24,41 @@ module DaVinciTestKit
25
24
  to be returned by Patient-level export. The tests require a Bulk Data Autthorization Bearer Token.
26
25
  }
27
26
 
28
- config({
29
- inputs: {
30
- url: { name: :bulk_server_url },
31
- # bulk_server_url: { name: :url },
32
- bulk_export_url: { default: 'Patient/$export' },
33
- bearer_token: { description: 'The authorization bearer token for $export access that is scoped to the same patient found by $member-match or entered as patient id. This is not necessarily the same OAuth token that allows access to the server\'s $member-match. If omitted $export tests will be skipped.' }
27
+ config(
28
+ {
29
+ inputs: {
30
+ url: { name: :bulk_server_url },
31
+ bulk_export_url: { default: 'Patient/$export' },
32
+ smart_auth_info: {
33
+ name: :bulk_auth_info,
34
+ title: 'Bulk Data Authorization',
35
+ description: "The authorization information for $export access that is scoped to the same patient found by $member-match or entered as patient id. This is not necessarily the same authorization information that allows access to the server's $member-match.",
36
+ options: {
37
+ mode: 'access'
38
+ },
39
+ optional: true
40
+ }
41
+ }
34
42
  }
35
- })
43
+ )
36
44
 
37
45
  input :url # inherit properties from test suite
38
46
 
39
- input :bearer_token # inherit properties from parent
40
-
41
47
  input :patient_id,
42
- title: 'Patient ID',
43
- description: 'Manual Patient ID for testing Clinical Query, $everything, and $export without $member-match.',
44
- optional: true
48
+ title: 'Patient ID',
49
+ description: 'Manual Patient ID for testing Clinical Query, $everything, and $export without $member-match.',
50
+ optional: true
45
51
 
46
52
  # Required by Bulk Data tests
47
53
  fhir_client :bulk_server do
48
54
  url :url
49
- bearer_token :bearer_token
55
+ # auth_info :bulk_auth_info # FIXME to respect config, workaround below:
56
+ headers { 'Authorization' => "Bearer #{bulk_auth_info.access_token}" }
50
57
  end
51
58
 
52
59
  http_client :bulk_server do
53
60
  url :url
54
- headers {'Authorization' => "Bearer #{bearer_token}"}
61
+ headers { 'Authorization' => "Bearer #{bulk_auth_info.access_token}" }
55
62
  end
56
63
 
57
64
  group from: :pdex_patient_export
@@ -59,7 +66,6 @@ module DaVinciTestKit
59
66
  group from: :pdex_export_validation,
60
67
  title: 'Patient Export Validation Tests',
61
68
  optional: true
62
-
63
69
  end
64
70
  end
65
71
  end
@@ -19,11 +19,11 @@ module DaVinciPDexTestKit
19
19
  [required by the PDex Implementation Guide](https://hl7.org/fhir/us/davinci-pdex/STU2/payertopayerexchange.html#member-match-with-consent).
20
20
 
21
21
  # Testing Methodology
22
-
22
+
23
23
  The developer must supply JSON FHIR input parameter conforming to the
24
24
  [member match request profile](https://hl7.org/fhir/us/davinci-hrex/STU1/StructureDefinition-hrex-parameters-member-match-in.html). This
25
25
  test sequence will:
26
-
26
+
27
27
  1. Request the server's capability statement and verify that it asserts support for the $member-match operation
28
28
  2. Validate user's member match request input
29
29
  + validate Parameters profile conformance
@@ -32,15 +32,25 @@ module DaVinciPDexTestKit
32
32
  + optional: validate minimal data on CoverageToLink parameter
33
33
  3. POST request to server and validate HTTP 200 response status
34
34
  4. validate memeber match response conforms to profile
35
- 5. use member identifier from response to query for patient id
35
+ 5. use member identifier from response to query for patient id
36
36
  }
37
37
 
38
38
  run_as_group
39
39
 
40
40
  input :member_match_request,
41
- title: 'Member Match Request for one match',
42
- description: "A JSON payload for server's $member-match endpoint that has **exactly one match**",
43
- type: 'textarea'
41
+ title: 'Member Match Request for one match',
42
+ description: "A JSON payload for server's $member-match endpoint that has **exactly one match**",
43
+ type: 'textarea'
44
+
45
+ input :smart_auth_info,
46
+ title: 'OAuth Credentials',
47
+ type: :auth_info,
48
+ optional: true
49
+
50
+ fhir_client do
51
+ url :url
52
+ auth_info :smart_auth_info
53
+ end
44
54
 
45
55
  test from: :pdex_patient_operation_in_cap_stmt_validation,
46
56
  id: :pdex_member_match_operation_in_cap_stmt,
@@ -67,22 +77,22 @@ module DaVinciPDexTestKit
67
77
 
68
78
  test from: :pdex_coverage_to_link_minimal_validation
69
79
  test from: :pdex_coverage_to_link_ms_validation
70
-
80
+
71
81
  test do
72
82
  id :pdex_member_match_on_server
73
83
  title 'Server handles $member-match operation successfully'
74
84
  description 'Server receives request `POST [baseURL]/Patient/$member-match` and returns 200'
75
-
85
+
76
86
  input :member_match_request
77
-
87
+
78
88
  makes_request :member_match
79
-
89
+
80
90
  run do
81
91
  fhir_operation('/Patient/$member-match', body: FHIR.from_contents(member_match_request), name: :member_match)
82
92
  assert_response_status(200)
83
93
  end
84
94
  end
85
-
95
+
86
96
  test do
87
97
  id :pdex_member_match_response_profile
88
98
  title 'Server $member-match response conforms to profile'
@@ -92,7 +102,7 @@ module DaVinciPDexTestKit
92
102
  }
93
103
 
94
104
  output :member_identifier
95
- output :member_identifier_system
105
+ output :member_identifier_system
96
106
 
97
107
  uses_request :member_match
98
108
 
@@ -102,17 +112,19 @@ module DaVinciPDexTestKit
102
112
  assert_resource_type('Parameters')
103
113
 
104
114
  # We should save the output before validating every detail of the payload
105
- output member_identifier: resource.parameter.find{|p| p.name=='MemberIdentifier'}&.valueIdentifier&.value
106
- output member_identifier_system: resource.parameter.find{|p| p.name=='MemberIdentifier'}&.valueIdentifier&.system
115
+ output member_identifier: resource.parameter.find { |p| p.name == 'MemberIdentifier' }&.valueIdentifier&.value
116
+ output member_identifier_system: resource.parameter.find { |p|
117
+ p.name == 'MemberIdentifier'
118
+ }&.valueIdentifier&.system
107
119
 
108
120
  assert_valid_resource(profile_url: 'http://hl7.org/fhir/us/davinci-hrex/StructureDefinition/hrex-parameters-member-match-out')
109
121
  end
110
122
  end
111
-
123
+
112
124
  test do
113
125
  id :pdex_member_match_identifier_to_id
114
126
  title 'Server member identifier from $member-match yields logical Patient id'
115
- description %Q{
127
+ description %(
116
128
  The $member-match operation returns a Member Identifier, and subsequent clinical queries and operations
117
129
  are only required to support logical Patient FHIR ID. Hence server must be able to provide a Patient
118
130
  FHIR ID from Member Identifier.
@@ -120,15 +132,17 @@ module DaVinciPDexTestKit
120
132
  Server receives request `GET [baseURL]/Patient?identifier=[member_identifier]`
121
133
  and returns 200 and a Bundle with a single FHIR Patient. The `[member_identifier]` is from Member Match Response
122
134
  `Parameters.parameter:MemberIdentifier.valueIdentifier.value`.
123
- }
135
+ )
136
+
137
+ verifies_requirements 'hl7.fhir.us.davinci-pdex_2.0.0@35'
124
138
 
125
139
  input :member_identifier
126
140
  input :member_identifier_system, optional: true
127
141
  output :patient_id
128
142
 
129
143
  run do
130
- skip_if !member_identifier, "No member identifier obtained from $member-match request"
131
-
144
+ skip_if !member_identifier, 'No member identifier obtained from $member-match request'
145
+
132
146
  # We only query by identifier.value, and preset information happens to return a value with a system within it
133
147
  # which may be a bug.
134
148
  # Other options are to query by system|value or type-of:
@@ -139,19 +153,24 @@ module DaVinciPDexTestKit
139
153
  assert_valid_json(response[:body])
140
154
  assert_resource_type('Bundle')
141
155
 
142
- assert resource.entry.find{ |entry| entry.resource&.resourceType == 'Patient' }, "Bundle has no Patient resource."
156
+ assert resource.entry.find { |entry|
157
+ entry.resource&.resourceType == 'Patient'
158
+ }, 'Bundle has no Patient resource.'
143
159
 
144
- patient_id = resource.entry.reverse_each.find{ |entry| entry.resource&.resourceType == 'Patient' }&.resource&.id
145
- assert patient_id, "Patient resource in Bundle has no logical resource id"
160
+ patient_id = resource.entry.reverse_each.find do |entry|
161
+ entry.resource&.resourceType == 'Patient'
162
+ end&.resource&.id
163
+ assert patient_id, 'Patient resource in Bundle has no logical resource id'
146
164
 
147
- info "Multiple patients found, using the last patient id." if resource.entry.select{ |entry| entry.resource&.resourceType == 'Patient' }.length > 1
165
+ info 'Multiple patients found, using the last patient id.' if resource.entry.select do |entry|
166
+ entry.resource&.resourceType == 'Patient'
167
+ end.length > 1
148
168
 
149
- output :patient_id => patient_id
169
+ output patient_id: patient_id
150
170
 
151
171
  assert_valid_resource
152
172
  end
153
173
  end
154
-
155
174
  end
156
175
  end
157
176
  end