davinci_dtr_test_kit 0.9.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/dtr_dinner_questionnaire_package_request_test.rb +97 -0
  3. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/dtr_questionnaire_response_save_test.rb +2 -2
  4. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/dtr_smart_app_questionnaire_workflow_group.rb +3 -2
  5. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/prepopulation_attestation_test.rb +4 -4
  6. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/prepopulation_override_attestation_test.rb +4 -4
  7. data/lib/davinci_dtr_test_kit/client_groups/dinner_static/rendering_enabled_questions_attestation_test.rb +4 -4
  8. data/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_package_group.rb +2 -2
  9. data/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_rendering_attestation_test.rb +4 -4
  10. data/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_response_save_test.rb +2 -2
  11. data/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_resp_questionnaire_package_request_test.rb +95 -0
  12. data/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_smart_app_questionnaire_workflow_group.rb +4 -3
  13. data/lib/davinci_dtr_test_kit/docs/dtr_smart_app_suite_description_v201.md +107 -43
  14. data/lib/davinci_dtr_test_kit/dtr_full_ehr_suite.rb +30 -6
  15. data/lib/davinci_dtr_test_kit/dtr_light_ehr_suite.rb +26 -3
  16. data/lib/davinci_dtr_test_kit/dtr_payer_server_suite.rb +33 -7
  17. data/lib/davinci_dtr_test_kit/dtr_questionnaire_response_validation.rb +26 -10
  18. data/lib/davinci_dtr_test_kit/dtr_smart_app_suite.rb +59 -14
  19. data/lib/davinci_dtr_test_kit/fixtures/dinner_static/questionnaire_dinner_order_static.json +1 -1
  20. data/lib/davinci_dtr_test_kit/fixtures/questionnaire_package.json +1 -1
  21. data/lib/davinci_dtr_test_kit/mock_auth_server.rb +135 -0
  22. data/lib/davinci_dtr_test_kit/mock_ehr.rb +32 -12
  23. data/lib/davinci_dtr_test_kit/mock_payer.rb +2 -21
  24. data/lib/davinci_dtr_test_kit/payer_server_groups/payer_server_static_group.rb +4 -2
  25. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_libraries_test.rb +2 -2
  26. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_questionnaire_expressions_test.rb +3 -3
  27. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_questionnaire_extensions_test.rb +2 -2
  28. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_request_test.rb +1 -0
  29. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_request_validation_test.rb +5 -3
  30. data/lib/davinci_dtr_test_kit/payer_server_groups/static_form_response_validation_test.rb +15 -11
  31. data/lib/davinci_dtr_test_kit/urls.rb +14 -3
  32. data/lib/davinci_dtr_test_kit/version.rb +1 -1
  33. metadata +19 -3
  34. data/lib/davinci_dtr_test_kit/client_groups/shared/dtr_questionnaire_package_request_test.rb +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e84658427289327e910d38a2e24e50bfe15b0c7ae8096d358df3c45d30f6f6b5
4
- data.tar.gz: 6ecc074de82b8e0533edcfd99cb9e42a82e74b5a3fe7779e19ba6403782f4cae
3
+ metadata.gz: e95ac1a81ec266133aa196823f9c4af450b6ff0c628b2ca9dccbb0fcd3b32863
4
+ data.tar.gz: d4ac1d46eadaa7f1067d07b4811e00803308f8d1c91cf9165f6e17534a280449
5
5
  SHA512:
