davinci_crd_test_kit 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/config/presets/inferno_crd_client_suite.json.erb +7 -7
  3. data/config/presets/inferno_crd_server_suite.json.erb +1 -1
  4. data/config/presets/ri_crd_server.json.erb +13 -13
  5. data/lib/davinci_crd_test_kit/client_hooks_group.rb +22 -23
  6. data/lib/davinci_crd_test_kit/client_tests/appointment_book_receive_request_test.rb +1 -1
  7. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_create_test.rb +3 -2
  8. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_read_test.rb +2 -1
  9. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_update_test.rb +3 -2
  10. data/lib/davinci_crd_test_kit/client_tests/client_fhir_api_validation_test.rb +3 -2
  11. data/lib/davinci_crd_test_kit/client_tests/order_dispatch_receive_request_test.rb +1 -1
  12. data/lib/davinci_crd_test_kit/client_tests/submitted_response_validation.rb +4 -0
  13. data/lib/davinci_crd_test_kit/crd_client_suite.rb +18 -2
  14. data/lib/davinci_crd_test_kit/crd_server_suite.rb +8 -0
  15. data/lib/davinci_crd_test_kit/requirements/cds-hooks_2.0_requirements.xlsx +0 -0
  16. data/lib/davinci_crd_test_kit/requirements/{davinci-crd-test-kit_requirements.csv → davinci_crd_test_kit_requirements.csv} +589 -312
  17. data/lib/davinci_crd_test_kit/requirements/generated/crd_client_requirements_coverage.csv +208 -0
  18. data/lib/davinci_crd_test_kit/requirements/generated/crd_server_requirements_coverage.csv +174 -0
  19. data/lib/davinci_crd_test_kit/requirements/hl7.fhir.us.davinci-crd_2.0.1_requirements.xlsx +0 -0
  20. data/lib/davinci_crd_test_kit/version.rb +2 -2
  21. data/lib/davinci_crd_test_kit.rb +0 -1
  22. metadata +20 -18
  23. data/lib/davinci_crd_test_kit/requirements/davinci-crd-test-kit_out_of_scope_requirements.csv +0 -1
  24. data/lib/davinci_crd_test_kit/requirements/generated/davinci-crd-test-kit_requirements_coverage.csv +0 -366
  25. data/lib/inferno_requirements_tools/ext/inferno_core/runnable.rb +0 -22
  26. data/lib/inferno_requirements_tools/tasks/requirements_coverage.rb +0 -284
  27. data/lib/requirements_config.yaml +0 -18
@@ -13,32 +13,31 @@ module DaVinciCRDTestKit
13
13
  title 'Hooks'
14
14
  description <<~DESCRIPTION
15
15
  This Group contains tests which verify that valid hook requests can be made for each of the following
