Case Study - Patient-Mediated EHR Integration

This case study features a nationwide research study that wished to leverage MyDataHelps Electronic Health Record (EHR) connectivity within its existing patient portal.


This case uses MyDataHelps Embeddables to take advantage of patient-mediated EHR connectivity and data services within a pre-existing patient portal. The MyDataHelps SDK enables access to patient EHR data from health providers, payers, and health devices like Fitbit. Users can log in, connect to their EHR provider, and retrieve patient-mediated data—all within an existing patient portal, without having to create a MyDataHelps account or interact with MyDataHelps apps directly.

Integrating the MyDataHelps EHR connectivity with the patient portal involves three steps:

  1. Participant management using the MyDataHelps REST API.
  2. Patient-mediated EHR data acquisition using OAuth.
  3. Data retrieval of the collected EHR data.

Participant Management

Since the patient portal has an existing user account system, it is not desirable for users to register separate accounts with MyDataHelps. Instead, the organization uses the MyDataHelps REST API to automatically create a MyDataHelps participant entity corresponding to each application user. All EHR data will be associated with the user’s corresponding MyDataHelps participant.

In this use case, participant entities are only created for users who choose to connect their EHR.

See MyDataHelps Embeddables for more information about automated participant management using the MyDataHelps REST API.

Patient-Mediated EHR Data Acquisition

The next step is allowing the user to initiate a connection to an EHR provider. Once this connection is established, MyDataHelps can retrieve EHR data from the provider on the user’s behalf, and associate that data with their MyDataHelps participant.

To do this, the organization incorporates the MyDataHelps SDK into the patient portal as described in MyDataHelps Embeddables.

Connecting to an EHR Provider

The steps to initiate the EHR connection are:

  1. Determine the MyDataHelps participant ID corresponding to the current user, as described in Participant Management.
  2. Using the participant ID, obtain a Participant Access Token from the MyDataHelps REST API. This unlocks SDK features for the current participant. For security reasons, this requires mediation by the application server.
  3. Get a list of external providers using the SDK, and let the user select which provider they wish to connect to.
  4. Use the selected provider’s ID from the list to initiate an EHR connection.
  5. The SDK natively redirects the user to the login page for the selected provider using OAuth. The user then enters their provider credentials, which is the “patient-mediated” part of the process.
  6. Once the user has successfully authenticated, they are redirected back to the client application. MyDataHelps is now authorized to retrieve data on their behalf from the EHR provider.

The SDK methods used in the above steps are SDK-specific. See the JavaScript SDK and iOS SDK topics for details.

The following example illustrates this process using the JavaScript SDK methods.

Reconnecting to an EHR Provider

Patient access to an EHR provider can be granted for a limited duration. If access to the EHR provider expires, the client application must prompt the user to repeat the authorization process. Any EHR data previously retrieved will continue to be associated with the MyDataHelps participant after EHR provider authorization expires, but new data after authorization expiration will not be accessible.

To see whether an EHR provider needs to be reauthorized, look for a status of Unauthorized in the participant’s list of connected accounts, available through the SDK. You may also wish to create a Segment for participants (using the Linked Account filter criteria Status:Needs Reconnect) to send these participants automated messages about their linked account status.

Managing the EHR Connection

Once the EHR connection is established, the client app can offer several management features through the MyDataHelps SDK, including:

  • Retrieving a list of connected accounts.
  • Determining when data was last retrieved from the EHR provider.
  • Requesting a data refresh.
  • Deleting a connection.

The SDK methods used in the above steps are SDK-specific. See the JavaScript SDK and iOS SDK topics for details.

Retrieving EHR Data

Once an EHR provider is connected to a participant, MyDataHelps will periodically retrieve EHR data and store it. This will continue until either the connection is deleted or authorization access has expired.

EHR data is available to the organization through scheduled data exports. These exports can be transferred to your SFTP server or viewed within the MyDataHelps Designer. See EHR Export for details. The export files are also available through the MyDataHelps REST API.

Health and Wellness Dashboard

Although dynamic display of EHR data is not currently supported through the API/SDK, MyDataHelps does offer a pre-built health and wellness dashboard that can be embedded in your application. Contact us for more information.

Fitbit Data

Although a participant can connect their Fitbit account using the same mechanism as they would an EHR, Fitbit data has separate export files, and is also available to query via the MyDataHelps REST API.

Project Setup

Several things need to be set up in the MyDataHelps project for all of this to work.