davinci_dtr_test_kit 0.13.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_adaptive_questionnaire_completion_group.rb +23 -0
  3. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_adaptive_questionnaire_followup_questions_group.rb +26 -0
  4. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_adaptive_questionnaire_next_question_request_test.rb +93 -0
  5. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_adaptive_questionnaire_next_question_request_validation_test.rb +62 -0
  6. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_adaptive_questionnaire_next_question_retrieval_group.rb +23 -0
  7. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_adaptive_questionnaire_response_validation_test.rb +66 -0
  8. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_full_ehr_adaptive_dinner_questionnaire_workflow_group.rb +76 -0
  9. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_full_ehr_adaptive_questionnaire_initial_retrieval_group.rb +27 -0
  10. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_full_ehr_adaptive_questionnaire_request_test.rb +63 -0
  11. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_smart_app_adaptive_questionnaire_initial_retrieval_group.rb +24 -0
  12. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_smart_app_adaptive_questionnaire_request_test.rb +148 -0
  13. data/lib/davinci_dtr_test_kit/client_groups/dinner_adaptive/dtr_smart_app_questionnaire_workflow_group.rb +75 -0
  14. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/dtr_full_ehr_questionnaire_workflow_group.rb +22 -38
  15. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/dtr_smart_app_dinner_questionnaire_package_request_test.rb +13 -16
  16. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/dtr_smart_app_questionnaire_workflow_group.rb +9 -31
  17. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static → full_ehr}/dtr_full_ehr_launch_attestation_test.rb +7 -6
  18. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static → full_ehr}/dtr_full_ehr_prepopulation_attestation_test.rb +7 -7
  19. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static → full_ehr}/dtr_full_ehr_prepopulation_override_attestation_test.rb +7 -7
  20. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static/dtr_full_ehr_dinner_questionnaire_package_request_test.rb → full_ehr/dtr_full_ehr_questionnaire_package_request_test.rb} +2 -3
  21. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static/dtr_full_ehr_dinner_static_questionnaire_response_conformance_test.rb → full_ehr/dtr_full_ehr_questionnaire_response_conformance_test.rb} +7 -3
  22. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static/dtr_full_ehr_dinner_static_questionnaire_response_correctness_test.rb → full_ehr/dtr_full_ehr_questionnaire_response_correctness_test.rb} +14 -7
  23. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static → full_ehr}/dtr_full_ehr_rendering_enabled_questions_attestation_test.rb +7 -7
  24. data/lib/davinci_dtr_test_kit/client_groups/full_ehr/dtr_full_ehr_saving_questionnaire_response_group.rb +29 -0
  25. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static → full_ehr}/dtr_full_ehr_store_attestation_test.rb +7 -7
  26. data/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_rendering_attestation_test.rb +7 -6
  27. data/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_resp_questionnaire_package_request_test.rb +15 -18
  28. data/lib/davinci_dtr_test_kit/client_groups/shared/dtr_questionnaire_response_basic_conformance_test.rb +5 -1
  29. data/lib/davinci_dtr_test_kit/client_groups/shared/dtr_questionnaire_response_pre_population_test.rb +12 -5
  30. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static → smart_app}/dtr_smart_app_prepopulation_attestation_test.rb +7 -7
  31. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static → smart_app}/dtr_smart_app_prepopulation_override_attestation_test.rb +7 -6
  32. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static → smart_app}/dtr_smart_app_questionnaire_response_save_test.rb +17 -7
  33. data/lib/davinci_dtr_test_kit/client_groups/{dinner_static → smart_app}/dtr_smart_app_rendering_enabled_questions_attestation_test.rb +7 -7
  34. data/lib/davinci_dtr_test_kit/client_groups/smart_app/dtr_smart_app_saving_questionnaire_response_group.rb +27 -0
  35. data/lib/davinci_dtr_test_kit/cql_test.rb +37 -140
  36. data/lib/davinci_dtr_test_kit/create_test.rb +25 -0
  37. data/lib/davinci_dtr_test_kit/docs/dtr_full_ehr_suite_description_v201.md +95 -37
  38. data/lib/davinci_dtr_test_kit/docs/dtr_light_ehr_suite_description_v201.md +11 -6
  39. data/lib/davinci_dtr_test_kit/docs/dtr_payer_server_suite_description_v201.md +32 -29
  40. data/lib/davinci_dtr_test_kit/docs/dtr_smart_app_suite_description_v201.md +48 -32
  41. data/lib/davinci_dtr_test_kit/dtr_full_ehr_suite.rb +13 -17
  42. data/lib/davinci_dtr_test_kit/dtr_light_ehr_suite.rb +67 -2
  43. data/lib/davinci_dtr_test_kit/dtr_payer_server_suite.rb +9 -20
  44. data/lib/davinci_dtr_test_kit/dtr_questionnaire_response_validation.rb +18 -10
  45. data/lib/davinci_dtr_test_kit/dtr_smart_app_suite.rb +32 -59
  46. data/lib/davinci_dtr_test_kit/endpoints/cors.rb +20 -0
  47. data/lib/davinci_dtr_test_kit/endpoints/mock_authorization/authorize_endpoint.rb +32 -0
  48. data/lib/davinci_dtr_test_kit/endpoints/mock_authorization/simple_token_endpoint.rb +19 -0
  49. data/lib/davinci_dtr_test_kit/endpoints/mock_authorization/token_endpoint.rb +116 -0
  50. data/lib/davinci_dtr_test_kit/endpoints/mock_authorization.rb +83 -0
  51. data/lib/davinci_dtr_test_kit/endpoints/mock_ehr/fhir_get_endpoint.rb +95 -0
  52. data/lib/davinci_dtr_test_kit/endpoints/mock_ehr/questionnaire_response_endpoint.rb +22 -0
  53. data/lib/davinci_dtr_test_kit/endpoints/mock_ehr.rb +25 -0
  54. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/full_ehr_next_question_endpoint.rb +11 -0
  55. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/full_ehr_questionnaire_package_endpoint.rb +11 -0
  56. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb +162 -0
  57. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_proxy_endpoint.rb +36 -0
  58. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/questionnaire_package_endpoint.rb +62 -0
  59. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/questionnaire_package_proxy_endpoint.rb +38 -0
  60. data/lib/davinci_dtr_test_kit/endpoints/mock_payer.rb +36 -0
  61. data/lib/davinci_dtr_test_kit/fixtures/dinner_adaptive/dinner_order_adaptive_next_question_burrito.json +10 -2
  62. data/lib/davinci_dtr_test_kit/fixtures/dinner_adaptive/dinner_order_adaptive_next_question_hamburger.json +10 -2
  63. data/lib/davinci_dtr_test_kit/fixtures/dinner_adaptive/dinner_order_adaptive_next_question_initial.json +10 -2
  64. data/lib/davinci_dtr_test_kit/fixtures/dinner_adaptive/questionnaire_dinner_order_adaptive.json +4 -3
  65. data/lib/davinci_dtr_test_kit/fixtures.rb +24 -1
  66. data/lib/davinci_dtr_test_kit/payer_server_groups/adaptive_form_libraries_test.rb +2 -2
  67. data/lib/davinci_dtr_test_kit/payer_server_groups/adaptive_form_questionnaire_expressions_test.rb +4 -3
  68. data/lib/davinci_dtr_test_kit/payer_server_groups/adaptive_form_questionnaire_extensions_test.rb +3 -2
  69. data/lib/davinci_dtr_test_kit/payer_server_groups/adaptive_next_questionnaire_expressions_test.rb +6 -6
  70. data/lib/davinci_dtr_test_kit/payer_server_groups/adaptive_next_questionnaire_extensions_test.rb +6 -5
  71. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_adaptive_group.rb +2 -2
  72. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_adaptive_response_bundles_validation_test.rb +6 -9
  73. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_adaptive_response_search_validation_test.rb +15 -12
  74. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_adaptive_response_validation_test.rb +33 -23
  75. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_next_response_complete_test.rb +4 -4
  76. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_next_response_validation_test.rb +16 -12
  77. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_libraries_test.rb +2 -2
  78. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_questionnaire_expressions_test.rb +5 -4
  79. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_questionnaire_extensions_test.rb +4 -3
  80. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_response_validation_test.rb +32 -25
  81. data/lib/davinci_dtr_test_kit/profiles/communication_request/communication_request_read.rb +29 -0
  82. data/lib/davinci_dtr_test_kit/profiles/communication_request/communication_request_validation.rb +35 -0
  83. data/lib/davinci_dtr_test_kit/profiles/communication_request_group.rb +39 -0
  84. data/lib/davinci_dtr_test_kit/profiles/coverage/coverage_read.rb +29 -0
  85. data/lib/davinci_dtr_test_kit/profiles/coverage/coverage_validation.rb +35 -0
  86. data/lib/davinci_dtr_test_kit/profiles/coverage_group.rb +38 -0
  87. data/lib/davinci_dtr_test_kit/profiles/device_request/device_request_read.rb +29 -0
  88. data/lib/davinci_dtr_test_kit/profiles/device_request/device_request_validation.rb +35 -0
  89. data/lib/davinci_dtr_test_kit/profiles/device_request_group.rb +39 -0
  90. data/lib/davinci_dtr_test_kit/profiles/encounter/encounter_read.rb +29 -0
  91. data/lib/davinci_dtr_test_kit/profiles/encounter/encounter_validation.rb +35 -0
  92. data/lib/davinci_dtr_test_kit/profiles/encounter_group.rb +39 -0
  93. data/lib/davinci_dtr_test_kit/profiles/medication_request/medication_request_read.rb +29 -0
  94. data/lib/davinci_dtr_test_kit/profiles/medication_request/medication_request_validation.rb +35 -0
  95. data/lib/davinci_dtr_test_kit/profiles/medication_request_group.rb +39 -0
  96. data/lib/davinci_dtr_test_kit/profiles/nutrition_order/nutrition_order_read.rb +29 -0
  97. data/lib/davinci_dtr_test_kit/profiles/nutrition_order/nutrition_order_validation.rb +35 -0
  98. data/lib/davinci_dtr_test_kit/profiles/nutrition_order_group.rb +39 -0
  99. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_context_search.rb +35 -0
  100. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_create.rb +26 -0
  101. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_patient_search.rb +55 -0
  102. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_read.rb +22 -0
  103. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_update.rb +26 -0
  104. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_validation.rb +37 -0
  105. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response_group.rb +66 -0
  106. data/lib/davinci_dtr_test_kit/profiles/service_request/service_request_read.rb +29 -0
  107. data/lib/davinci_dtr_test_kit/profiles/service_request/service_request_validation.rb +35 -0
  108. data/lib/davinci_dtr_test_kit/profiles/service_request_group.rb +39 -0
  109. data/lib/davinci_dtr_test_kit/profiles/task/task_create.rb +26 -0
  110. data/lib/davinci_dtr_test_kit/profiles/task/task_read.rb +29 -0
  111. data/lib/davinci_dtr_test_kit/profiles/task/task_update.rb +26 -0
  112. data/lib/davinci_dtr_test_kit/profiles/task/task_validation.rb +35 -0
  113. data/lib/davinci_dtr_test_kit/profiles/task_group.rb +52 -0
  114. data/lib/davinci_dtr_test_kit/profiles/vision_prescription/vision_prescription_read.rb +29 -0
  115. data/lib/davinci_dtr_test_kit/profiles/vision_prescription/vision_prescription_validation.rb +35 -0
  116. data/lib/davinci_dtr_test_kit/profiles/vision_prescription_group.rb +39 -0
  117. data/lib/davinci_dtr_test_kit/read_test.rb +22 -0
  118. data/lib/davinci_dtr_test_kit/tags.rb +5 -7
  119. data/lib/davinci_dtr_test_kit/update_test.rb +25 -0
  120. data/lib/davinci_dtr_test_kit/validation_test.rb +19 -4
  121. data/lib/davinci_dtr_test_kit/version.rb +1 -1
  122. metadata +109 -20
  123. data/lib/davinci_dtr_test_kit/ext/inferno_core/record_response_route.rb +0 -98
  124. data/lib/davinci_dtr_test_kit/ext/inferno_core/request.rb +0 -19
  125. data/lib/davinci_dtr_test_kit/ext/inferno_core/runnable.rb +0 -35
  126. data/lib/davinci_dtr_test_kit/mock_auth_server.rb +0 -228
  127. data/lib/davinci_dtr_test_kit/mock_ehr.rb +0 -105
  128. data/lib/davinci_dtr_test_kit/mock_payer.rb +0 -100
