FHIR Chat · appContext for SMART app link · cds hooks

Stream: cds hooks

Topic: appContext for SMART app link


view this post on Zulip Chuck Feltner (Sep 10 2018 at 18:52):

For the optional appContext attribute for a SMART app link (https://cds-hooks.org/specification/1.0/#link), the CDS Hooks specification states: "The appContext field and value will be sent to the SMART app as part of the OAuth 2.0 access token response, alongside the other SMART launch parameters when the SMART app is launched."

How does the authorization server know when to include the appContext in the token response? Is the appContext included as a parameter in the SMART launch as well?

view this post on Zulip Kevin Shekleton (Sep 11 2018 at 15:43):

The EHR + AS have a very tight relationship. So, this is for the developers of those two systems to work that out.

view this post on Zulip Kevin Shekleton (Sep 11 2018 at 15:44):

For example, speaking for Cerner, our EHR and AS have a private API they use to communicate various information during the launch of a SMART app so that the AS knows exactly what context data to pass to the SMART app on launch.

view this post on Zulip Chuck Feltner (Sep 11 2018 at 18:37):

Thanks @Kevin Shekleton . So CDS Hooks is not adding any additional SMART launch parameters to be able to correlate that specific launch which the appContext is for? It is just relying on the existing SMART launch parameter that the EHR adds to the URL specified in the CDS link?

view this post on Zulip Kevin Shekleton (Sep 11 2018 at 20:25):

Right. The EHR/AS have to know how to create/understand what that launch parameter is.

For instance, in Cerner's case the launch parameter is a UUID that points to a private datastore that contains the launch/context information. The EHR creates this row+UUID and makes it available to the AS via the aforementioned private API.

view this post on Zulip Chuck Feltner (Sep 11 2018 at 22:18):

Great. Thanks @Kevin Shekleton

view this post on Zulip Travis Cummings (Dec 18 2018 at 18:02):

I'm looking to use the appContext to pass a SMART intent parameter to the SMART app. It would be something simple like "resources" or "calculator" telling the app which flow should be followed.

If I use the appContext, will the resulting value be nested inside an appContext property (differing from the SMART "intent" parameter that not nested)? Or is their another way for a CDS Hook app link to indicate intent?

{
"access_token": "i8hweunweunweofiwweoijewiwe",
...
"intent": "calculator",
"appContext": "{\"intent\":\"calculator\"}"
}

The alternate I can think of is simply adding a query parameter to the launch, but I think an EHR might be using the URL value to match a SMART app registration, and fail if I add custom parameters.

view this post on Zulip Kevin Shekleton (Jan 09 2019 at 13:23):

Yes, the appContext property will sit alongside the other SMART launch parameters via its own property as in your example.

I definitely wouldn't do a query parameter on your SMART app launch URL. Custom URL parameters on SMART app launch URLs are not documented in the SMART spec and I suspect aren't widely supported.

view this post on Zulip Raj M (Jan 10 2019 at 16:02):

Should appContext added to SMART spec [http://www.hl7.org/fhir/smart-app-launch/scopes-and-launch-context/#launch-context-arrives-with-your-access_token] as optional or is the documentation in Hooks spec suffice (given this param is more specific to Hooks) ?

view this post on Zulip Kevin Shekleton (Jan 12 2019 at 12:53):

I think appContext staying solely within the CDS Hooks specification is the right thing (rather than adding it to the SMART app launch specification).

view this post on Zulip Patrick Haren (May 05 2019 at 04:05):

Hi @Kevin Shekleton Is this issue closed?: https://github.com/smart-on-fhir/smart-launcher/issues/5

I ask because current sandboxes (Cerner Code, HSPC) do not seem to have a mechanism to specify an appContext to be returned as part of the /token response during app launch. The Da Vinci CRD and DTR use-cases (and reference implementations) are banking on the EHR using the appContext for the SMART app and then including it in the token response, along with access_token, token_type, etc.

I agree that an additional query parameter in the launch url is not a documented technique, so (although it currently can be coerced) it is a brittle workaround.

view this post on Zulip Kyle Neumeier (May 05 2019 at 10:00):

When I launch a SMART App from a link in CDS card from the HSPC Sandbox where the appContext field was filled out in the card, I'm seeing that appContext value passed into my smart app in the access token response (along with patient, access_token, scope, etc)

view this post on Zulip Patrick Haren (May 05 2019 at 11:14):

Thanks Kyle, I assume that this is by using the cds-hooks smart app in HSPC? Have you seen any way to specify the appContext for standalone app launching?

view this post on Zulip Kyle Neumeier (May 05 2019 at 11:47):

I assume that this is by using the cds-hooks smart app in HSPC

Yes, that's what I did: Went to HSPC Sandbox, launched "CDS Hooks Sandbox" from there.

Have you seen any way to specify the appContext for standalone app launching

I have not, I don't think I know enough to answer that. For reference though, here is relevant code in cds server sandbox:

https://github.com/cds-hooks/sandbox/blob/master/src/retrieve-data-helpers/launch-context-retrieval.js#L25

It looks like it makes a POST to ${fhirBaseUrl}/_services/smart/Launch with the appContext and gets back a launch_id. It then attaches this as the launch param to the launch url provided by the card.

view this post on Zulip Chuck Feltner (May 05 2019 at 12:40):

@Patrick Haren our FHIR server supports the appContext in the CDS Hooks SMART App launch if you would like to test that interaction.

view this post on Zulip Nancy Lush (May 05 2019 at 14:13):

Hi Chuck, we have a service with SMART web messaging. Will let you know when your endpoint is white listed in our service.


Last updated: Apr 12 2022 at 19:14 UTC