davinci_crd_test_kit 0.14.0 → 0.14.1

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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/inferno_crd_client_suite_v221.json.erb +64 -0
  3. data/config/presets/inferno_crd_server_suite_v221.json.erb +2 -2
  4. data/lib/davinci_crd_test_kit/client/endpoints/hook_request_endpoint.rb +12 -6
  5. data/lib/davinci_crd_test_kit/client/endpoints/mocked_card_responses/external_reference.json +1 -1
  6. data/lib/davinci_crd_test_kit/client/endpoints/mocked_card_responses/launch_smart_app.json +0 -7
  7. data/lib/davinci_crd_test_kit/client/v2.2.1/client_appointment_book_group.rb +8 -1
  8. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_discharge_group.rb +7 -1
  9. data/lib/davinci_crd_test_kit/client/v2.2.1/client_encounter_start_group.rb +7 -1
  10. data/lib/davinci_crd_test_kit/client/v2.2.1/client_hooks_group.rb +20 -0
  11. data/lib/davinci_crd_test_kit/client/v2.2.1/client_long_running_hook_group.rb +1 -1
  12. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_dispatch_group.rb +7 -1
  13. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_select_group.rb +7 -1
  14. data/lib/davinci_crd_test_kit/client/v2.2.1/client_order_sign_group.rb +7 -1
  15. data/lib/davinci_crd_test_kit/client/v2.2.1/client_registration_group.rb +6 -0
  16. data/lib/davinci_crd_test_kit/client/v2.2.1/crd_client_suite.rb +5 -0
  17. data/lib/davinci_crd_test_kit/client/v2.2.1/long_running/client_skip_long_running_attestation_test.rb +10 -5
  18. data/lib/davinci_crd_test_kit/client/v2.2.1/registration/client_service_registration_attestation_test.rb +2 -1
  19. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_request/hook_request_prefetch_complete_test.rb +6 -0
  20. data/lib/davinci_crd_test_kit/client/v2.2.1/verify_response/client_display_cards_attest.rb +2 -1
  21. data/lib/davinci_crd_test_kit/cross_suite/cards_identification.rb +9 -0
  22. data/lib/davinci_crd_test_kit/cross_suite/prefetch_completeness_checker.rb +25 -11
  23. data/lib/davinci_crd_test_kit/cross_suite/requests_logical_model_validation.rb +2 -1
  24. data/lib/davinci_crd_test_kit/cross_suite/response_logical_model_validation.rb +164 -3
  25. data/lib/davinci_crd_test_kit/cross_suite/tags.rb +4 -0
  26. data/lib/davinci_crd_test_kit/requirements/generated/crd_server_v221_requirements_coverage.csv +38 -38
  27. data/lib/davinci_crd_test_kit/server/jobs/invoke_hook.rb +3 -3
  28. data/lib/davinci_crd_test_kit/server/jobs/invoke_hook_no_special_requests.rb +17 -0
  29. data/lib/davinci_crd_test_kit/server/jobs/invoke_hook_with_bad_auth.rb +14 -0
  30. data/lib/davinci_crd_test_kit/server/server_abstract_invoke_hook_test.rb +24 -6
  31. data/lib/davinci_crd_test_kit/server/server_hook_helper.rb +2 -2
  32. data/lib/davinci_crd_test_kit/server/v2.2.1/crd_server_suite.rb +3 -0
  33. data/lib/davinci_crd_test_kit/server/v2.2.1/discovery/discovery_standard_prefetch_expressions_test.rb +166 -0
  34. data/lib/davinci_crd_test_kit/server/v2.2.1/interaction/server_invoke_hook_single_request_test.rb +22 -0
  35. data/lib/davinci_crd_test_kit/server/v2.2.1/server_appointment_book_group.rb +10 -102
  36. data/lib/davinci_crd_test_kit/server/v2.2.1/server_demonstrate_hook_response_group.rb +1 -0
  37. data/lib/davinci_crd_test_kit/server/v2.2.1/server_discovery_group.rb +2 -0
  38. data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_discharge_group.rb +10 -97
  39. data/lib/davinci_crd_test_kit/server/v2.2.1/server_encounter_start_group.rb +10 -97
  40. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_dispatch_group.rb +10 -103
  41. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_select_group.rb +12 -116
  42. data/lib/davinci_crd_test_kit/server/v2.2.1/server_order_sign_group.rb +12 -121
  43. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_response_group.rb +23 -0
  44. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/coverage_info_reason_test.rb +108 -0
  45. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/coverage_not_found_group.rb +116 -0
  46. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/no_active_coverage_group.rb +115 -0
  47. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/no_member_found_group.rb +117 -0
  48. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/technical_issues_group.rb +121 -0
  49. data/lib/davinci_crd_test_kit/server/v2.2.1/specific_coverage_responses/technical_issues_invoke_test.rb +22 -0
  50. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_context_validation_test.rb +1 -0
  51. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_optional_fields_validation_test.rb +1 -0
  52. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_request/service_request_required_fields_validation_test.rb +1 -0
  53. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/additional_orders_validation_test.rb +78 -35
  54. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/coverage_information_card_absence_test.rb +76 -0
  55. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/coverage_information_system_action_validation_test.rb +70 -124
  56. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/create_or_update_coverage_info_response_validation_test.rb +83 -39
  57. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/external_reference_card_validation_test.rb +59 -17
  58. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/form_completion_response_validation_test.rb +80 -45
  59. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/hook_request_resource_resolution.rb +37 -0
  60. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/instructions_card_received_test.rb +57 -6
  61. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/launch_smart_app_card_validation_test.rb +56 -17
  62. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/propose_alternate_request_card_validation_test.rb +52 -25
  63. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/service_response_validation_test.rb +17 -51
  64. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/unknown_cds_hooks_elements_test.rb +1 -1
  65. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/unknown_configuration_test.rb +1 -1
  66. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/unknown_context_test.rb +1 -1
  67. data/lib/davinci_crd_test_kit/version.rb +2 -2
  68. metadata +18 -8
  69. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/card_optional_fields_validation_test.rb +0 -57
  70. data/lib/davinci_crd_test_kit/server/v2.2.1/verify_response/coverage_information_system_action_received_test.rb +0 -65
