davinci_dtr_test_kit 0.12.0 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) 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 -28
  15. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/dtr_smart_app_dinner_questionnaire_package_request_test.rb +14 -17
  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/full_ehr/dtr_full_ehr_questionnaire_response_conformance_test.rb +19 -0
  22. data/lib/davinci_dtr_test_kit/client_groups/full_ehr/dtr_full_ehr_questionnaire_response_correctness_test.rb +37 -0
  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 +7 -7
  29. data/lib/davinci_dtr_test_kit/client_groups/shared/dtr_questionnaire_response_pre_population_test.rb +16 -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 +114 -172
  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 +34 -0
  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 +101 -23
  43. data/lib/davinci_dtr_test_kit/dtr_options.rb +7 -0
  44. data/lib/davinci_dtr_test_kit/dtr_payer_server_suite.rb +9 -20
  45. data/lib/davinci_dtr_test_kit/dtr_questionnaire_response_validation.rb +126 -75
  46. data/lib/davinci_dtr_test_kit/dtr_smart_app_suite.rb +32 -56
  47. data/lib/davinci_dtr_test_kit/endpoints/cors.rb +20 -0
  48. data/lib/davinci_dtr_test_kit/endpoints/mock_authorization/authorize_endpoint.rb +32 -0
  49. data/lib/davinci_dtr_test_kit/endpoints/mock_authorization/simple_token_endpoint.rb +19 -0
  50. data/lib/davinci_dtr_test_kit/endpoints/mock_authorization/token_endpoint.rb +116 -0
  51. data/lib/davinci_dtr_test_kit/endpoints/mock_authorization.rb +83 -0
  52. data/lib/davinci_dtr_test_kit/endpoints/mock_ehr/fhir_get_endpoint.rb +95 -0
  53. data/lib/davinci_dtr_test_kit/endpoints/mock_ehr/questionnaire_response_endpoint.rb +22 -0
  54. data/lib/davinci_dtr_test_kit/endpoints/mock_ehr.rb +25 -0
  55. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/full_ehr_next_question_endpoint.rb +11 -0
  56. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/full_ehr_questionnaire_package_endpoint.rb +11 -0
  57. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_endpoint.rb +162 -0
  58. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/next_question_proxy_endpoint.rb +36 -0
  59. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/questionnaire_package_endpoint.rb +62 -0
  60. data/lib/davinci_dtr_test_kit/endpoints/mock_payer/questionnaire_package_proxy_endpoint.rb +38 -0
  61. data/lib/davinci_dtr_test_kit/endpoints/mock_payer.rb +36 -0
  62. data/lib/davinci_dtr_test_kit/fixture_loader.rb +6 -84
  63. data/lib/davinci_dtr_test_kit/fixtures/dinner_adaptive/dinner_order_adaptive_next_question_burrito.json +10 -2
  64. data/lib/davinci_dtr_test_kit/fixtures/dinner_adaptive/dinner_order_adaptive_next_question_hamburger.json +10 -2
  65. data/lib/davinci_dtr_test_kit/fixtures/dinner_adaptive/dinner_order_adaptive_next_question_initial.json +10 -2
  66. data/lib/davinci_dtr_test_kit/fixtures/dinner_adaptive/questionnaire_dinner_order_adaptive.json +4 -3
  67. data/lib/davinci_dtr_test_kit/fixtures.rb +64 -46
  68. data/lib/davinci_dtr_test_kit/payer_server_groups/adaptive_form_libraries_test.rb +2 -2
  69. data/lib/davinci_dtr_test_kit/payer_server_groups/adaptive_form_questionnaire_expressions_test.rb +4 -3
  70. data/lib/davinci_dtr_test_kit/payer_server_groups/adaptive_form_questionnaire_extensions_test.rb +3 -2
  71. data/lib/davinci_dtr_test_kit/payer_server_groups/adaptive_next_questionnaire_expressions_test.rb +8 -8
  72. data/lib/davinci_dtr_test_kit/payer_server_groups/adaptive_next_questionnaire_extensions_test.rb +6 -5
  73. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_adaptive_group.rb +2 -2
  74. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_adaptive_request_validation_test.rb +2 -1
  75. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_adaptive_response_bundles_validation_test.rb +6 -9
  76. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_adaptive_response_search_validation_test.rb +15 -12
  77. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_adaptive_response_validation_test.rb +33 -22
  78. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_next_request_validation_test.rb +1 -1
  79. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_next_response_complete_test.rb +4 -4
  80. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_next_response_validation_test.rb +16 -12
  81. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_libraries_test.rb +2 -2
  82. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_questionnaire_expressions_test.rb +5 -4
  83. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_questionnaire_extensions_test.rb +4 -3
  84. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_request_validation_test.rb +2 -1
  85. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_response_validation_test.rb +32 -23
  86. data/lib/davinci_dtr_test_kit/profiles/communication_request/communication_request_read.rb +29 -0
  87. data/lib/davinci_dtr_test_kit/profiles/communication_request/communication_request_validation.rb +35 -0
  88. data/lib/davinci_dtr_test_kit/profiles/communication_request_group.rb +39 -0
  89. data/lib/davinci_dtr_test_kit/profiles/coverage/coverage_read.rb +29 -0
  90. data/lib/davinci_dtr_test_kit/profiles/coverage/coverage_validation.rb +35 -0
  91. data/lib/davinci_dtr_test_kit/profiles/coverage_group.rb +38 -0
  92. data/lib/davinci_dtr_test_kit/profiles/device_request/device_request_read.rb +29 -0
  93. data/lib/davinci_dtr_test_kit/profiles/device_request/device_request_validation.rb +35 -0
  94. data/lib/davinci_dtr_test_kit/profiles/device_request_group.rb +39 -0
  95. data/lib/davinci_dtr_test_kit/profiles/encounter/encounter_read.rb +29 -0
  96. data/lib/davinci_dtr_test_kit/profiles/encounter/encounter_validation.rb +35 -0
  97. data/lib/davinci_dtr_test_kit/profiles/encounter_group.rb +39 -0
  98. data/lib/davinci_dtr_test_kit/profiles/medication_request/medication_request_read.rb +29 -0
  99. data/lib/davinci_dtr_test_kit/profiles/medication_request/medication_request_validation.rb +35 -0
  100. data/lib/davinci_dtr_test_kit/profiles/medication_request_group.rb +39 -0
  101. data/lib/davinci_dtr_test_kit/profiles/nutrition_order/nutrition_order_read.rb +29 -0
  102. data/lib/davinci_dtr_test_kit/profiles/nutrition_order/nutrition_order_validation.rb +35 -0
  103. data/lib/davinci_dtr_test_kit/profiles/nutrition_order_group.rb +39 -0
  104. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_context_search.rb +35 -0
  105. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_create.rb +26 -0
  106. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_patient_search.rb +55 -0
  107. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_read.rb +22 -0
  108. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_update.rb +26 -0
  109. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response/questionnaire_response_validation.rb +37 -0
  110. data/lib/davinci_dtr_test_kit/profiles/questionnaire_response_group.rb +66 -0
  111. data/lib/davinci_dtr_test_kit/profiles/service_request/service_request_read.rb +29 -0
  112. data/lib/davinci_dtr_test_kit/profiles/service_request/service_request_validation.rb +35 -0
  113. data/lib/davinci_dtr_test_kit/profiles/service_request_group.rb +39 -0
  114. data/lib/davinci_dtr_test_kit/profiles/task/task_create.rb +26 -0
  115. data/lib/davinci_dtr_test_kit/profiles/task/task_read.rb +29 -0
  116. data/lib/davinci_dtr_test_kit/profiles/task/task_update.rb +26 -0
  117. data/lib/davinci_dtr_test_kit/profiles/task/task_validation.rb +35 -0
  118. data/lib/davinci_dtr_test_kit/profiles/task_group.rb +52 -0
  119. data/lib/davinci_dtr_test_kit/profiles/vision_prescription/vision_prescription_read.rb +29 -0
  120. data/lib/davinci_dtr_test_kit/profiles/vision_prescription/vision_prescription_validation.rb +35 -0
  121. data/lib/davinci_dtr_test_kit/profiles/vision_prescription_group.rb +39 -0
  122. data/lib/davinci_dtr_test_kit/read_test.rb +22 -0
  123. data/lib/davinci_dtr_test_kit/tags.rb +5 -6
  124. data/lib/davinci_dtr_test_kit/update_test.rb +25 -0
  125. data/lib/davinci_dtr_test_kit/urls.rb +13 -10
  126. data/lib/davinci_dtr_test_kit/validation_test.rb +21 -5
  127. data/lib/davinci_dtr_test_kit/version.rb +1 -1
  128. data/lib/davinci_dtr_test_kit.rb +1 -1
  129. metadata +129 -24
  130. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/dtr_full_ehr_prepopulation_representation_attestation_test.rb +0 -33
  131. data/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_full_ehr_questionnaire_workflow_group.rb +0 -19
  132. data/lib/davinci_dtr_test_kit/ext/inferno_core/record_response_route.rb +0 -98
  133. data/lib/davinci_dtr_test_kit/ext/inferno_core/request.rb +0 -19
  134. data/lib/davinci_dtr_test_kit/ext/inferno_core/runnable.rb +0 -35
  135. data/lib/davinci_dtr_test_kit/mock_auth_server.rb +0 -145
  136. data/lib/davinci_dtr_test_kit/mock_ehr.rb +0 -97
  137. data/lib/davinci_dtr_test_kit/mock_payer.rb +0 -123
  138. /data/lib/davinci_dtr_test_kit/fixtures/{pre_populated_questionnaire_response.json → respiratory_assist_device/pre_populated_questionnaire_response.json} +0 -0
  139. /data/lib/davinci_dtr_test_kit/fixtures/{questionnaire_package.json → respiratory_assist_device/questionnaire_package.json} +0 -0
@@ -0,0 +1,35 @@
1
+ require_relative '../../validation_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class MedicationRequestValidationTest < Inferno::Test
5
+ include DaVinciDTRTestKit::ValidationTest
6
+
7
+ title 'MedicationRequest resources returned during previous tests conform to the CRD MedicationRequest'
8
+ description %(
9
+ This test verifies resources returned from the read step conform to
10
+ the [CRD MedicationRequest](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-medicationrequest).
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 :medication_request_validation
22
+ input :medication_request_resources,
23
+ optional: true
24
+
25
+ def resource_type
26
+ 'MedicationRequest'
27
+ end
28
+
29
+ run do
30
+ skip_if(medication_request_ids.nil?, "No `#{resource_type}` IDs provided, skipping test.")
31
+ perform_profile_validation_test(medication_request_resources, resource_type,
32
+ 'http://hl7.org/fhir/us/davinci-crd/StructureDefinition/profile-medicationrequest|2.0.1')
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,39 @@
1
+ require_relative 'medication_request/medication_request_read'
2
+ require_relative 'medication_request/medication_request_validation'
3
+
4
+ module DaVinciDTRTestKit
5
+ class MedicationRequestGroup < Inferno::TestGroup
6
+ title 'CRD MedicationRequest Tests'
7
+ short_description 'Verify support for the server capabilities required by the CRD MedicationRequest Profile'
8
+ description %(
9
+ # Background
10
+
11
+ The CRD MedicationRequest sequence verifies that the system under test is
12
+ able to provide correct responses for MedicationRequest queries. These queries
13
+ must return resources conforming to the [CRD MedicationRequest Profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-medicationrequest.html).
14
+
15
+ # Testing Methodology
16
+ ## Read
17
+ First, Inferno will attempt to read each MedicationRequest resource id provided in
18
+ the MedicationRequest IDs input. The server SHOULD be capable of returning a
19
+ MedicationRequest resource using the read interaction.
20
+
21
+ ## Profile Validation
22
+ Each resource returned from the read step SHALL conform to
23
+ the [CRD MedicationRequest Profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-medicationrequest.html).
24
+ Each element is checked against terminology binding and cardinality requirements.
25
+
26
+ )
27
+ id :medication_request_group
28
+ optional
29
+ run_as_group
30
+
31
+ input :medication_request_ids,
32
+ title: 'Medication Request IDs',
33
+ description: 'Comma separated list of MedicationRequest IDs',
34
+ optional: true
35
+
36
+ test from: :medication_request_read
37
+ test from: :medication_request_validation
38
+ end
39
+ end
@@ -0,0 +1,29 @@
1
+ require_relative '../../read_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class NutritionOrderReadTest < Inferno::Test
5
+ include DaVinciDTRTestKit::ReadTest
6
+
7
+ title 'Server returns correct NutritionOrder resource from NutritionOrder read interaction'
8
+ description 'A server SHOULD support the NutritionOrder read interaction.'
9
+
10
+ id :nutrition_order_read
11
+ output :nutrition_order_resources
12
+
13
+ def resource_type
14
+ 'NutritionOrder'
15
+ end
16
+
17
+ def nutrition_order_id_list
18
+ return [nil] unless respond_to? :nutrition_order_ids
19
+
20
+ nutrition_order_ids&.split(',')&.map(&:strip)
21
+ end
22
+
23
+ run do
24
+ resources = perform_read_test(nutrition_order_id_list, resource_type)
25
+
26
+ output nutrition_order_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 NutritionOrderValidationTest < Inferno::Test
5
+ include DaVinciDTRTestKit::ValidationTest
6
+
7
+ title 'NutritionOrder resources returned during previous tests conform to the CRD NutritionOrder'
8
+ description %(
9
+ This test verifies resources returned from the read step conform to
10
+ the [CRD NutritionOrder](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-nutritionorder).
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 :nutrition_order_validation
22
+ input :nutrition_order_resources,
23
+ optional: true
24
+
25
+ def resource_type
26
+ 'NutritionOrder'
27
+ end
28
+
29
+ run do
30
+ skip_if(nutrition_order_ids.nil?, "No `#{resource_type}` IDs provided, skipping test.")
31
+ perform_profile_validation_test(nutrition_order_resources, resource_type,
32
+ 'http://hl7.org/fhir/us/davinci-crd/StructureDefinition/profile-nutritionorder|2.0.1')
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,39 @@
1
+ require_relative 'nutrition_order/nutrition_order_read'
2
+ require_relative 'nutrition_order/nutrition_order_validation'
3
+
4
+ module DaVinciDTRTestKit
5
+ class NutritionOrderGroup < Inferno::TestGroup
6
+ title 'CRD NutritionOrder Tests'
7
+ short_description 'Verify support for the server capabilities required by the CRD NutritionOrder Profile'
8
+ description %(
9
+ # Background
10
+
11
+ The CRD NutritionOrder sequence verifies that the system under test is
12
+ able to provide correct responses for NutritionOrder queries. These queries
13
+ must return resources conforming to the [CRD NutritionOrder Profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-nutritionorder.html).
14
+
15
+ # Testing Methodology
16
+ ## Read
17
+ First, Inferno will attempt to read each NutritionOrder resource id provided in
18
+ the NutritionOrder IDs input. The server SHOULD be capable of returning a
19
+ NutritionOrder resource using the read interaction.
20
+
21
+ ## Profile Validation
22
+ Each resource returned from the read step SHALL conform to
23
+ the [CRD NutritionOrder Profile](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-communicationrequest.html).
24
+ Each element is checked against terminology binding and cardinality requirements.
25
+
26
+ )
27
+ id :nutrition_order_group
28
+ optional
29
+ run_as_group
30
+
31
+ input :nutrition_order_ids,
32
+ title: 'Nutrition Order IDs',
33
+ description: 'Comma separated list of NutritionOrder IDs',
34
+ optional: true
35
+
36
+ test from: :nutrition_order_read
37
+ test from: :nutrition_order_validation
38
+ end
39
+ end
@@ -0,0 +1,35 @@
1
+ module DaVinciDTRTestKit
2
+ class QuestionnaireResponseContextSearchTest < Inferno::Test
3
+ include USCoreTestKit::SearchTest
4
+
5
+ title 'Server returns valid results for QuestionnaireResponse search by context'
6
+ description %(
7
+ A server SHALL support searching by
8
+ context on the QuestionnaireResponse resource. This test
9
+ will pass if resources are returned and match the search criteria. If
10
+ none are returned, the test is skipped.
11
+ )
12
+
13
+ id :questionnaire_response_context_search
14
+
15
+ def self.properties
16
+ @properties ||= USCoreTestKit::SearchTestProperties.new(
17
+ resource_type: 'QuestionnaireResponse',
18
+ search_param_names: ['context']
19
+ )
20
+ end
21
+
22
+ def self.metadata
23
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'),
24
+ aliases: true))
25
+ end
26
+
27
+ def scratch_resources
28
+ scratch[:questionnaire_response_resources] ||= {}
29
+ end
30
+
31
+ run do
32
+ run_search_test
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,26 @@
1
+ require_relative '../../create_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class QuestionnaireResponseCreateTest < Inferno::Test
5
+ include DaVinciDTRTestKit::CreateTest
6
+
7
+ title 'Server is capable of creating a QuestionnaireResponse resource from QuestionnaireResponse create interaction'
8
+ description 'A sever SHALL support the QuestionnaireResponse create interaction'
9
+
10
+ id :questionnaire_response_create
11
+ input :create_questionnaire_resources,
12
+ type: 'textarea',
13
+ title: 'Create QuestionnaireResponse Resources',
14
+ description:
15
+ 'Provide a list of QuestionnaireResponse resources to create. e.g., [json_resource_1, json_resource_2]',
16
+ optional: true
17
+
18
+ def resource_type
19
+ 'QuestionnaireResponse'
20
+ end
21
+
22
+ run do
23
+ perform_create_test(create_questionnaire_resources, resource_type)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,55 @@
1
+ module DaVinciDTRTestKit
2
+ class QuestionnaireResponsePatientSearchTest < Inferno::Test
3
+ include USCoreTestKit::SearchTest
4
+
5
+ title 'Server returns valid results for QuestionnaireResponse search by patient'
6
+ description %(
7
+ A server SHALL support searching by
8
+ patient on the QuestionnaireResponse resource. This test
9
+ will pass if resources are returned and match the search criteria. If
10
+ none are returned, the test is skipped.
11
+
12
+ This test verifies that the server supports searching by reference using
13
+ the form `patient=[id]` as well as `patient=Patient/[id]`. The two
14
+ different forms are expected to return the same number of results. US
15
+ Core requires that both forms are supported by US Core responders.
16
+
17
+ Because this is the first search of the sequence, resources in the
18
+ response will be used for subsequent tests.
19
+
20
+ Additionally, this test will check that GET and POST search methods
21
+ return the same number of results. Search by POST is required by the
22
+ FHIR R4 specification, and these tests interpret search by GET as a
23
+ requirement of US Core v3.1.1.
24
+ )
25
+
26
+ id :questionnaire_response_patient_search
27
+ input :patient_ids,
28
+ title: 'Patient IDs',
29
+ description: 'Comma separated list of Patient IDs used to search for QuestionnaireResponses'
30
+
31
+ def self.properties
32
+ @properties ||= USCoreTestKit::SearchTestProperties.new(
33
+ first_search: true,
34
+ resource_type: 'QuestionnaireResponse',
35
+ search_param_names: ['patient'],
36
+ saves_delayed_references: true,
37
+ test_reference_variants: true,
38
+ test_post_search: true
39
+ )
40
+ end
41
+
42
+ def self.metadata
43
+ @metadata ||= USCoreTestKit::Generator::GroupMetadata.new(YAML.load_file(File.join(__dir__, 'metadata.yml'),
44
+ aliases: true))
45
+ end
46
+
47
+ def scratch_resources
48
+ scratch[:questionnaire_response_resources] ||= {}
49
+ end
50
+
51
+ run do
52
+ run_search_test
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,22 @@
1
+ module DaVinciDTRTestKit
2
+ class QuestionnaireResponseReadTest < Inferno::Test
3
+ include USCoreTestKit::ReadTest
4
+
5
+ title 'Server returns correct QuestionnaireResponse resource from QuestionnaireResponse read interaction'
6
+ description 'A server SHALL support the QuestionnaireResponse read interaction'
7
+
8
+ id :questionnaire_response_read
9
+
10
+ def resource_type
11
+ 'QuestionnaireResponse'
12
+ end
13
+
14
+ def scratch_resources
15
+ scratch[:questionnaire_response_resources] ||= {}
16
+ end
17
+
18
+ run do
19
+ perform_read_test(all_scratch_resources)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,26 @@
1
+ require_relative '../../update_test'
2
+
3
+ module DaVinciDTRTestKit
4
+ class QuestionnaireResponseUpdateTest < Inferno::Test
5
+ include DaVinciDTRTestKit::UpdateTest
6
+
7
+ title 'Server is capable of updating a QuestionnaireResponse resource from QuestionnaireResponse update interaction'
8
+ description 'A server SHALL support the QuestionnaireResponse update interaction'
9
+
10
+ id :questionnaire_response_update
11
+ input :update_questionnaire_resources,
12
+ type: 'textarea',
13
+ title: 'Update QuestionnaireResponse Resources',
14
+ description:
15
+ 'Provide a list of QuestionnaireResponse resources to update. e.g., [json_resource_1, json_resource_2]',
16
+ optional: true
17
+
18
+ def resource_type
19
+ 'QuestionnaireResponse'
20
+ end
21
+
22
+ run do
23
+ perform_update_test(update_questionnaire_resources, resource_type)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,37 @@
1
+ module DaVinciDTRTestKit
2
+ class QuestionnaireResponseValidationTest < Inferno::Test
3
+ include USCoreTestKit::ValidationTest
4
+
5
+ id :questionnaire_response_validation
6
+ title 'QuestionnaireResponse resources returned during previous tests conform to the DTR Questionnaire Response'
7
+ description %(
8
+ This test verifies resources returned from the first search conform to
9
+ the [DTR Questionnaire Response](https://hl7.org/fhir/us/davinci-dtr/STU2/StructureDefinition-dtr-questionnaireresponse).
10
+ Systems must demonstrate at least one valid example in order to pass this test.
11
+
12
+ It verifies the presence of mandatory elements and that elements with
13
+ required bindings contain appropriate values. CodeableConcept element
14
+ bindings will fail if none of their codings have a code/system belonging
15
+ to the bound ValueSet. Quantity, Coding, and code element bindings will
16
+ fail if their code/system are not found in the valueset.
17
+
18
+ )
19
+
20
+ output :dar_code_found, :dar_extension_found
21
+
22
+ def resource_type
23
+ 'QuestionnaireResponse'
24
+ end
25
+
26
+ def scratch_resources
27
+ scratch[:questionnaire_response_resources] ||= {}
28
+ end
29
+
30
+ run do
31
+ perform_validation_test(scratch_resources[:all] || [],
32
+ 'http://hl7.org/fhir/us/davinci-dtr/StructureDefinition/dtr-questionnaireresponse',
33
+ '2.0.1',
34
+ skip_if_empty: true)
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,66 @@
1
+ require_relative 'questionnaire_response/questionnaire_response_patient_search'
2
+ require_relative 'questionnaire_response/questionnaire_response_context_search'
3
+ require_relative 'questionnaire_response/questionnaire_response_read'
4
+ require_relative 'questionnaire_response/questionnaire_response_validation'
5
+ require_relative 'questionnaire_response/questionnaire_response_create'
6
+ require_relative 'questionnaire_response/questionnaire_response_update'
7
+
8
+ module DaVinciDTRTestKit
9
+ class QuestionnaireResponseGroup < Inferno::TestGroup
10
+ title 'DTR QuestionnaireResponse Tests'
11
+ short_description 'Verify support for the server capabilities required by the DTR QuestionnaireResponse Profile'
12
+ description %(
13
+ # Background
14
+
15
+ The DTR QuestionnaireResponse sequences verifies that the system under test is able to create and update
16
+ QuestionnaireResponse instances and provide correct responses for QuestionnaireResponse queries. These queries must
17
+ return resources conforming to the [DTR QuestionnaireResponse Profile](http://hl7.org/fhir/us/davinci-dtr/STU2/StructureDefinition-dtr-questionnaireresponse.html).
18
+
19
+ # Testing Methodology
20
+ ## Searching
21
+ This test sequence will first perform each required search associated with this resource. This sequence will perform
22
+ searches with the following parameters:
23
+
24
+ * `patient`
25
+ * `context`
26
+
27
+ ### Search Parameters
28
+ The first search uses the patient(s) from the *Patient IDs* input. Subsequent searches will look for its parameter
29
+ values from the results of the first search. For example, the `context` search in this sequence is performed by
30
+ looking for an existing `context` extension from any of the resources returned in the `patient` search. If a value
31
+ cannot be found this way, the search is skipped.
32
+
33
+ ### Search Validation
34
+ Inferno will retrieve up to the first 20 bundle pages of the reply for QuestionnaireResponse resources and save them
35
+ for subsequent tests. Each of these resources is then checked to see if it matches the searched parameters in
36
+ accordance with [FHIR search guidelines](https://www.hl7.org/fhir/search.html). The test will fail, for example, if
37
+ a search for `context=Coverage/cov015` returns a QuestionnaireResponse without a link to Coverage `cov015` in the
38
+ `context` extension.
39
+
40
+ ## Read
41
+ The ids of each resource returned from the searches are then used to verify that the system under test is able to
42
+ return the correct QuestionnaireResponse resource using the read interaction.
43
+
44
+ ## Profile Validation
45
+ Each resource returned from the search step SHALL conform to the [DTR QuestionnaireResponse Profile](http://hl7.org/fhir/us/davinci-dtr/STU2/StructureDefinition-dtr-questionnaireresponse.html).
46
+ Each element is checked against terminology binding and cardinality requirements.
47
+
48
+ ## Create
49
+ This test sequence will perform create interactions with the provided json QuestionnaireResponse resources. The
50
+ server SHALL be capable of creating a QuestionnaireResponse resource using the create interaction.
51
+
52
+ ## Update
53
+ This test sequence will perform update interactions with the provided json QuestionnaireResponse resources. The
54
+ server SHALL be capable of creating a QuestionnaireResponse resource using the update interaction.
55
+ )
56
+ id :questionnaire_response_group
57
+ run_as_group
58
+
59
+ test from: :questionnaire_response_patient_search
60
+ test from: :questionnaire_response_context_search
61
+ test from: :questionnaire_response_read
62
+ test from: :questionnaire_response_validation
63
+ test from: :questionnaire_response_create
64
+ test from: :questionnaire_response_update
65
+ end
66
+ end
@@ -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