Blog

    SMART on FHIR App EHR Integration for Remote Care: The Standalone Launch

    By GauravAugust 5, 20269 mins read
    On this page

    SMART on FHIR app EHR integration for remote care starts from the patient's phone, not from the chart. When a remote-care app opens at home, no visit is in progress, no EHR screen hands it a launch identifier, and there is often no encounter to point at. That is a standalone launch.

    It is written for hospital CTOs and CIOs and for digital health founders building RPM and remote-care apps. You get the launch context, discovery, scopes, PKCE, token expiry, patient mismatches and the tests for each case.

    How does SMART on FHIR app EHR integration work for remote care?

    SMART on FHIR app EHR integration for remote care uses a standalone launch: the patient opens the app outside an EHR session, the app finds the authorization server, and the token returns a patient but no encounter. Agnotic Technologies requests only the context the server can grant and never invents an encounter id.

    Launching a remote-care app without an open visit?

    We use a standalone SMART launch, ask only for the context the server can give, and leave encounter-based launch to in-visit apps.

    The SMART App Launch guide distinguishes an EHR launch, where the EHR opens the app and passes the issuer and a launch identifier, from a standalone launch, where the user opens the app directly.

    • Who starts it: the patient, from the app, not from a button inside the chart.
    • What you send first: the app asks which FHIR server to use, or it already knows the one server this program uses.
    • What you do not receive: an encounter id from an EHR launch, because no visit is open.
    • What you may receive: a patient, after the patient authorizes the app.

    An EHR launch is the other path: the chart opens the app and passes the issuer and a launch identifier. Do not code the remote-care app as if that identifier will be there.

    What is in the launch context, and what is absent?

    After a standalone launch, the context is whatever the authorization server put in the token: typically the patient the user authorized. Agnotic reads those values and treats a missing encounter as missing, not as zero.

    • Present: the FHIR base URL you are allowed to call, and the patient id when the scope included the patient.
    • Absent: the encounter id an in-visit app would have been handed.
    • Absent: a user who is a clinician at a workstation, unless this app is for staff and you built that authorization on purpose.
    • Check: if the code branches on encounter, the remote-care path must have a branch that runs when encounter is empty.

    Writing a home reading onto an encounter that does not exist is how a standalone app corrupts a chart. Store the reading against the patient, with the device or the patient as the source.

    What should the app not assume?

    The app should not assume an open visit, a clinician sitting with the patient, or a launch parameter the EHR would have sent. Agnotic reviews the first screen so it still makes sense with only a patient id.

    • No 'current encounter' header.
    • No order entry that requires an encounter, unless you create a documented encounter for that purpose and say so.
    • No silent refresh that expects the EHR session to still be alive. The patient left the chart before they opened this app.

    How does a standalone launch move between the app and the servers?

    A standalone launch moves in three hops: the app reads the FHIR server's SMART configuration, sends the patient to the authorization server with its scopes and a PKCE challenge, and then calls the FHIR server with the token it receives. The token names the patient and carries no encounter.

    SMART standalone launch for a remote-care app: the app discovers the FHIR server's smart-configuration, sends the patient to the authorization server with launch/patient scopes and a PKCE challenge, receives a token with the patient id and no encounter, then reads and writes data for that patient only

    Each hop has its own failure. Discovery fails on a wrong base URL. Authorization fails on scopes the server will not grant. The FHIR calls fail when the app asks for a patient other than the one in the token.

    How does the app find the authorization server?

    The app finds the authorization server by reading the SMART configuration document published under the FHIR base URL. Agnotic reads the endpoints from that document at launch instead of hard-coding them in the app build.

    The discovery URL is the HL7 FHIR base URL with .well-known/smart-configuration appended, so the only value the app must hold per site is that base URL.

    • Base URL: one per program or per health system, held in app configuration.
    • Discovery: fetched at launch, so an endpoint change on the server side does not need an app release.
    • Failure: a discovery error stops the launch with a clear message, not a blank screen.

    Which scopes does a standalone patient launch request?

    A standalone patient launch requests launch/patient so the server establishes the patient, the patient-level resource scopes the program needs, and offline_access if the app must refresh without a new sign-in. Ask for less rather than more.

    SMART App Launch says a standalone app has no launch id and declares its context needs with scopes such as launch/patient. A refresh token is requested with offline_access, and the server decides which client types may receive one.

    • launch/patient: asks the server to set the patient context.
    • Resource scopes: read for the records the app displays, write only for the readings it creates.
    • offline_access: only if the server allows refresh tokens for a client of your type.
    • Not requested: launch/encounter, because a remote-care session has no encounter to give.

    Why does PKCE matter for a remote-care app?

    PKCE matters because a phone app cannot keep a client secret, so the code exchange needs another proof that the app which started sign-in is the one finishing it. SMART requires it of every app.

    SMART App Launch states that all SMART apps shall support PKCE, and that servers shall support the S256 code challenge method and shall not support the plain method.

    Generate the verifier on the device for each launch and discard it after the exchange. A verifier reused across launches gives up most of the protection.

    What should the app do when the token expires between readings?

    When the token expires, the app should refresh it if it holds a refresh token and send the patient back through sign-in if it does not. Readings taken in the gap wait on the device until a valid token exists.

    • Queue: readings captured offline keep their device time and are sent once the app has a token again.
    • Refresh failure: treat it as a sign-out, with a clear prompt, not as a silent retry loop.
    • Revocation: if the patient or the health system withdraws access, stop sending and say so.

    What if the token names a different patient from the one enrolled?

    If the token names a patient other than the one the program enrolled, the app stops before sending any reading. This happens when a caregiver signs in with their own account or when a patient has more than one portal record.

    • Compare: the patient id in the token against the enrolled patient id the program stores.
    • Mismatch: show the patient which record they signed in to and offer to sign in again.
    • Log: the mismatch, without the clinical data, so support can see the pattern.

    A worked example: a home blood pressure program

    A worked example: a cardiology program gives patients a cuff and an app. The patient opens the app at home, the app reads the health system's SMART configuration, and the patient signs in to the portal.

    The app asks for launch/patient, read access to the patient's record and write access for blood pressure Observations. The token comes back with a patient id and no encounter.

    Each reading is written as an Observation on that patient with the cuff as device. When the patient later opens a video visit from the clinic's own system, that is a separate EHR launch with its own encounter. The home app never borrows it.

    How do you test the standalone path?

    Test the standalone path with tokens that are missing an encounter, carry the wrong patient, have expired, or have been revoked. Each case should end in a defined screen and a log line, not a crash.

    • No encounter: the normal case, and every screen still works.
    • Wrong patient: the mismatch screen appears and no reading is sent.
    • Expired: refresh runs, or sign-in returns.
    • Revoked: the app stops sending and tells the patient why.

    Who owns registration, enrollment and support?

    Registration with each health system belongs to the app team, enrollment of patients belongs to the care program, and sign-in support belongs to whoever answers the patient's phone call. Write those three names down before launch.

    • App team: client registration, redirect addresses, scopes and the discovery base URL per site.
    • Care program: which patient id is enrolled and which device is issued.
    • Support: a script for sign-in failures and patient mismatches that does not ask for passwords.

    What are the common mistakes with SMART on FHIR in remote care?

    The common mistakes come from building the remote-care app as if it ran inside the chart. Each one fails the first time a patient opens the app at home.

    • Requiring an encounter: screens or writes that break when the token carries no encounter.
    • Hard-coded endpoints: authorization URLs built into the release instead of read from the SMART configuration at launch.
    • Asking for every scope: broad requests that the server refuses or that the patient will not approve.
    • Skipping the patient check: readings sent for whichever patient the token names, without comparing it to the enrolled patient.
    • Silent retry loops: an expired or revoked token retried in the background instead of a clear sign-in prompt.

    What does a standalone launch mean for your build plan?

    A standalone launch adds client registration per site, a discovery and sign-in flow, an offline queue and a support script to the build plan. Agnotic sequences them so registration with each health system starts early, because that step depends on the health system's own process.

    • Registration: redirect addresses, scopes and the base URL for each health system the program serves.
    • Sign-in flow: discovery, PKCE, the token exchange and the patient check.
    • Data path: Observations written on the patient with the device as source, and readings queued while offline.
    • Support: the scripts and log lines that let staff help a patient without seeing clinical data.

    How does Agnotic build the standalone launch?

    Agnotic registers the app for standalone launch, requests the patient scope the program needs, and keeps encounter logic off this path. On-device storage rules and the move from sandbox to production are planned as their own steps.

    Tell us the FHIR server and whether the user is the patient. We will launch standalone, and we will not require an encounter the server did not send.

    Launch without an encounter

    A standalone SMART launch, a patient when the server grants one, and no invented visit.

    Sources

    Frequently Asked Questions

    An EHR launch starts from the chart and passes a launch identifier. A patient at home did not open the chart. Standalone launch starts from the app.

    Talk to an engineer about your project

    Tell us the FHIR server and whether the user is the patient. We will use a standalone launch and leave encounter logic to in-visit apps.