@@ -0,0 +1,116 @@
1
+ require_relative '../interaction/server_invoke_hook_single_request_test'
2
+ require_relative 'coverage_info_reason_test'
3
+
4
+ module DaVinciCRDTestKit
5
+ module V221
6
+ class CoverageNotFoundGroup < Inferno::TestGroup
7
+ title 'Coverage Not Found'
8
+ id :crd_v221_server_coverage_not_found_group
9
+ description %(
10
+ This group of tests allows the system to demonstrate its ability to respond to a CRD Hook invocation
11
+ with a `not-covered` coverage determination when the patient can be resolved but coverage cannot be found
12
+ or cannot be resolved to a single coverage.
13
+
14
+ For these tests, provide a hook request body that represents a resolvable patient for whom the CRD Server
15
+ cannot find coverage or cannot resolve to a single coverage. The tests then verify that a Coverage
16
+ Information systemAction is received with `not-covered` coverage for `coverage-not-found` reason.
17
+ )
18
+
19
+ config options: { hook_name: COVERAGE_NOT_FOUND_TAG }
20
+ run_as_group
21
+
22
+ group do
23
+ title 'Interaction'
24
+
25
+ test from: :crd_v221_server_invoke_hook_single_request_test,
26
+ title: 'Inferno invokes the selected hook to elicit coverage not found response',
27
+ description: <<~DESCRIPTION,
28
+ This test initiates a POST request to a specified CDS Service using the JSON body provided
29
+ by the user. The request body should represent a resolvable patient for whom coverage cannot be
30
+ found or cannot be resolved to a single coverage.
31
+ DESCRIPTION
32
+ config: {
33
+ inputs: {
34
+ service_ids: {
35
+ name: :coverage_not_found_service_ids,
36
+ title: 'Service id to use for the "Coverage Not Found" test',
37
+ description: %(
38
+ If blank, Inferno will attempt to infer the service id to use by finding a service entry
39
+ in the Discovery response for the hook indicated in the provided request body. If it
40
+ cannot be inferred, the tests will be skipped.
41
+ )
42
+ },
43
+ service_request_bodies: {
44
+ name: :coverage_not_found_request_body,
45
+ title: 'Request body to use for the "Coverage Not Found" test',
46
+ description: %(
47
+ Provide a single JSON request body to submit for the hook invocation. The type of hook
48
+ invoked will be inferred based on the `hook` element in the request. The body should be
49
+ constructed so that it represents a resolvable patient for whom coverage cannot be found.
50
+ )
51
+ }
52
+ }
53
+ }
54
+ end
55
+
56
+ group do
57
+ title 'Requests'
58
+ simulation_verification
59
+
60
+ test from: :crd_v221_service_request_required_fields_validation,
61
+ config: {
62
+ outputs: {
63
+ contexts: {
64
+ name: :coverage_not_found_contexts
65
+ }
66
+ }
67
+ }
68
+ test from: :crd_v221_service_request_context_validation,
69
+ config: {
70
+ inputs: {
71
+ contexts: {
72
+ name: :coverage_not_found_contexts
73
+ },
74
+ request_body: {
75
+ name: :coverage_not_found_request_body
76
+ }
77
+ }
78
+ }
79
+ end
80
+
81
+ group do
82
+ title 'Responses'
83
+
84
+ test from: :crd_v221_service_response_validation
85
+ test from: :crd_v221_coverage_info_system_action_validation,
86
+ config: {
87
+ outputs: {
88
+ coverage_info: {
89
+ name: :coverage_not_found_coverage_info
90
+ }
91
+ }
92
+ }
93
+ test from: :crd_v221_coverage_info_reason,
94
+ title: 'Coverage Information responses have not-covered coverage for coverage-not-found reason',
95
+ description: <<~DESCRIPTION,
96
+ This test verifies that the Coverage Information responses received contain Coverage Information
97
+ extensions with `not-covered` coverage and a `coverage-not-found` reason.
98
+ DESCRIPTION
99
+ config: {
100
+ inputs: {
101
+ coverage_info: {
102
+ name: :coverage_not_found_coverage_info
103
+ }
104
+ },
105
+ options: {
106
+ expected_coverage_code: 'not-covered',
107
+ expected_reason_code: 'coverage-not-found'
108
+ }
109
+ },
110
+ verifies_requirements: [
111
+ 'hl7.fhir.us.davinci-crd_2.2.1@resp-45'
112
+ ]
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,115 @@
1
+ require_relative '../interaction/server_invoke_hook_single_request_test'
2
+ require_relative 'coverage_info_reason_test'
3
+
4
+ module DaVinciCRDTestKit
5
+ module V221
6
+ class NoActiveCoverageGroup < Inferno::TestGroup
7
+ title 'No Active Coverage'
8
+ id :crd_v221_server_no_active_coverage_group
9
+ description %(
10
+ This group of tests allows the system to demonstrate its ability to respond to a CRD Hook invocation
11
+ with a `not-covered` coverage determination when the patient can be resolved but does not have active
12
+ coverage.
13
+
14
+ For these tests, provide a hook request body that represents a resolvable patient without active
15
+ coverage. The tests then verify that a Coverage Information systemAction is received with `not-covered`
16
+ coverage for `no-active-coverage` reason.
17
+ )
18
+
19
+ config options: { hook_name: NO_ACTIVE_COVERAGE_TAG }
20
+ run_as_group
21
+
22
+ group do
23
+ title 'Interaction'
24
+
25
+ test from: :crd_v221_server_invoke_hook_single_request_test,
26
+ title: 'Inferno invokes the selected hook to elicit no active coverage response',
27
+ description: <<~DESCRIPTION,
28
+ This test initiates a POST request to a specified CDS Service using the JSON body provided
29
+ by the user. The request body should represent a resolvable patient without active coverage.
30
+ DESCRIPTION
31
+ config: {
32
+ inputs: {
33
+ service_ids: {
34
+ name: :no_active_coverage_service_ids,
35
+ title: 'Service id to use for the "No Active Coverage" test',
36
+ description: %(
37
+ If blank, Inferno will attempt to infer the service id to use by finding a service entry
38
+ in the Discovery response for the hook indicated in the provided request body. If it
39
+ cannot be inferred, the tests will be skipped.
40
+ )
41
+ },
42
+ service_request_bodies: {
43
+ name: :no_active_coverage_request_body,
44
+ title: 'Request body to use for the "No Active Coverage" test',
45
+ description: %(
46
+ Provide a single JSON request body to submit for the hook invocation. The type of hook
47
+ invoked will be inferred based on the `hook` element in the request. The body should be
48
+ constructed so that it represents a resolvable patient without active coverage.
49
+ )
50
+ }
51
+ }
52
+ }
53
+ end
54
+
55
+ group do
56
+ title 'Requests'
57
+ simulation_verification
58
+
59
+ test from: :crd_v221_service_request_required_fields_validation,
60
+ config: {
61
+ outputs: {
62
+ contexts: {
63
+ name: :no_active_coverage_contexts
64
+ }
65
+ }
66
+ }
67
+ test from: :crd_v221_service_request_context_validation,
68
+ config: {
69
+ inputs: {
70
+ contexts: {
71
+ name: :no_active_coverage_contexts
72
+ },
73
+ request_body: {
74
+ name: :no_active_coverage_request_body
75
+ }
76
+ }
77
+ }
78
+ end
79
+
80
+ group do
81
+ title 'Responses'
82
+
83
+ test from: :crd_v221_service_response_validation
84
+ test from: :crd_v221_coverage_info_system_action_validation,
85
+ config: {
86
+ outputs: {
87
+ coverage_info: {
88
+ name: :no_active_coverage_coverage_info
89
+ }
90
+ }
91
+ }
92
+ test from: :crd_v221_coverage_info_reason,
93
+ title: 'Coverage Information responses have not-covered coverage for no-active-coverage reason',
94
+ description: <<~DESCRIPTION,
95
+ This test verifies that the Coverage Information responses received contain Coverage Information
96
+ extensions with `not-covered` coverage and a `no-active-coverage` reason.
97
+ DESCRIPTION
98
+ config: {
99
+ inputs: {
100
+ coverage_info: {
101
+ name: :no_active_coverage_coverage_info
102
+ }
103
+ },
104
+ options: {
105
+ expected_coverage_code: 'not-covered',
106
+ expected_reason_code: 'no-active-coverage'
107
+ }
108
+ },
109
+ verifies_requirements: [
110
+ 'hl7.fhir.us.davinci-crd_2.2.1@resp-45'
111
+ ]
112
+ end
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,117 @@
1
+ require_relative '../interaction/server_invoke_hook_single_request_test'
2
+ require_relative 'coverage_info_reason_test'
3
+
4
+ module DaVinciCRDTestKit
5
+ module V221
6
+ class NoMemberFoundGroup < Inferno::TestGroup
7
+ title 'No Member Found'
8
+ id :crd_v221_server_no_member_found_group
9
+ description %(
10
+ This group of tests allows the system to demonstrate its ability to respond to a CRD Hook invocation
11
+ with a `not-covered` coverage determination when it is unable to resolve the patient for a
12
+ non-technical reason.
13
+
14
+ For these tests, provide a hook request body that represents a patient/member the CRD Server cannot
15
+ resolve for a non-technical reason.
16
+
17
+ The tests then verify that a Coverage Information systemAction is received with `not-covered` coverage
18
+ for `no-member-found` reasons.
19
+ )
20
+
21
+ config options: { hook_name: NO_MEMBER_FOUND_TAG }
22
+ run_as_group
23
+
24
+ group do
25
+ title 'Interaction'
26
+
27
+ test from: :crd_v221_server_invoke_hook_single_request_test,
28
+ title: 'Inferno invokes the selected hook to elicit unresolved member response',
29
+ description: <<~DESCRIPTION,
30
+ This test initiates a POST request to a specified CDS Service using the JSON body provided
31
+ by the user. The request body should represent an unrecognized member.
32
+ DESCRIPTION
33
+ config: {
34
+ inputs: {
35
+ service_ids: {
36
+ name: :no_member_found_service_ids,
37
+ title: 'Service id to use for the "No Member Found" test',
38
+ description: %(
39
+ If blank, Inferno will attempt to infer the service id to use by finding a service entry
40
+ in the Discovery response for the hook indicated in the provided request body. If it
41
+ cannot be inferred, the tests will be skipped.
42
+ )
43
+ },
44
+ service_request_bodies: {
45
+ name: :no_member_found_request_body,
46
+ title: 'Request body to use for the "No Member Found" test',
47
+ description: %(
48
+ Provide a single JSON request body to submit for the hook invocation. The type of hook
49
+ invoked will be inferred based on the `hook` element in the request. The body should be
50
+ constructed so that the CRD Server is unable to resolve the patient/member.
51
+ )
52
+ }
53
+ }
54
+ }
55
+ end
56
+
57
+ group do
58
+ title 'Requests'
59
+ simulation_verification
60
+
61
+ test from: :crd_v221_service_request_required_fields_validation,
62
+ config: {
63
+ outputs: {
64
+ contexts: {
65
+ name: :no_member_found_contexts
66
+ }
67
+ }
68
+ }
69
+ test from: :crd_v221_service_request_context_validation,
70
+ config: {
71
+ inputs: {
72
+ contexts: {
73
+ name: :no_member_found_contexts
74
+ },
75
+ request_body: {
76
+ name: :no_member_found_request_body
77
+ }
78
+ }
79
+ }
80
+ end
81
+
82
+ group do
83
+ title 'Responses'
84
+
85
+ test from: :crd_v221_service_response_validation
86
+ test from: :crd_v221_coverage_info_system_action_validation,
87
+ config: {
88
+ outputs: {
89
+ coverage_info: {
90
+ name: :no_member_found_coverage_info
91
+ }
92
+ }
93
+ }
94
+ test from: :crd_v221_coverage_info_reason,
95
+ title: 'Coverage Information responses have not-covered coverage for no-member-found reason',
96
+ description: <<~DESCRIPTION,
97
+ This test verifies that the Coverage Information responses received contain Coverage Information
98
+ extensions with `not-covered` coverage and a `no-member-found` reason.
99
+ DESCRIPTION
100
+ config: {
101
+ inputs: {
102
+ coverage_info: {
103
+ name: :no_member_found_coverage_info
104
+ }
105
+ },
106
+ options: {
107
+ expected_coverage_code: 'not-covered',
108
+ expected_reason_code: 'no-member-found'
109
+ }
110
+ },
111
+ verifies_requirements: [
112
+ 'hl7.fhir.us.davinci-crd_2.2.1@resp-44'
113
+ ]
114
+ end
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,121 @@
1
+ require_relative 'technical_issues_invoke_test'
2
+ require_relative 'coverage_info_reason_test'
3
+
4
+ module DaVinciCRDTestKit
5
+ module V221
6
+ class TechnicalIssuesGroup < Inferno::TestGroup
7
+ title 'Technical Issues'
8
+ id :crd_v221_server_technical_issues_group
9
+ description %(
10
+ This group of tests allows the system to demonstrate its ability to
11
+ respond to a CRD Hook invocation with an `indeterminate` coverage
12
+ determination due to technical issues.
13
+
14
+ For these tests, the hook call will include an invalid access token,
15
+ which due to the nature of Inferno's FHIR server simulation will result
16
+ in 500 response to FHIR requests, simulating a temporary server outage.
17
+ The tests then verify that a Coverage Information systemAction is
18
+ received with `indeterminate` coverage for `technical` reasons.
19
+ )
20
+
21
+ config options: { hook_name: TECHNICAL_ISSUES_TAG }
22
+ run_as_group
23
+
24
+ group do
25
+ title 'Interaction'
26
+
27
+ test from: :crd_v221_server_technical_issues_invoke_hook_test,
28
+ description: <<~DESCRIPTION,
29
+ This test initiates a POST request to a specified CDS Service
30
+ using the JSON body list provided by the user. This request is
31
+ generated so that requests for FHIR resources from the CDS service
32
+ result in 500 errors, simulating a temporary server error.
33
+ DESCRIPTION
34
+ config: {
35
+ inputs: {
36
+ service_ids: {
37
+ name: :technical_issues_service_ids,
38
+ title: 'Service id to use for the "Technical Issues" test',
39
+ description: %(
40
+ If blank, Inferno will attempt to infer the service id to use
41
+ by finding a service entry in the Discovery response for the
42
+ hook indicated in the provided request body. If it cannot be
43
+ inferred, the tests will be skipped.
44
+ )
45
+ },
46
+ service_request_bodies: {
47
+ name: :technical_issues_request_body,
48
+ title: 'Request body to use for the "Technical Issues" test',
49
+ description: %(
50
+ Provide a single JSON request body to submit for the hook
51
+ invocation. The type of hook invoked will be inferred based
52
+ on the `hook` element in the request.
53
+ )
54
+ }
55
+ }
56
+ }
57
+ end
58
+
59
+ group do
60
+ title 'Requests'
61
+ simulation_verification
62
+
63
+ test from: :crd_v221_service_request_required_fields_validation,
64
+ config: {
65
+ outputs: {
66
+ contexts: {
67
+ name: :technical_issues_contexts
68
+ }
69
+ }
70
+ }
71
+ test from: :crd_v221_service_request_context_validation,
72
+ config: {
73
+ inputs: {
74
+ contexts: {
75
+ name: :technical_issues_contexts
76
+ },
77
+ request_body: {
78
+ name: :technical_issues_request_body
79
+ }
80
+ }
81
+ }
82
+ end
83
+
84
+ group do
85
+ title 'Responses'
86
+
87
+ test from: :crd_v221_service_response_validation
88
+ test from: :crd_v221_coverage_info_system_action_validation,
89
+ config: {
90
+ outputs: {
91
+ coverage_info: {
92
+ name: :technical_issues_coverage_info
93
+ }
94
+ }
95
+ }
96
+ test from: :crd_v221_coverage_info_reason,
97
+ title: 'Coverage Information responses have indeterminate coverage for technical reasons',
98
+ description: <<~DESCRIPTION,
99
+ This test verifies that the Coverage Information responses received contain Coverage Information
100
+ extensions with `indeterminate` coverage and a `technical` reason, and additional details about the
101
+ failure are included in the `text` field of the reason extension.
102
+ DESCRIPTION
103
+ config: {
104
+ inputs: {
105
+ coverage_info: {
106
+ name: :technical_issues_coverage_info
107
+ }
108
+ },
109
+ options: {
110
+ expected_coverage_code: 'indeterminate',
111
+ expected_reason_code: 'technical',
112
+ require_reason_text: true
113
+ }
114
+ },
115
+ verifies_requirements: [
116
+ 'hl7.fhir.us.davinci-crd_2.2.1@resp-43'
117
+ ]
118
+ end
119
+ end
120
+ end
121
+ end
@@ -0,0 +1,22 @@
1
+ require_relative '../server_urls'
2
+ require_relative '../../jobs/invoke_hook_with_bad_auth'
3
+ require_relative '../../server_abstract_invoke_hook_test'
4
+
5
+ module DaVinciCRDTestKit
6
+ module V221
7
+ class TechnicalIssuesInvokeHookTest < ServerAbstractInvokeHookTest
8
+ include ServerURLs
9
+
10
+ title 'Inferno invokes the selected hook with invalid authorization'
11
+ id :crd_v221_server_technical_issues_invoke_hook_test
12
+
13
+ def perform_invoke_hook_job(*)
14
+ Inferno::Jobs.perform(DaVinciCRDTestKit::Jobs::InvokeHookWithBadAuth, *)
15
+ end
16
+
17
+ def check_request_length(payloads)
18
+ skip_if payloads.length != 1, 'The *Technical Issues* test supports only one request body.'
19
+ end
20
+ end
21
+ end
22
+ end
@@ -16,6 +16,7 @@ module DaVinciCRDTestKit
16
16
  required fields.