6
- metadata.gz: f97f96957563a2705899b6c3356ff127c8c5a55423730c26c69792ab441456acb3817245126008e764d867c6fea4a789a7bc9cb295c2d728910f98cd37798117
7
- data.tar.gz: 399594d80b1d9e118abdae646fb308d221240debf4495f185f36f82e09c35d8326016d9039f68da0d1fef7c76e88bbe7c879f789127157b7ac405e29463b9191
6
+ metadata.gz: 22b65864b0795e2355b17d19b78d262524b29a9c0b1352603cd226a8d5c135a5bb0566c6c8449ce4ea0516ebedbee1e7a94965d7448e98a927b07716bd65c049
7
+ data.tar.gz: 0daaae716b201d20f99c768e5a7bc9d6ae997f953ab2d238862298ab00a39d82746b5e1a71537f13eeb09ea260c097955a22487405128aa5cbe9339cc1860fce
@@ -0,0 +1,97 @@
1
+ require 'base64'
2
+ require_relative '../../urls'
3
+
4
+ module DaVinciDTRTestKit
5
+ class DTRDinnerQuestionnairePackageRequestTest < Inferno::Test
6
+ include URLs
7
+
8
+ id :dtr_dinner_questionnaire_package_request
9
+ title 'Invoke the DTR Questionnaire Package operation'
10
+ description %(
11
+ Inferno will wait for a DTR questionnaire package request from the client. Upon receipt, Inferno will generate and
12
+ send a response.
13
+ )
14
+ input :smart_app_launch, type: 'radio', title: 'SMART App Launch',
15
+ description: 'How will the DTR SMART App launch?',
16
+ options: { list_options: [{ label: 'Launch from Inferno', value: 'inferno' },
17
+ { label: 'Launch from EHR', value: 'ehr' }] }
18
+ input :client_id
19
+ input :launch_uri, optional: true, description: 'Required if "Launch from Inferno" is selected'
20
+ input :smart_patient_id, optional: true, title: 'SMART App Launch Patient ID (Dinner Static)',
21
+ type: 'text',
22
+ description: %(
23
+ Patient instance id to be provided by Inferno as the `patient` as a part of the SMART app
24
+ launch.
25
+ )
26
+ input :smart_fhir_context, optional: true, title: 'SMART App Launch fhirContext (Dinner Static)',
27
+ type: 'textarea',
28
+ description: %(
29
+ References to be provided by Inferno as the `fhirContext` as a part of the SMART app
30
+ launch. These references help determine the behavior of the app. Referenced instances
31
+ may be providedin the "EHR-available resources" input.
32
+ )
33
+ input :ehr_bundle, optional: true, title: 'EHR-available resources (Dinner Static)', type: 'textarea',
34
+ description: %(
35
+ Resources available from the EHR needed to drive the dinner static workflow.
36
+ Formatted as a FHIR bundle that contains resources, each with an `id` property populated. Each
37
+ instance present will be available for retrieval from Inferno at the endpoint
38
+ `[fhir-base]/[resource type]/[instance id].`
39
+ )
40
+
41
+ def example_client_jwt_payload_part
42
+ Base64.strict_encode64({ inferno_client_id: client_id }.to_json).delete('=')
43
+ end
44
+
45
+ run do
46
+ launch_prompt = if smart_app_launch == 'inferno'
47
+ %(Launch the DTR SMART App from Inferno by right clicking
48
+ [this link](#{launch_uri}?iss=#{fhir_base_url}&launch=#{launch_uri})
49
+ and selecting or "Open in new window" or "Open in new tab".)
50
+ else
51
+ %(Launch the SMART App from your EHR.)
52
+ end
53
+ inferno_prompt_cont = %(As the DTR app steps through the launch steps, Inferno will wait and respond to the app's
54
+ requests for SMART configuration, authorization and access token.)
55
+
56
+ wait(
57
+ identifier: client_id,
58
+ message: %(
59
+ ### SMART App Launch
60
+
61
+ #{launch_prompt}
62
+
63
+ #{inferno_prompt_cont if smart_app_launch == 'inferno'}
64
+
65
+ Then, Inferno will expect the SMART App to invoke the DTR Questionnaire Package operation by sending a POST
66
+ request to
67
+
68
+ `#{questionnaire_package_url}`
69
+
70
+ A questionnaire package generated by Inferno will be returned.
71
+
72
+ ### Pre-population
73
+
74
+ Inferno will then wait for the client to complete Questionnaire pre-population. The client should make FHIR
75
+ GET requests using service base path:
76
+
77
+ `#{fhir_base_url}`
78
+
79
+ ### Request Identification
80
+
81
+ In order to identify requests for this session, Inferno will look for
82
+ an `Authorization` header with value:
83
+
84
+ ```
85
+ Bearer eyJhbGcmOiJub25lIn0.#{example_client_jwt_payload_part}.
86
+ ```
87
+
88
+ ### Continuing the Tests
89
+
90
+ When the DTR application has finished loading the Questionnaire,
91
+ including any clinical data requests to support pre-population,
92
+ [Click here](#{resume_pass_url}?client_id=#{client_id}) to continue.
93
+ )
94
+ )
95
+ end
96
+ end
97
+ end
@@ -9,11 +9,11 @@ module DaVinciDTRTestKit
9
9
  description %(
10
10
  Inferno, acting as the EHR, will wait for a request to save the QuestionnaireResponse from the client.
11
11
  )
12
- input :access_token
12
+ input :client_id
13
13
 
14
14
  run do
15
15
  wait(
16
- identifier: access_token,
16
+ identifier: client_id,
17
17
  message: %(
18
18
  Complete the questionnaire, leaving the following items unmodified, because a subsequent test will expect
19
19
  their pre-populated values:
@@ -1,4 +1,4 @@
1
- require_relative '../shared/dtr_questionnaire_package_request_test'
1
+ require_relative 'dtr_dinner_questionnaire_package_request_test'
2
2
  require_relative '../shared/dtr_questionnaire_package_request_validation_test'
3
3
  require_relative 'prepopulation_attestation_test'
4
4
  require_relative 'prepopulation_override_attestation_test'
@@ -17,6 +17,7 @@ module DaVinciDTRTestKit
17
17
  demonstrate their ability to:
18
18
 
19
19
  1. Fetch the static questionnaire package
20
+ ([DinnerOrderStatic](https://github.com/inferno-framework/davinci-dtr-test-kit/blob/main/lib/davinci_dtr_test_kit/fixtures/dinner_static/questionnaire_dinner_order_static.json))
20
21
  2. Render and pre-populate the questionnaire appropriately, including:
21
22
  - fetch additional data needed for pre-population
22
23
  - pre-populate data as directed by the questionnaire
@@ -36,7 +37,7 @@ module DaVinciDTRTestKit
36
37
  run_as_group
37
38
 
38
39
  # Test 1: wait for the $questionnaire-package request
39
- test from: :dtr_questionnaire_package_request
40
+ test from: :dtr_dinner_questionnaire_package_request
40
41
  # Test 2: validate the $questionnaire-package body
41
42
  test from: :dtr_questionnaire_package_request_validation
42
43
  end
@@ -9,19 +9,19 @@ module DaVinciDTRTestKit
9
9
  description %(
10
10
  Validate that pre-population of patient name information occurs as expected.
11
11
  )
12
- input :access_token
12
+ input :client_id
13
13
 
14
14
  run do
15
15
  wait(
16
- identifier: access_token,
16
+ identifier: client_id,
17
17
  message: %(
18
18
  I attest that the client application pre-populates the following questions with the respective values:
19
19
  - Last Name: Oster
20
20
  - First Name: William
21
21
 
22
- [Click here](#{resume_pass_url}?token=#{access_token}) if the above statement is **true**.
22
+ [Click here](#{resume_pass_url}?client_id=#{client_id}) if the above statement is **true**.
23
23
 
24
- [Click here](#{resume_fail_url}?token=#{access_token}) if the above statement is **false**.
24
+ [Click here](#{resume_fail_url}?client_id=#{client_id}) if the above statement is **false**.
25
25
  )
26
26
  )
27
27
  end
@@ -9,20 +9,20 @@ module DaVinciDTRTestKit
9
9
  description %(
10
10
  Validate that the user can edit a pre-populated item and replace it with another value.
11
11
  )
12
- input :access_token
12
+ input :client_id
13
13
 
14
14
  run do
15
15
  wait(
16
- identifier: access_token,
16
+ identifier: client_id,
17
17
  message: %(
18
18
  I attest that
19
19
 
20
20
  1. The client pre-populated an answer for question 'Location'.
21
21
  2. I have changed the answer to a different value.
22
22
 
23
- [Click here](#{resume_pass_url}?token=#{access_token}) if the above statement is **true**.
23
+ [Click here](#{resume_pass_url}?client_id=#{client_id}) if the above statement is **true**.
24
24
 
25
- [Click here](#{resume_fail_url}?token=#{access_token}) if the above statement is **false**.
25
+ [Click here](#{resume_fail_url}?client_id=#{client_id}) if the above statement is **false**.
26
26
  )
27
27
  )
28
28
  end
@@ -10,19 +10,19 @@ module DaVinciDTRTestKit
10
10
  Validate that the rendering of the questionnaire includes only the "What would you like on..."
11
11
  question appropriate for the dinner selection, if made.
12
12
  )
13
- input :access_token
13
+ input :client_id
14
14
 
15
15
  run do
16
16
  wait(
17
- identifier: access_token,
17
+ identifier: client_id,
18
18
  message: %(
19
19
  I attest that the client application does not display any "What would you like on..."
20
20
  questions until I have selected a dinner choice and then only displays the
21
21
  "What would you like on..." question relevant for the dinner request:
22
22
 
23
- [Click here](#{resume_pass_url}?token=#{access_token}) if the above statement is **true**.
23
+ [Click here](#{resume_pass_url}?client_id=#{client_id}) if the above statement is **true**.
24
24
 
25
- [Click here](#{resume_fail_url}?token=#{access_token}) if the above statement is **false**.
25
+ [Click here](#{resume_fail_url}?client_id=#{client_id}) if the above statement is **false**.
26
26
  )
27
27
  )
28
28
  end
@@ -1,4 +1,4 @@
1
- require_relative '../shared/dtr_questionnaire_package_request_test'
1
+ require_relative 'dtr_resp_questionnaire_package_request_test'
2
2
  require_relative '../shared/dtr_questionnaire_package_request_validation_test'
3
3
 
4
4
  module DaVinciDTRTestKit
@@ -10,7 +10,7 @@ module DaVinciDTRTestKit
10
10
  )
11
11
  run_as_group
12
12
 
13
- test from: :dtr_questionnaire_package_request
13
+ test from: :dtr_resp_questionnaire_package_request
14
14
  test from: :dtr_questionnaire_package_request_validation
15
15
  end
16
16
  end
@@ -10,21 +10,21 @@ module DaVinciDTRTestKit
10
10
  Thist test provides the tester an opportunity to observe their client application following the receipt of the
11
11
  questionnaire pacakage and attest that the application renders the questionnaire.
12
12
  )
13
- input :access_token
13
+ input :client_id
14
14
 
15
15
  run do
16
16
  load_tagged_requests QUESTIONNAIRE_PACKAGE_TAG
17
17
  skip_if request.blank?, 'A Questionnaire Package request must be made prior to running this test'
18
18
 
19
19
  wait(
20
- identifier: access_token,
20
+ identifier: client_id,
21
21
  message: %(
22
22
  I attest that the client application displays the questionnaire and respects the following rendering style:
23
23
  - The "Signature" field label is rendered with green text
24
24
 
25
- [Click here](#{resume_pass_url}?token=#{access_token}) if the above statement is **true**.
25
+ [Click here](#{resume_pass_url}?client_id=#{client_id}) if the above statement is **true**.
26
26
 
27
- [Click here](#{resume_fail_url}?token=#{access_token}) if the above statement is **false**.
27
+ [Click here](#{resume_fail_url}?client_id=#{client_id}) if the above statement is **false**.
28
28
  )
29
29
  )
30
30
  end
@@ -9,11 +9,11 @@ module DaVinciDTRTestKit
9
9
  description %(
10
10
  Inferno, acting as the EHR, will wait for a request to save the QuestionnaireResponse from the client.
11
11
  )
12
- input :access_token
12
+ input :client_id
13
13
 
14
14
  run do
15
15
  wait(
16
- identifier: access_token,
16
+ identifier: client_id,
17
17
  message: %(
18
18
  Complete the questionnaire, leaving the following items unmodified, because a subsequent test will expect
19
19
  their pre-populated values:
@@ -0,0 +1,95 @@
1
+ require_relative '../../urls'
2
+
3
+ module DaVinciDTRTestKit
4
+ class DTRRespQuestionnairePackageRequestTest < Inferno::Test
5
+ include URLs
6
+
7
+ id :dtr_resp_questionnaire_package_request
8
+ title 'Invoke the DTR Questionnaire Package operation'
9
+ description %(
10
+ Inferno will wait for a DTR questionnaire package request from the client. Upon receipt, Inferno will generate and
11
+ send a response.
12
+ )
13
+ input :smart_app_launch, type: 'radio', title: 'SMART App Launch',
14
+ description: 'How will the DTR SMART App launch?',
15
+ options: { list_options: [{ label: 'Launch from Inferno', value: 'inferno' },
16
+ { label: 'Launch from EHR', value: 'ehr' }] }
17
+ input :client_id
18
+ input :launch_uri, optional: true, description: 'Required if "Launch from Inferno" is selected'
19
+ input :smart_patient_id, optional: true, title: 'SMART App Launch Patient ID (Respiratory Assist Device)',
20
+ type: 'text',
21
+ description: %(
22
+ Patient instance id to be provided by Inferno as the `patient` as a part of the SMART app
23
+ launch.
24
+ )
25
+ input :smart_fhir_context, optional: true, title: 'SMART App Launch fhirContext (Respiratory Assist Device)',
26
+ type: 'textarea',
27
+ description: %(
28
+ References to be provided by Inferno as the `fhirContext` as a part of the SMART app
29
+ launch. These references help determine the behavior of the app. Referenced instances
30
+ may be providedin the "EHR-available resources" input.
31
+ )
32
+ input :ehr_bundle, optional: true, title: 'EHR-available resources (Respiratory Assist Device)', type: 'textarea',
33
+ description: %(
34
+ Resources available from the EHR needed to drive the respiratory assist device
35
+ workflow. Formatted as a FHIR bundle that contains resources, each with an `id`
36
+ property populated. Each instance present will be available for retrieval from
37
+ Inferno at the endpoint `[fhir-base]/[resource type]/[instance id].`
38
+ )
39
+
40
+ def example_client_jwt_payload_part
41
+ Base64.strict_encode64({ inferno_client_id: client_id }.to_json).delete('=')
42
+ end
43
+
44
+ run do
45
+ launch_prompt = if smart_app_launch == 'inferno'
46
+ %(Launch the DTR SMART App from Inferno by right clicking
47
+ [this link](#{launch_uri}?iss=#{fhir_base_url}&launch=#{launch_uri})
48
+ and selecting or "Open in new window" or "Open in new tab".)
49
+ else
50
+ %(Launch the SMART App from your EHR.)
51
+ end
52
+ inferno_prompt_cont = %(As the DTR app steps through the launch steps, Inferno will wait and respond to the app's
53
+ requests for SMART configuration, authorization and access token.)
54
+ wait(
55
+ identifier: client_id,
56
+ message: %(
57
+ ### SMART App Launch
58
+
59
+ #{launch_prompt}
60
+
61
+ #{inferno_prompt_cont if smart_app_launch == 'inferno'}
62
+
63
+ Then, Inferno will expect the SMART App to invoke the DTR Questionnaire Package operation by sending a POST
64
+ request to
65
+
66
+ `#{questionnaire_package_url}`
67
+
68
+ A questionnaire package generated by Inferno will be returned.
69
+
70
+ ### Pre-population
71
+
72
+ Inferno will then wait for the client to complete Questionnaire pre-population. The client should make FHIR
73
+ GET requests using service base path:
74
+
75
+ `#{fhir_base_url}`
76
+
77
+ ### Request Identification
78
+
79
+ In order to identify requests for this session, Inferno will look for
80
+ an `Authorization` header with value:
81
+
82
+ ```
83
+ Bearer eyJhbGcmOiJub25lIn0.#{example_client_jwt_payload_part}.
84
+ ```
85
+
86
+ ### Continuing the Tests
87
+
88
+ When the DTR application has finished loading the Questionnaire,
89
+ including any clinical data requests to support pre-population,
90
+ [Click here](#{resume_pass_url}?client_id=#{client_id}) to continue.
91
+ )
92
+ )
93
+ end
94
+ end
95
+ end
@@ -7,10 +7,11 @@ module DaVinciDTRTestKit
7
7
  id :dtr_smart_app_questionnaire_workflow
8
8
  title 'Respiratory Assist Device Questionnaire Workflow'
9
9
  description %(
10
- This workflow validates that a DTR SMART App can perform a full DTR Questionnaire workflow using a canned
11
- Questionnaire for a respiratory assist device order:
10
+ This workflow validates that a DTR SMART App can perform a full DTR
11
+ Questionnaire workflow using a canned Questionnaire
12
+ for a respiratory assist device order:
12
13
 
13
- 1. Fetch the questionnaire package
14
+ 1. Fetch the questionnaire package ([RespiratoryAssistDevices](https://github.com/inferno-framework/davinci-dtr-test-kit/blob/main/lib/davinci_dtr_test_kit/fixtures/questionnaire_package.json))
14
15
  2. Render the questionnaire
15
16
  3. Pre-populate the questionnaire response
16
17
  )
@@ -52,64 +52,128 @@ validated with the Java validator using `tx.fhir.org` as the terminology server.
52
52
 
53
53
  ### Quick Start
54
54
 
55
- Inferno does not currently include the ability to launch the client. Therefore, clients
56
- must be manually configured to point to Inferno's simulated server endpoints. The endpoints
57
- can be inferred from the URL of the test session which will be of the form `[URL prefix]/dtr_smart_app/[session id]`: (NOTE: both currently use the same URL)
58
- - Payer Server Base FHIR URL: `[URL prefix]/custom/dtr_smart_app/fhir`
59
- - Light EHR Base FHIR URL: `[URL prefix]/custom/dtr_smart_app/fhir`
60
-
61
- In order for Inferno to associate requests sent to locations under these base URLs with this session,
62
- it needs to know the bearer token that the app will send on requests, for which
63
- there are two options.
64
-
65
- 1. If you want to choose your own bearer token, then
66
- 1. Select the "2. Basic Workflows" test from the list on the left (or other target test).
67
- 2. Click the '*Run All Tests*' button on the right.
68
- 3. In the "access_token" field, enter the bearer token that will be sent by the client
69
- under test (as part of the Authorization header - `Bearer <provided value>`).
70
- 4. Click the '*Submit*' button at the bottom of the dialog.
71
- 2. If you want to use a client_id to obtain an access token, then
72
- 1. Click the '*Run All Tests*' button on the right.
73
- 2. Provide the client's registered id "client_id" field of the input (NOTE, Inferno doesn't support the
74
- registration API, so this must be obtained from another system or configured manually).
75
- 3. Click the '*Submit*' button at the bottom of the dialog.
76
- 4. Make a token request that includes the specified client id to the
77
- `[URL prefix]/custom/dtr_smart_app/mock_auth/token` endpoint to get
78
- an access token to use on the request of the requests.
79
-
80
- In either case, the tests will continue from that point. Further executions of tests under
81
- this session will also use the selected bearer token.
82
-
83
- Note: authentication options for these tests have not been finalized and are subject to change.
55
+ This test suite can be run in two modes, each described below:
56
+ 1. [EHR launch mode](#ehr-launch)
57
+ 2. [Standalone launch mode](#standalone-launch)
58
+
59
+ At this time, Inferno's simulation of the payer server that provides the questionnaires
60
+ uses the same base server url and access token, and apps will need to be configured to
61
+ connect to it as well. See the "Combined payer and EHR FHIR servers" section below for details.
62
+
63
+ The DTR specification allows apps and their partners significant leeway in terms of
64
+ what information is provided on launch and how that information gets used by the app
65
+ to determine the `$questionnaire-package` endpoint and what details to submit as a
66
+ part of that operation. Inferno cannot know ahead of time what data needs to be
67
+ available for the app under test to successfully request, pre-populate, and render
68
+ a questionnaire. See the "`fhirContext` and available instances"
69
+ section below for details on how to enable Inferno to meet the needs of your application.
70
+
71
+ #### EHR Launch
72
+
73
+ In this mode Inferno will launch the app under test using the SMART App Launch
74
+ [EHR launch](https://hl7.org/fhir/smart-app-launch/STU2.1/app-launch.html#launch-app-ehr-launch)
75
+ flow.
76
+
77
+ The tester must provide
78
+ 1. a `client_id`: can be any string and will uniquely identify the testing session.
79
+ 2. a `launch_uri`: will be used by Inferno to generate a link to launch the app under test.
80
+
81
+ All the details needed to access clinical data from Inferno's simulated EHR are provided
82
+ as a part of the SMART flow, including
83
+ - the FHIR base server URL to request data from
84
+ - a bearer token to provide on all requests
85
+
86
+ #### Standalone Launch
87
+
88
+ In this mode the app under test will launch and on its own and reach out to Inferno to
89
+ begin the workflow as described in the
90
+ [standalone launch section](https://hl7.org/fhir/smart-app-launch/STU2.1/app-launch.html#launch-app-standalone-launch).
91
+
92
+ The tester must provide
93
+ 1. a `client_id`: can be any string and will uniquely identify the testing session.
94
+
95
+ The app will then need to connect to Inferno as directed to initiate the SMART and DTR
96
+ workflow. The FHIR base server url that app will connect to is
97
+ `[URL prefix]/custom/dtr_smart_app/fhir` where `[URL prefix]` comes from the URL of the
98
+ test session which will be of the form `[URL prefix]/dtr_smart_app/[session id]`
84
99
 
85
100
  ### Postman-based Demo
86
101
 
87
102
  If you do not have a DTR SMART app but would like to try the tests out, you can use
88
- [this Postman collection](https://github.com/inferno-framework/davinci-dtr-test-kit/blob/main/config/DTR%20Test%20Kit.postman_collection.json)
103
+ [this Postman collection](https://github.com/inferno-framework/davinci-dtr-test-kit/blob/main/config/DTR%20SMART%20App%20Tests%20Postman%20Demo.postman_collection.json)
89
104
  to make requests against Inferno. This does not include the capability to render the complete the
90
105
  questionnaires, but does have samples of correctly and incorrectly completed QuestionnaireResponses.
91
106
  The following is a list of tests with the Postman requests that can be used with them:
92
107
 
93
- - **2.1** *Static Questionnaire Workflow*: use requests in the `Static Dinner` folder
94
- - **2.1.1.01** *Invoke the DTR Questionnaire Package operation*: submit request `Questionnaire Package for Dinner (Static)` while this test is waiting.
95
- - **2.1.3.01** *Save the QuestionnaireResponse after completing it*: submit request `Save QuestionnaireResponse for Dinner (Static)` while this test is waiting. If you want to see a failure, submit request `Save QuestionnaireResponse for Dinner (Static) - missing origin extension` instead.
96
- - **3.1** *Respiratory Assist Device Questionnaire Workflow*: use requests in the `Respiratory Assist Device` folder
97
- - **3.1.1.01** *Invoke the DTR Questionnaire Package operation*: submit request `Questionnaire Package for Resp Assist Device` while this test is waiting.
98
- - **3.1.3.01** *Save the QuestionnaireResponse after completing it*: submit request `Save Questionnaire Response for Resp Assist Device` while this test is waiting. If you want to see a failure, submit request `Save Questionnaire Response for Resp Assist Device - unexpected override` instead.
108
+ - **Standalone launch sequence**: use requests in the `SMART App Launch` folder during
109
+ tests **1.1.1.01** or **2.1.1.01** to simulate the SMART Launch flow and obtain an access
110
+ token to use for subsequent requests. See the collection's Overview for details on the
111
+ access token's generation.
112
+ - **1.1** *Static Questionnaire Workflow*: use requests in the `Static Dinner` folder
113
+ - **1.1.1.01** *Invoke the DTR Questionnaire Package operation*: submit request `Questionnaire Package for Dinner (Static)` while this test is waiting.
114
+ - **1.1.3.01** *Save the QuestionnaireResponse after completing it*: submit request `Save QuestionnaireResponse for Dinner (Static)` while this test is waiting. If you want to see a failure, submit request `Save QuestionnaireResponse for Dinner (Static) - missing origin extension` instead.
115
+ - **2.1** *Respiratory Assist Device Questionnaire Workflow*: use requests in the `Respiratory Assist Device` folder
116
+ - **2.1.1.01** *Invoke the DTR Questionnaire Package operation*: submit request `Questionnaire Package for Resp Assist Device` while this test is waiting.
117
+ - **2.1.3.01** *Save the QuestionnaireResponse after completing it*: submit request `Save Questionnaire Response for Resp Assist Device` while this test is waiting. If you want to see a failure, submit request `Save Questionnaire Response for Resp Assist Device - unexpected override` instead.
118
+
119
+ ## Configuration Details
120
+
121
+ ### `fhirContext` and available instances
122
+
123
+ Once they have launched, DTR SMART Apps obtain details that drive their retrieval of questionnaires
124
+ and relevant clinical data from the payer and the EHR from [context that is passed with
125
+ the access token](https://hl7.org/fhir/smart-app-launch/STU2.1/scopes-and-launch-context.html)
126
+ provided by the EHR. Inferno cannot know ahead of time what information to provide and
127
+ what instances to make available to direct the app under test to request and render a
128
+ particular questionnaire.
129
+
130
+ Therefore, use of this test suite requests that the tester provide this information so that the
131
+ app can demonstrate its capabilities based on whatever business logic is present. These tests
132
+ currently support two context parameters that contain references to instance in the EHR and provides
133
+ testers with a way to provide those instances to Inferno so it can serve them to the app. These are
134
+ controlled by the following inputs present on each group associated with a questionnaire:
135
+
136
+ - **SMART App Launch Patient ID**: provide an `id` for the subject Patient FHIR instance.
137
+ - **SMART App Launch `fhirContext`**: provide a JSON object containing FHIR references to instances
138
+ relevant to the DTR workflow, e.g.
139
+
140
+ ```
141
+ [{reference: 'Coverage/cov015'}, {reference: 'DeviceRequest/devreqe0470'}]
142
+ ```
143
+ This will be included under the `fhirContext` key of the token response.
144
+ - **EHR-available resources**: provide a Bundle containing FHIR instances referenced in and from the
145
+ previous two inputs. Each instance must include an `id` element that Inferno will use in conjunction
146
+ with the `resourceType` to make the instances available at the `[server base url]/[resourceType]/[id]`.
147
+
148
+ Each questionnaire workflow group description includes a link to the questionnaire package that Inferno will return
149
+ (e.g., [here](https://github.com/inferno-framework/davinci-dtr-test-kit/blob/main/lib/davinci_dtr_test_kit/fixtures/dinner_static/questionnaire_dinner_order_static.json))
150
+ where you can find `id` and `url` values and any other details needed to determine what inputs
151
+ will allow the app under test to work with that questionnaire. Note additionally that Inferno will always
152
+ return that questionnaire in response to `$questionnaire-package` requests made during that test.
153
+
154
+ These inputs can be cumbersome to create and if you have suggestions about how to improve this process
155
+ while keeping the flexibility of Inferno to run with any app, submit a ticket
156
+ [here](https://github.com/inferno-framework/davinci-pas-test-kit/issues).
99
157
 
100
158
  ## Limitations
101
159
 
102
- The DTR IG is a complex specification and these tests currently validate SMART app
103
- configuration to only part of it. Future versions of the test suite will test further
160
+ The DTR IG is a complex specification and these tests currently validate conformance to only
161
+ a subset of IG requirements. Future versions of the test suite will test further
104
162
  features. A few specific features of interest are listed below.
105
163
 
106
164
  ### Launching and security
107
165
 
108
- The primary limitation on this test suite is that it requires the client under test
109
- to be manually configured to point to the Inferno endpoints and send a bearer token.
110
- In the future, the tests will provide a mechanism for launching the application using
111
- the SMART app launch mechanism. To provide feedback and input on the design of this feature,
112
- submit a ticket [here](https://github.com/inferno-framework/davinci-pas-test-kit/issues).
166
+ This test kit contains basic SMART App Launch cabilities that may not be complete. In particular,
167
+ refresh tokens are not currently supported and scopes are not precise. To provide feedback and
168
+ input on the design of this feature and help us priortize improvements, submit a ticket
169
+ [here](https://github.com/inferno-framework/davinci-pas-test-kit/issues).
170
+
171
+ ### Combined payer and EHR FHIR servers
172
+
173
+ At this time, the test suite simulates a single FHIR server that uses the same access token
174
+ for both the payer server and the EHR server. Apps under test must use the FHIR server base url
175
+ and access token identified during the SMART App Launch sequence when making requests
176
+ to retrieve questionnaires.
113
177
 
114
178
  ### Questionnaire Feature Coverage
115
179
 
@@ -25,18 +25,42 @@ module DaVinciDTRTestKit
25
25
 
26
26
  version VERSION
27
27
 
28
- # All FHIR validation requsets will use this FHIR validator
29
- validator do
30
- url ENV.fetch('VALIDATOR_URL')
28
+ links [
29
+ {
30
+ label: 'Report Issue',
31
+ url: 'https://github.com/inferno-framework/davinci-dtr-test-kit/issues'
32
+ },
33
+ {
34
+ label: 'Open Source',
35
+ url: 'https://github.com/inferno-framework/davinci-dtr-test-kit'
36
+ },
37
+ {
38
+ label: 'Download',
39
+ url: 'https://github.com/inferno-framework/davinci-dtr-test-kit/releases'
40
+ },
41
+ {
42
+ label: 'Implementation Guide',
43
+ url: 'https://hl7.org/fhir/us/davinci-dtr/STU2/'
44
+ }
45
+ ]
46
+
47
+ # Hl7 Validator Wrapper:
48
+ fhir_resource_validator do
49
+ igs 'hl7.fhir.us.davinci-dtr#2.0.1'
50
+
51
+ exclude_message do |message|
52
+ message.message.match?(/\A\S+: \S+: URL value '.*' does not resolve/)
53
+ end
31
54
  end
32
55
 
33
56
  allow_cors QUESTIONNAIRE_PACKAGE_PATH
34
57
 
35
- record_response_route :post, TOKEN_PATH, 'dtr_auth', method(:token_response) do |request|
36
- DTRFullEHRSuite.extract_client_id(request)
58
+ record_response_route :post, PAYER_TOKEN_PATH, 'dtr_full_ehr_payer_token',
59
+ method(:payer_token_response) do |request|
60
+ DTRFullEHRSuite.extract_client_id_from_form_params(request)
37
61
  end
38
62
 
39
- record_response_route :post, '/fhir/Questionnaire/$questionnaire-package', QUESTIONNAIRE_PACKAGE_TAG,
63
+ record_response_route :post, QUESTIONNAIRE_PACKAGE_PATH, QUESTIONNAIRE_PACKAGE_TAG,
40
64
  method(:questionnaire_package_response) do |request|
41
65
  DTRFullEHRSuite.extract_bearer_token(request)
42
66
  end