16
- [six hooks contained in the
17
- implementation guide](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html):
18
- * [appointment-book](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#appointment-book)
19
- * [encounter-start](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-start)
20
- * [encounter-discharge](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-discharge)
21
- * [order-select](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-select)
22
- * [order-dispatch](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-dispatch)
23
- * [order-sign](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-sign)
16
+ [six hooks contained in the implementation guide](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html):
17
+ * [appointment-book](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#appointment-book)
18
+ * [encounter-start](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-start)
19
+ * [encounter-discharge](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#encounter-discharge)
20
+ * [order-select](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-select)
21
+ * [order-dispatch](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-dispatch)
22
+ * [order-sign](https://hl7.org/fhir/us/davinci-crd/STU2/hooks.html#order-sign)
24
23
 
25
- Each hook group contains a test which waits for incoming hook requests from the CRD client, and tests which
26
- verify the incoming hook requests conform to the specific hook requirements specified the
27
- CRD IG and the [CDS hooks spec](https://cds-hooks.hl7.org/2.0/).
24
+ Each hook group contains a test which waits for incoming hook requests from the CRD client, and tests which
25
+ verify the incoming hook requests conform to the specific hook requirements specified the
26
+ CRD IG and the [CDS hooks spec](https://cds-hooks.hl7.org/2.0/).
28
27
 
29
- Each hook group tests the following:
30
- * If the CRD Client can invoke the specific hook service request
31
- * If the incoming hook request is properly authorized with a JWT Bearer token according to the [CDS Hooks authorization requirements](https://cds-hooks.hl7.org/2.0/#trusting-cds-clients)
32
- * If the incoming hook request contains the required fields listed in the [CDS Hooks HTTP request requirements](https://cds-hooks.hl7.org/2.0/#http-request_1)
33
- * OPTIONAL: If the incoming hook request contains the optional fields listed in the [CDS Hooks HTTP request requirements](https://cds-hooks.hl7.org/2.0/#http-request_1)
34
- * If the hook request's `context` field is valid according to the specific `context` requirements defined for
35
- each hook type
36
- * OPTIONAL: If the incoming hook contains the optional `prefetch` field with valid resources
37
- * If the client can properly display the cards returned as a result of the hook request
28
+ Each hook group tests the following:
29
+ * If the CRD Client can invoke the specific hook service request
30
+ * If the incoming hook request is properly authorized with a JWT Bearer token according to the [CDS Hooks authorization requirements](https://cds-hooks.hl7.org/2.0/#trusting-cds-clients)
31
+ * If the incoming hook request contains the required fields listed in the [CDS Hooks HTTP request requirements](https://cds-hooks.hl7.org/2.0/#http-request_1)
32
+ * OPTIONAL: If the incoming hook request contains the optional fields listed in the [CDS Hooks HTTP request requirements](https://cds-hooks.hl7.org/2.0/#http-request_1)
33
+ * If the hook request's `context` field is valid according to the specific `context` requirements defined for
34
+ each hook type
35
+ * OPTIONAL: If the incoming hook contains the optional `prefetch` field with valid resources
36
+ * If the client can properly display the cards returned as a result of the hook request
38
37
 
39
- Note: In order to successfully return a `Coverage Information` system action, a Coverage resource must either be
40
- provided in the service request's `prefetch` field, or must be fetchable from the client's FHIR server for
41
- the patient provided in the service request.
38
+ Note: In order to successfully return a `Coverage Information` system action, a Coverage resource must either be
39
+ provided in the service request's `prefetch` field, or must be fetchable from the client's FHIR server for
40
+ the patient provided in the service request.
42
41
  DESCRIPTION
43
42
  id :crd_client_hooks
44
43
  verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@149'
@@ -14,7 +14,7 @@ module DaVinciCRDTestKit
14
14
  level of detail provided is insufficient to determine coverage.
15
15
  )
16
16
  config options: { accepts_multiple_requests: true }
17
- verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@164', 'hl7.fhir.us.davinci-crd_2.0.1@171',
17
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@171',
18
18
  'hl7.fhir.us.davinci-crd_2.0.1@183', 'hl7.fhir.us.davinci-crd_2.0.1@243',
19
19
  'hl7.fhir.us.davinci-crd_2.0.1@244', 'hl7.fhir.us.davinci-crd_2.0.1@245'
20
20
 
@@ -10,14 +10,15 @@ module DaVinciCRDTestKit
10
10
 
11
11
  input :create_resources,
12
12
  type: 'textarea',
13
- description:
14
- 'Provide a list of resources to create. e.g., [json_resource_1, json_resource_2]'
13
+ description: 'Provide a list of resources to create. e.g., [json_resource_1, json_resource_2]',
14
+ optional: true
15
15
 
16
16
  def resource_type
17
17
  config.options[:resource_type]
18
18
  end
19
19
 
20
20
  run do
21
+ skip_if create_resources.blank?, 'Provide a list of resources to create to run this test.'
21
22
  assert_valid_json(create_resources)
22
23
  create_resources_list = JSON.parse(create_resources)
23
24
  skip_if(!create_resources_list.is_a?(Array), 'Resources to create not inputted in list format, skipping test.')
@@ -7,7 +7,8 @@ module DaVinciCRDTestKit
7
7
  each resource can be found here: https://hl7.org/fhir/us/davinci-crd/CapabilityStatement-crd-client.html#resourcesSummary1
8
8
  )
9
9
 
10
- input :resource_ids
10
+ input :resource_ids,
11
+ optional: true
11
12
 
12
13
  def resource_type
13
14
  config.options[:resource_type]
@@ -10,14 +10,15 @@ module DaVinciCRDTestKit
10
10
 
11
11
  input :update_resources,
12
12
  type: 'textarea',
13
- description:
14
- 'Provide a list of resources to update. e.g., [json_resource_1, json_resource_2]'
13
+ description: 'Provide a list of resources to update. e.g., [json_resource_1, json_resource_2]',
14
+ optional: true
15
15
 
16
16
  def resource_type
17
17
  config.options[:resource_type]
18
18
  end
19
19
 
20
20
  run do
21
+ skip_if update_resources.blank?, 'Provide a list of resources to update to run this test.'
21
22
  assert_valid_json(update_resources)
22
23
  update_resources_list = JSON.parse(update_resources)
23
24
  skip_if(!update_resources_list.is_a?(Array), 'Resources to update not inputted in list format, skipping test.')
@@ -43,15 +43,16 @@ module DaVinciCRDTestKit
43
43
  .flat_map { |resource| resource.is_a?(FHIR::Bundle) ? resource.entry.map(&:resource) : resource }
44
44
  .select { |resource| resource.resourceType == resource_type }
45
45
  .uniq { |resource| resource.to_reference.reference }
46
- .each { |resource| resource_is_valid?(resource:, profile_url:) }
46
+ .map { |resource| resource_is_valid?(resource:, profile_url:) }
47
47
 
48
48
  skip_if(validated_resources.blank?,
49
49
  %(No #{resource_type} resources were returned from any of the FHIR API requests made in previous tests
50
50
  that could be validated.))
51
51
 
52
52
  validation_error_count = messages.count { |msg| msg[:type] == 'error' }
53
+ invalid_resource_count = validated_resources.reject { |valid| valid }.count
53
54
  assert(validation_error_count.zero?,
54
- %(#{validation_error_count}/#{validated_resources.length} #{resource_type} resources returned from previous
55
+ %(#{invalid_resource_count}/#{validated_resources.length} #{resource_type} resources returned from previous
55
56
  test's FHIR API requests failed validation.))
56
57
 
57
58
  skip_if validated_resources.blank?, 'No FHIR resources were made in previous tests that could be validated.'
@@ -13,7 +13,7 @@ module DaVinciCRDTestKit
13
13
  system action for these hooks, even if the response indicates that further information is needed or that the
14
14
  level of detail provided is insufficient to determine coverage.
15
15
  )
16
- verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@164', 'hl7.fhir.us.davinci-crd_2.0.1@205',
16
+ verifies_requirements 'hl7.fhir.us.davinci-crd_2.0.1@205',
17
17
  'hl7.fhir.us.davinci-crd_2.0.1@207', 'hl7.fhir.us.davinci-crd_2.0.1@243',
18
18
  'hl7.fhir.us.davinci-crd_2.0.1@244', 'hl7.fhir.us.davinci-crd_2.0.1@245'
19
19
 
@@ -3,6 +3,10 @@ module DaVinciCRDTestKit
3
3
  include CardsValidation
4
4
 
5
5
  title 'Custom CDS Service Response is valid'
6
+ description %(
7
+ If a custom CDS Service response is provided for Inferno to return when simulating the CRD Server's
8
+ hook response, this test will check that it is a valid CRD hook response.
9
+ )
6
10
  id :crd_submitted_response_validation
7
11
 
8
12
  input :custom_response, optional: true
@@ -123,6 +123,14 @@ module DaVinciCRDTestKit
123
123
  }
124
124
  ]
125
125
 
126
+ requirement_sets(
127
+ {
128
+ identifier: 'hl7.fhir.us.davinci-crd_2.0.1',
129
+ title: 'Da Vinci Coverage Requirements Discovery (CRD) v2.0.1',
130
+ actor: 'Client'
131
+ }
132
+ )
133
+
126
134
  fhir_resource_validator do
127
135
  igs('hl7.fhir.us.davinci-crd#2.0.1')
128
136
 
@@ -168,9 +176,17 @@ module DaVinciCRDTestKit
168
176
  CRDClientSuite.extract_token_from_query_params(request)
169
177
  end
170
178
 
171
- group from: :crd_client_registration
179
+ group do
180
+ id :crd_client_hook_invocation
181
+ title 'Hook Invocation'
182
+ description %(
183
+ This groups checks that the system can register as a CDS Client with
184
+ Inferno's simulated CRD Server and make hook invocations.
185
+ )
172
186
 
173
- group from: :crd_client_hooks
187
+ group from: :crd_client_registration
188
+ group from: :crd_client_hooks
189
+ end
174
190
 
175
191
  group from: :crd_client_fhir_api
176
192
  end
@@ -90,6 +90,14 @@ module DaVinciCRDTestKit
90
90
  }
91
91
  ]
92
92
 
93
+ requirement_sets(
94
+ {
95
+ identifier: 'hl7.fhir.us.davinci-crd_2.0.1',
96
+ title: 'Da Vinci Coverage Requirements Discovery (CRD) v2.0.1',
97
+ actor: 'Server'
98
+ }
99
+ )
100
+
93
101
  input :base_url,
94
102
  title: 'CRD server base URL'
95
103