17
17
  )
18
18
  input :contexts, :invoked_hook
19
+ simulation_verification
19
20
 
20
21
  run do
21
22
  parsed_contexts = parse_json(contexts)
@@ -17,6 +17,7 @@ module DaVinciCRDTestKit
17
17
  informational message.
18
18
  )
19
19
  optional
20
+ simulation_verification
20
21
 
21
22
  run do
22
23
  load_tagged_requests(tested_hook_name)
@@ -17,6 +17,7 @@ module DaVinciCRDTestKit
17
17
  )
18
18
  input :invoked_hook
19
19
  output :contexts
20
+ simulation_verification
20
21
 
21
22
  run do
22
23
  load_tagged_requests(tested_hook_name)
@@ -1,65 +1,108 @@
1
1
  require_relative '../../server_test_helper'
2
2
  require_relative '../../server_hook_helper'
3
- require_relative '../../../cross_suite/suggestion_actions_validation'
4
3
  require_relative '../../../cross_suite/cards_identification'
5
- require_relative '../../../cross_suite/cards_validation'
4
+ require_relative '../../../cross_suite/response_logical_model_validation'
6
5
 
7
6
  module DaVinciCRDTestKit
8
7
  module V221
9
8
  class AdditionalOrdersValidationTest < Inferno::Test
10
9
  include DaVinciCRDTestKit::ServerTestHelper
11
- include DaVinciCRDTestKit::SuggestionActionsValidation
12
10
  include DaVinciCRDTestKit::ServerHookHelper
13
11
  include DaVinciCRDTestKit::CardsIdentification
14
- include DaVinciCRDTestKit::CardsValidation
12
+ include DaVinciCRDTestKit::ResponseLogicalModelValidation
15
13
 
16
14
  title 'Additional Orders cards are valid'
17
15
  id :crd_v221_additional_orders_card_validation
18
16
  description %(
19
- This test validates that an [Additional Orders as companions/prerequisites](https://hl7.org/fhir/us/davinci-crd/STU2/cards.html#identify-additional-orders-as-companionsprerequisites-for-current-order)
17
+ This test validates that an [Identify Additional
18
+ Orders](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/cards.html#identify-additional-orders-response-type)
20
19
  card was received. It does so by:
21
20
  - Filtering cards with the following criteria:
22
- - For each suggestion in the card's suggestions array, all actions have a type of 'create'
23
- and the action's resource type is one of the expected types: CommunicationRequest, Device,
24
- DeviceRequest, Medication, MedicationRequest, NutritionOrder, ServiceRequest, or VisionPrescription.
25
- - Then, for each valid Additional Orders card retrieved, verifying that each action within the
26
- card's suggestions complies with their respective profiles as specified in the
27
- [CRD IG section on Additional Orders as companions/prerequisites](https://hl7.org/fhir/us/davinci-crd/STU2/cards.html#identify-additional-orders-as-companionsprerequisites-for-current-order):
28
- - [crd-profile-communicationrequest](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-communicationrequest.html)
29
- - [crd-profile-device](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-device.html)
30
- - [crd-profile-deviceRequest](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-devicerequest.html)
31
- - [us-core-medication](http://hl7.org/fhir/us/core/STU3.1.1/StructureDefinition-us-core-medication.html)
32
- - [crd-profile-medicationRequest](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-medicationrequest.html)
33
- - [crd-profile-nutritionOrder](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-nutritionorder.html)
34
- - [crd-profile-serviceRequest](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-servicerequest.html)
35
- - [crd-profile-visionPrescription](https://hl7.org/fhir/us/davinci-crd/STU2/StructureDefinition-profile-visionprescription.html).
36
-
37
- The test will skip if no Additional Orders cards are found.
21
+ - For each suggestion in the card's suggestions array, all actions
22
+ have a type of 'create' and the action's resource type is one of the
23
+ expected types: CommunicationRequest, Device, DeviceRequest,
24
+ Medication, MedicationRequest, NutritionOrder, ServiceRequest, or
25
+ VisionPrescription.
26
+ - Then, for each valid Additional Orders card retrieved, verifying that
27
+ each action within the card's suggestions complies with their
28
+ respective profiles as specified in the [CRD IG section on Identify
29
+ Additional
30
+ Orders](https://hl7.org/fhir/us/davinci-crd/2.2.1/en/cards.html#identify-additional-orders-response-type):
31
+ -
32
+ [crd-profile-communicationrequest](https://hl7.org/fhir/us/davinci-crd/2.2.1/StructureDefinition-profile-communicationrequest.html)
33
+ -
34
+ [crd-profile-device](https://hl7.org/fhir/us/davinci-crd/2.2.1/StructureDefinition-profile-device.html)
35
+ -
36
+ [crd-profile-deviceRequest](https://hl7.org/fhir/us/davinci-crd/2.2.1/StructureDefinition-profile-devicerequest.html)
37
+ -
38
+ [us-core-medication](http://hl7.org/fhir/us/core/STU3.1.1/StructureDefinition-us-core-medication.html)
39
+ -
40
+ [crd-profile-medicationRequest](https://hl7.org/fhir/us/davinci-crd/2.2.1/StructureDefinition-profile-medicationrequest.html)
41
+ -
42
+ [crd-profile-nutritionOrder](https://hl7.org/fhir/us/davinci-crd/2.2.1/StructureDefinition-profile-nutritionorder.html)
43
+ -
44
+ [crd-profile-serviceRequest](https://hl7.org/fhir/us/davinci-crd/2.2.1/StructureDefinition-profile-servicerequest.html)
45
+ -
46
+ [crd-profile-visionPrescription](https://hl7.org/fhir/us/davinci-crd/2.2.1/StructureDefinition-profile-visionprescription.html).
47
+
48
+ The test will skip if no Identify Additional Orders cards are found.
38
49
  )
39
50
 
40
- verifies_requirements 'hl7.fhir.us.davinci-crd_2.2.1@resp-57',
51
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.2.1@resp-3',
52
+ 'hl7.fhir.us.davinci-crd_2.2.1@resp-57',
41
53
  'hl7.fhir.us.davinci-crd_2.2.1@resp-58'
42
54
 
55
+ input :invoked_hook
56
+
43
57
  optional
44
- input :valid_cards_with_suggestions
58
+
59
+ def body_has_no_cards?(body)
60
+ !body.is_a?(Hash) ||
61
+ body['cards'].blank? ||
62
+ !body['cards'].is_a?(Array) ||
63
+ !body['cards'].all?(Hash)
64
+ end
65
+
66
+ def additional_orders_cards(request)
67
+ return [] if request.status != 200
68
+
69
+ response_body = JSON.parse(request.response_body)
70
+
71
+ return [] if body_has_no_cards?(response_body)
72
+
73
+ response_body['cards'].select { |card| additional_orders_response_type? card }
74
+ rescue JSON::ParserError
75
+ []
76
+ end
45
77
 
46
78
  run do
47
- parsed_cards = parse_json(valid_cards_with_suggestions)
48
- additional_orders_cards = parsed_cards.filter do |card|
49
- additional_orders_response_type?(card)
50
- end
51
- skip_if additional_orders_cards.blank?,
52
- "#{tested_hook_name} hook response does not include Additional Orders as companion/prerequisite cards."
79
+ load_tagged_requests(tested_hook_name)
80
+
81
+ additional_orders_count = 0
82
+
83
+ successful_requests = requests.select { |request| request.status == 200 }
53
84
 
54
- additional_orders_cards.each do |card|
55
- card['suggestions'].each do |suggestion|
56
- actions_check(suggestion['actions'], ig_version: 'v221')
57
- end
85
+ skip_if successful_requests.blank?,
86
+ 'No successful hook responses were received'
58
87
 
59
- additional_orders_check(card)
88
+ requests.each_with_index do |request, index|
89
+ cards = additional_orders_cards(request)
90
+
91
+ additional_orders_count += cards.length
92
+
93
+ perform_response_logical_model_validation(
94
+ cards,
95
+ nil,
96
+ request.request_body,
97
+ index,
98
+ '2.2.1'
99
+ )
60
100
  end
61
101
 
62
- no_error_validation('Some Additional Order cards are not valid. See messages for more information.')
102
+ skip_if additional_orders_count.zero?,
103
+ "#{tested_hook_name} hook responses do not contain any Additional Orders cards."
104
+
105
+ no_error_validation('Not all Additional Orders cards were valid. See messages for more information.')
63
106
  end
64
107
  end
65
108
  end