Participants frequently have accounts with services external to MyDataHelps, such as their provider’s EHR, their health plan, or their wearable device manufacturer. For more information see the data overview. MyDataHelpsKit provides tools for your app to allow participants to link MyDataHelps to their external account(s), and to manage that link once it’s been established.
In the MyDataHelpsKit SDK, ExternalAccountProvider
identifies a provider supported by MyDataHelps, while ExternalAccount
represents a specific connection a participant has established to a provider within MyDataHelps.
Contents
Construct an ExternalAccountProvidersQuery
to specify filtering criteria, and execute the query using ParticipantSession.queryExternalAccountProviders
. This query returns an ExternalAccountProvidersResultPage
containing ExternalAccountProvider
values.
Your app can use this query to construct a keyword search interface or categorized list view. Consult the programming guide for best practices on working with queries, search, and and paged results in MyDataHelpsKit.
See External Account Connections for using ExternalAccountProvider
data to implement a full account connection user experience in your app.
ExternalAccountProvidersQuery
ParticipantSession.queryExternalAccountProviders(_:)
ExternalAccountProvidersResultPage
ExternalAccountProvider
let criteria = ExternalAccountProvidersQuery(search: "CareEvolution", category: .provider)
let result = try await session.queryExternalAccountProviders(criteria)
for provider in result.externalAccountProviders {
print(provider.name)
}
let criteria = ExternalAccountProvidersQuery(search: "CareEvolution", category: .provider)
let result = try await session.queryExternalAccountProviders(criteria)
for provider in result.externalAccountProviders {
print(provider.name)
}
In the MyDataHelpsKit example app, see:
ParticipantSession.listExternalAccounts
fetches a list of all of the participant’s connected external accounts. This API is not paged: all of the available accounts are returned in a simple array.
ParticipantSession.listExternalAccounts()
ExternalAccount
ExternalAccountProvider
ExternalAccountStatus
let accounts = try await session.listExternalAccounts()
for account in accounts {
print("Account for \(account.provider.name): \(account.status)")
}
let accounts = try await session.listExternalAccounts()
for account in accounts {
print("Account for \(account.provider.name): \(account.status)")
}
In the MyDataHelpsKit example app, see:
ParticipantSession.refreshExternalAccount
requests the refresh of data from a connected external account.
This API only begins the process of refreshing an account; the process may take additional time to complete. To track the status of a refresh, use ParticipantSession.listExternalAccounts
to poll the status value of an account, checking for fetchingData
or fetchComplete
status values.
do {
// account is from the "Retrieving External Accounts" example above.
try await session.refreshExternalAccount(account)
print("Refresh initiated.")
} catch {
print("Error refreshing account: \(MyDataHelpsError(error))")
}
do {
// account is from the "Retrieving External Accounts" example above.
try await session.refreshExternalAccount(account)
print("Refresh initiated.")
} catch {
print("Error refreshing account: \(MyDataHelpsError(error))")
}
In the MyDataHelpsKit example app, see:
ParticipantSession.deleteExternalAccount
deletes an external account.
do {
// account is from the "Retrieving External Accounts" example above.
try await session.deleteExternalAccount(account)
print("Account connection deleted.")
} catch {
print("Error deleting account connection: \(MyDataHelpsError(error))")
}
do {
// account is from the "Retrieving External Accounts" example above.
try await session.deleteExternalAccount(account)
print("Account connection deleted.")
} catch {
print("Error deleting account connection: \(MyDataHelpsError(error))")
}
In the MyDataHelpsKit example app, see: