
Options for Fetching User and Location Info at EPIC SMART on FHIR App Launch
In this blog, we share how we can fetch user and department, etc information from Epic.
So there are four ways we can get the provider information, department/location information in SMART on FHIR launched in the Epic environment.
1. Helper API (For versions `Epic 2018` and later):
For versions `Epic 2018` and later a private helper API is available that can be used to get the authenticated user’s information from the SMART on FHIR app.
This API is only available in the Garden and Terrace programs. https://apporchard.epic.com/Sandbox/Index?api=488
2. Fetch Encounter FHIR Resource (For versions earlier than Epic Nov 2019):
At launch time, the patient context and encounter context is passed on to the SMART app. One can fetch the Encounter resource and from there can fetch the practitioner, department/location, diagnosis, etc. There is a cost of 0.9 cents for the encounter resource read API call.
3. Token Library ie Context Tokens (For versions earlier than Epic Nov 2019):
Epic allows hospitals to configure different tokens from its Token Library. One can select any number of these tokens that get passed to a SMART app at launch time and there is no extra Epic charges for including these tokens, initially or on each launch. However, the hospital where the app will be hosted will require these tokens to be configured for your SMART app.
Some of the tokens that we can use are as following:
A: For Getting the Department:
%ENCDepID% (For Department of the order/encounter)
Or %ENCFACDEA% For DEA # of Encounter Department
Or %ENCFACNPI% NPI of the Encounter Department.
Or %ENCFACNPINAME%. Patient Encounter Department Name
B: For Getting User Name:
%USERFNAME%, %USERLNAME%
C: For User NPI
%USERPROVNPI%
D: User ID For Non NPI users
%UserProvID%
E: Provider Type/Role
%UserProvType%
Please note that this option is only available with the EHR Launch of Epic with OAuth2 Context Tokens.
Here is the detail of all the tokens available that can be passed in.
https://apporchard.epic.com/Article?docId=Launching
4. ID_TOKEN (For Epic versions `November 2019` and later):
A: access token
B: id_token
id_token is only available in versions `November 2019` and later.`id_token` is passed to the application that can be used to retrieve the authenticated user’s information without calling any API.
This JWT token, when decrypted gives us following info:
“profile”:”Practitioner/smart-Practitioner-71032702″
“fhirUser”:”Practitioner/smart-Practitioner-71032702”