@@ -0,0 +1,29 @@
1
+ require_relative '../../read_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class ServiceRequestReadTest < Inferno::Test
5
+ include DaVinciDTRTestKit::ReadTest
6
+
7
+ title 'Server returns correct ServiceRequest resource from ServiceRequest read interaction'
8
+ description 'A server SHOULD support the ServiceRequest read interaction.'
9
+
10
+ id :service_request_read
11
+ output :service_request_resources
12
+
13
+ def resource_type
14
+ 'ServiceRequest'
15
+ end
16
+
17
+ def service_request_id_list
18
+ return [nil] unless respond_to? :service_request_ids
19
+
20
+ service_request_ids&.split(',')&.map(&:strip)
21
+ end
22
+
23
+ run do
24
+ resources = perform_read_test(service_request_id_list, resource_type)
25
+
26
+ output service_request_resources: resources.to_json
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+ require_relative '../../validation_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class ServiceRequestValidationTest < Inferno::Test
5
+ include DaVinciDTRTestKit::ValidationTest
6
+
7
+ title 'ServiceRequest resources returned during previous tests conform to the CRD ServiceRequest'
8
+ description %(
9
+ This test verifies resources returned from the read step conform to
10
+ the [CRD ServiceRequest](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-servicerequest).
11
+ Systems must demonstrate at least one valid example in order to pass this test.
12
+
13
+ It verifies the presence of mandatory elements and that elements with
14
+ required bindings contain appropriate values. CodeableConcept element
15
+ bindings will fail if none of their codings have a code/system belonging
16
+ to the bound ValueSet. Quantity, Coding, and code element bindings will
17
+ fail if their code/system are not found in the valueset.
18
+
19
+ )
20
+
21
+ id :service_request_validation
22
+ input :service_request_resources,
23
+ optional: true
24
+
25
+ def resource_type
26
+ 'ServiceRequest'
27
+ end
28
+
29
+ run do
30
+ skip_if(service_request_ids.nil?, "No `#{resource_type}` IDs provided, skipping test.")
31
+ perform_profile_validation_test(service_request_resources, resource_type,
32
+ 'http://hl7.org/fhir/us/davinci-crd/StructureDefinition/profile-servicerequest|2.0.1')
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,39 @@
1
+ require_relative 'service_request/service_request_read'
2
+ require_relative 'service_request/service_request_validation'
3
+
4
+ module DaVinciDTRTestKit
5
+ class ServiceRequestGroup < Inferno::TestGroup
6
+ title 'CRD ServiceRequest Tests'
7
+ short_description 'Verify support for the server capabilities required by the CRD ServiceRequest Profile'
8
+ description %(
9
+ # Background
10
+
11
+ The CRD ServiceRequest sequence verifies that the system under test is
12
+ able to provide correct responses for ServiceRequest queries. These queries
13
+ must return resources conforming to the [CRD ServiceRequest Profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-servicerequest.html).
14
+
15
+ # Testing Methodology
16
+ ## Read
17
+ First, Inferno will attempt to read each ServiceRequest resource id provided in
18
+ the ServiceRequest IDs input. The server SHOULD be capable of returning a
19
+ ServiceRequest resource using the read interaction.
20
+
21
+ ## Profile Validation
22
+ Each resource returned from the read step SHALL conform to
23
+ the [CRD ServiceRequest Profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-servicerequest.html).
24
+ Each element is checked against terminology binding and cardinality requirements.
25
+
26
+ )
27
+ id :service_request_group
28
+ optional
29
+ run_as_group
30
+
31
+ input :service_request_ids,
32
+ title: 'Service Request IDs',
33
+ description: 'Comma separated list of ServiceRequest IDs',
34
+ optional: true
35
+
36
+ test from: :service_request_read
37
+ test from: :service_request_validation
38
+ end
39
+ end
@@ -0,0 +1,26 @@
1
+ require_relative '../../create_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class TaskCreateTest < Inferno::Test
5
+ include DaVinciDTRTestKit::CreateTest
6
+
7
+ title 'Server is capable of creating a Task resource from Task create interaction'
8
+ description 'A server SHOULD support the Task create interaction'
9
+
10
+ id :task_create
11
+ input :create_task_resources,
12
+ type: 'textarea',
13
+ title: 'Create Task Resources',
14
+ description:
15
+ 'Provide a list of Task resources to create. e.g., [json_resource_1, json_resource_2]',
16
+ optional: true
17
+
18
+ def resource_type
19
+ 'Task'
20
+ end
21
+
22
+ run do
23
+ perform_create_test(create_task_resources, resource_type)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,29 @@
1
+ require_relative '../../read_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class TaskReadTest < Inferno::Test
5
+ include DaVinciDTRTestKit::ReadTest
6
+
7
+ title 'Server returns correct Task resource from Task read interaction'
8
+ description 'A server SHOULD support the Task read interaction.'
9
+
10
+ id :task_read
11
+ output :task_resources
12
+
13
+ def resource_type
14
+ 'Task'
15
+ end
16
+
17
+ def task_id_list
18
+ return [nil] unless respond_to? :task_ids
19
+
20
+ task_ids&.split(',')&.map(&:strip)
21
+ end
22
+
23
+ run do
24
+ resources = perform_read_test(task_id_list, resource_type)
25
+
26
+ output task_resources: resources.to_json
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,26 @@
1
+ require_relative '../../update_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class TaskUpdateTest < Inferno::Test
5
+ include DaVinciDTRTestKit::UpdateTest
6
+
7
+ title 'Server is capable of updating a Task resource from Task update interaction'
8
+ description 'A server SHOULD support the Task update interaction'
9
+
10
+ id :task_update
11
+ input :update_task_resources,
12
+ type: 'textarea',
13
+ title: 'Update Task Resources',
14
+ description:
15
+ 'Provide a list of Task resources to update. e.g., [json_resource_1, json_resource_2]',
16
+ optional: true
17
+
18
+ def resource_type
19
+ 'Task'
20
+ end
21
+
22
+ run do
23
+ perform_update_test(update_task_resources, resource_type)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,35 @@
1
+ require_relative '../../validation_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class TaskValidationTest < Inferno::Test
5
+ include DaVinciDTRTestKit::ValidationTest
6
+
7
+ title 'Task resources returned during previous tests conform to the PAS Task'
8
+ description %(
9
+ This test verifies resources returned from the read step conform to
10
+ the [PAS Task](http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-task).
11
+ Systems must demonstrate at least one valid example in order to pass this test.
12
+
13
+ It verifies the presence of mandatory elements and that elements with
14
+ required bindings contain appropriate values. CodeableConcept element
15
+ bindings will fail if none of their codings have a code/system belonging
16
+ to the bound ValueSet. Quantity, Coding, and code element bindings will
17
+ fail if their code/system are not found in the valueset.
18
+
19
+ )
20
+
21
+ id :task_validation
22
+ input :task_resources,
23
+ optional: true
24
+
25
+ def resource_type
26
+ 'Task'
27
+ end
28
+
29
+ run do
30
+ skip_if(task_ids.nil?, "No `#{resource_type}` IDs provided, skipping test.")
31
+ perform_profile_validation_test(task_resources, resource_type,
32
+ 'http://hl7.org/fhir/us/davinci-pas/StructureDefinition/profile-task|2.0.1')
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,52 @@
1
+ require_relative 'task/task_read'
2
+ require_relative 'task/task_validation'
3
+ require_relative 'task/task_create'
4
+ require_relative 'task/task_update'
5
+
6
+ module DaVinciDTRTestKit
7
+ class TaskGroup < Inferno::TestGroup
8
+ title 'PAS Task Tests'
9
+ short_description 'Verify support for the server capabilities required by the PAS Task Profile'
10
+ description %(
11
+ # Background
12
+
13
+ The PAS Task sequence verifies that the system under test is
14
+ able to provide correct responses for Task queries. These queries
15
+ must contain resources conforming to the [PAS Task Profile](http://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-task.html).
16
+
17
+ # Testing Methodology
18
+ ## Read
19
+ First, Inferno will attempt to read each Task resource id provided in
20
+ the Task IDs input. The server SHOULD be capable of returning a
21
+ Task resource using the read interaction.
22
+
23
+ ## Profile Validation
24
+ Each resource returned from the read step SHALL conform to
25
+ the [PAS Task Profile](http://hl7.org/fhir/us/davinci-pas/STU2/StructureDefinition-profile-task.html). Each
26
+ element is checked against terminology binding and cardinality requirements.
27
+
28
+ ## Create
29
+ This test sequence will perform create interactions with the provided json
30
+ Task resources. The server SHOULD be capable of creating a Task resource
31
+ using the create interaction.
32
+
33
+ ## Update
34
+ This test sequence will perform update interactions with the provided json
35
+ Task resources. The server SHOULD be capable of creating a Task resource
36
+ using the update interaction.
37
+ )
38
+ id :task_group
39
+ optional
40
+ run_as_group
41
+
42
+ input :task_ids,
43
+ title: 'Task IDs',
44
+ description: 'Comma separated list of Task IDs',
45
+ optional: true
46
+
47
+ test from: :task_read
48
+ test from: :task_validation
49
+ test from: :task_create
50
+ test from: :task_update
51
+ end
52
+ end
@@ -0,0 +1,29 @@
1
+ require_relative '../../read_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class VisionPrescriptionReadTest < Inferno::Test
5
+ include DaVinciDTRTestKit::ReadTest
6
+
7
+ title 'Server returns correct VisionPrescription resource from VisionPrescription read interaction'
8
+ description 'A server SHOULD support the VisionPrescription read interaction.'
9
+
10
+ id :vision_prescription_read
11
+ output :vision_prescription_resources
12
+
13
+ def resource_type
14
+ 'VisionPrescription'
15
+ end
16
+
17
+ def vision_prescription_id_list
18
+ return [nil] unless respond_to? :vision_prescription_ids
19
+
20
+ vision_prescription_ids&.split(',')&.map(&:strip)
21
+ end
22
+
23
+ run do
24
+ resources = perform_read_test(vision_prescription_id_list, resource_type)
25
+
26
+ output vision_prescription_resources: resources.to_json
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+ require_relative '../../validation_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class VisionPrescriptionValidationTest < Inferno::Test
5
+ include DaVinciDTRTestKit::ValidationTest
6
+
7
+ title 'VisionPrescription resources returned during previous tests conform to the CRD VisionPrescription'
8
+ description %(
9
+ This test verifies resources returned from the read step conform to
10
+ the [CRD VisionPrescription](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-visionprescription).
11
+ Systems must demonstrate at least one valid example in order to pass this test.
12
+
13
+ It verifies the presence of mandatory elements and that elements with
14
+ required bindings contain appropriate values. CodeableConcept element
15
+ bindings will fail if none of their codings have a code/system belonging
16
+ to the bound ValueSet. Quantity, Coding, and code element bindings will
17
+ fail if their code/system are not found in the valueset.
18
+
19
+ )
20
+
21
+ id :vision_prescription_validation
22
+ input :vision_prescription_resources,
23
+ optional: true
24
+
25
+ def resource_type
26
+ 'VisionPrescription'
27
+ end
28
+
29
+ run do
30
+ skip_if(vision_prescription_ids.nil?, "No `#{resource_type}` IDs provided, skipping test.")
31
+ perform_profile_validation_test(vision_prescription_resources, resource_type,
32
+ 'http://hl7.org/fhir/us/davinci-crd/StructureDefinition/profile-visionprescription|2.0.1')
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,39 @@
1
+ require_relative 'vision_prescription/vision_prescription_read'
2
+ require_relative 'vision_prescription/vision_prescription_validation'
3
+
4
+ module DaVinciDTRTestKit
5
+ class VisionPrescriptionGroup < Inferno::TestGroup
6
+ title 'CRD VisionPrescription Tests'
7
+ short_description 'Verify support for the server capabilities required by the CRD VisionPrescription Profile'
8
+ description %(
9
+ # Background
10
+
11
+ The CRD VisionPrescription sequence verifies that the system under test is
12
+ able to provide correct responses for VisionPrescription queries. These queries
13
+ must return resources conforming to the [CRD VisionPrescription Profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-visionprescription.html).
14
+
15
+ # Testing Methodology
16
+ ## Read
17
+ First, Inferno will attempt to read each VisionPrescription resource id provided in
18
+ the VisionPrescription IDs input. The server SHOULD be capable of returning a
19
+ VisionPrescription resource using the read interaction.
20
+
21
+ ## Profile Validation
22
+ Each resource returned from the read step SHALL conform to
23
+ the [CRD VisionPrescription Profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-visionprescription.html).
24
+ Each element is checked against terminology binding and cardinality requirements.
25
+
26
+ )
27
+ id :vision_prescription_group
28
+ optional
29
+ run_as_group
30
+
31
+ input :vision_prescription_ids,
32
+ title: 'Vision Prescription IDs',
33
+ description: 'Comma separated list of VisionPrescription IDs',
34
+ optional: true
35
+
36
+ test from: :vision_prescription_read
37
+ test from: :vision_prescription_validation
38
+ end
39
+ end
@@ -0,0 +1,22 @@
1
+ module DaVinciDTRTestKit
2
+ module ReadTest
3
+ def perform_read_test(resource_ids, resource_type)
4
+ skip_if(resource_ids.nil?, "No `#{resource_type}` IDs provided, skipping test.")
5
+ resources = []
6
+ resource_ids.each do |id|
7
+ fhir_read resource_type, id
8
+
9
+ assert_response_status(200)
10
+ assert_resource_type(resource_type)
11
+ assert resource.id.present? && resource.id == id, bad_resource_id_message(id)
12
+
13
+ resources.push(resource)
14
+ end
15
+ resources
16
+ end
17
+
18
+ def bad_resource_id_message(expected_id)
19
+ "Expected resource to have id: `#{expected_id.inspect}`, but found `#{resource.id.inspect}`"
20
+ end
21
+ end
22
+ end
@@ -1,9 +1,7 @@
1
- # frozen_string_literal: true
2
-
3
1
  module DaVinciDTRTestKit
4
- QUESTIONNAIRE_TAG = 'payer_server_questionnaire_package'
5
- NEXT_TAG = 'payer_server_adaptive_questionnaire_package'
6
- QUESTIONNAIRE_PACKAGE_TAG = 'dtr_questionnaire_package'
7
- SMART_APP_EHR_REQUEST_TAG = 'dtr_smart_app_ehr_request'
8
- EHR_AUTHORIZE_TAG = 'dtr_smart_app_ehr_authorize'
2
+ QUESTIONNAIRE_TAG = 'payer_server_questionnaire_package'.freeze
3
+ NEXT_TAG = 'payer_server_adaptive_questionnaire_package'.freeze
4
+ QUESTIONNAIRE_PACKAGE_TAG = 'dtr_questionnaire_package'.freeze
5
+ CLIENT_NEXT_TAG = 'dtr_questionnaire_next_question'.freeze
6
+ EHR_AUTHORIZE_TAG = 'dtr_smart_app_ehr_authorize'.freeze
9
7
  end
@@ -0,0 +1,25 @@
1
+ module DaVinciDTRTestKit
2
+ module UpdateTest
3
+ def perform_update_test(update_resources, resource_type)
4
+ skip_if(update_resources.blank?, "No `#{resource_type}` resources to update provided, skipping test.")
5
+ assert_valid_json(update_resources)
6
+ update_resources_list = JSON.parse(update_resources)
7
+ skip_if(!update_resources_list.is_a?(Array), 'Resources to update not inputted in list format, skipping test.')
8
+
9
+ valid_update_resources =
10
+ update_resources_list
11
+ .compact_blank
12
+ .map { |resource| FHIR.from_contents(resource.to_json) }
13
+ .select { |resource| resource.resourceType == resource_type }
14
+ .select { |resource| resource_is_valid?(resource:) }
15
+
16
+ skip_if(valid_update_resources.blank?,
17
+ %(No valid #{resource_type} resources were provided to send in Update requests, skipping test.))
18
+
19
+ valid_update_resources.each do |update_resource|
20
+ fhir_update(update_resource, update_resource.id)
21
+ assert_response_status([200, 201])
22
+ end
23
+ end
24
+ end
25
+ end
@@ -25,6 +25,24 @@ module DaVinciDTRTestKit
25
25
  true
26
26
  end
27
27
 
28
+ def perform_profile_validation_test(
29
+ resources,
30
+ resource_type,
31
+ profile_url
32
+ )
33
+ skip_if(resources.nil?, "No `#{resource_type}` resources to validate, skipping test.")
34
+ resources = JSON.parse(resources)
35
+ resources = [resources] unless resources.is_a?(Array)
36
+ resources.each do |resource|
37
+ fhir_resource = FHIR.from_contents(resource.to_json)
38
+
39
+ assert fhir_resource.present?, 'Resource does not contain a recognized FHIR object'
40
+ assert_resource_type(resource_type, resource: fhir_resource)
41
+ assert_valid_resource(resource: fhir_resource,
42
+ profile_url:)
43
+ end
44
+ end
45
+
28
46
  def perform_request_validation_test(
29
47
  resources,
30
48
  resource_type,
@@ -59,10 +77,7 @@ module DaVinciDTRTestKit
59
77
  omit_if resources.blank?,
60
78
  "No #{resource_type} resources provided so the #{profile_url} profile does not apply"
61
79
  resources.each_with_index do |resource, index|
62
- assert_valid_json(resource.response[:body])
63
- fhir_resource = FHIR.from_contents(resource.response[:body])
64
- assert_response_status([200, 202], request: resource, response: resource.response)
65
- validate_resource(fhir_resource, resource_type, profile_url, index)
80
+ validate_resource(resource, resource_type, profile_url, index)
66
81
  end
67
82
  return if tests_failed[profile_url].blank?
68
83
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DaVinciDTRTestKit
4
- VERSION = '0.13.0'
4
+ VERSION = '0.14.0'
5
5
  end