Not legal advice.
Build Around the EHR, Not Instead of It: Safe Patterns for Physician-Built Tools
Last reviewed:
A physician-built tool does not need to become a new medical record system to be useful. A focused view, intake-review screen or encounter-preparation workspace can be designed around the organization's existing record system.
Start with the task and name the authoritative source for each piece of information. This article recommends keeping the established EHR as the clinical system of record unless the organization explicitly approves another arrangement. That is a design recommendation, not a universal rule.
FHIR is not a safety certificate
HL7 states that FHIR is not a security protocol. Its security guidance addresses authentication, access control, protected communications, auditing and implementer responsibilities. Selecting FHIR does not, by itself, make a tool secure or HIPAA compliant. [1]
SMART App Launch provides OAuth-based patterns for connecting applications to FHIR systems. User-facing launch can carry context such as a selected patient; backend services use a different authorization pattern without a user directly launching the app. Do not treat these as interchangeable shortcuts. [2]
Pattern 1: a narrow, read-only view
Consider a first release that reads only the data required for a defined task and does not write to the chart. A proposed encounter-preparation view could show selected observations with source dates and send users back to the EHR to confirm information or act.
SMART scopes describe delegated permissions. SMART 2.2 gives user/Encounter.rs as a read/search example for encounters accessible to the authorizing user and system/Encounter.rs for a backend service. Scope syntax differs across versions: these are examples, not universal integration strings. [2]
Verify the target server's supported resources, operations, scope syntax and actual granted permissions. Request only the approved workflow's data, not broad system or write access for hypothetical future features.
Read-only still carries disclosure and handling risks. HL7 warns that HTTP logs, including URLs, may contain sensitive record information. Review caches, exports and telemetry, not just the main database. [1]
Pattern 2: intake explicitly awaiting review
For an intake companion, propose a pending-review state rather than treating a submission as a reconciled chart fact. Show who supplied the information, submission time and review status. Make correction and confirmation explicit.
Do not let “submit” silently mean “replace the medication list” or “create a signed note.” If filing is later approved, specify the target record, responsible reviewer and treatment of conflicts before writing code. These are proposed clinical safeguards, not guarantees.
A first version may hand off to an existing review process rather than write automatically. Test whether the handoff loses submissions or creates duplicate work. Assign ownership for exceptions; an intake form without an owned destination is not a complete workflow.
Pattern 3: an EHR-launched workspace with visible context
SMART distinguishes access permissions from launch context about the current patient or session. Launching inside an EHR is not blanket entitlement to every record. [2]
Propose visible patient identity, clearing previous results on context changes, binding each response to its request's patient/encounter and rejecting a delayed response after a patient switch. Stop when context is absent or ambiguous rather than guessing. Test tab reuse, logout and interrupted sessions using fabricated records.
Epic's LaunchPad guidance describes SMART sandbox testing and a further round of testing in an interested organization's environment, potentially with additional context. A successful sandbox launch is not evidence of readiness for that organization's workflow. [3]
Pattern 4: reviewed draft output
For generated summaries or draft notes, propose clear separation from accepted chart content, relevant source references/dates, visible missing information and an accountable user's acceptance before any approved filing step. These are suggested controls, not evidence that an output is correct.
Do not let a display feature quietly become autonomous ordering or record reconciliation. Treat a change in intended use or action authority as a new review decision. This article does not determine medical-device classification.
Use a read-to-write gate
| Question | Evidence to request |
|---|---|
| Is the operation supported here? | Target-environment documentation, enabled permissions, organization approval |
| Where will content land? | Exact resource/field mapping, status, author/reviewer behavior |
| What prevents the wrong chart? | Patient/encounter binding tests including rapid switches |
| What happens after a timeout? | Reconciliation procedure preventing blind retries/duplicate filing |
| How are corrections handled? | Approved correction/retraction workflow and owner |
| Can users continue without the tool? | Rehearsed downtime and escalation instructions |
These are proposed acceptance questions, not built-in FHIR guarantees. HL7 makes implementers responsible for appropriate security and regulatory handling; AuditEvent and provenance capabilities are building blocks, not proof of sufficient implementation. [1]
Map the rest of the stack
An EHR token does not contractually cover your host, database, model provider or error tracker. Map every recipient and retention point. Where a BAA is required, establish signed service-specific coverage. HHS pairs cloud BAAs with other HIPAA obligations, including risk analysis and management. [4]
Consider keeping model calls out of a first release until purpose, permitted data and review are explicit. If needed, document endpoint, intermediary, retention and feature settings. Do not paste real charts into a coding assistant to debug the integration.
Define failure before success
Propose tests for expired authorization, denied access, unavailable services, partial results, stale observations, unfamiliar units and delayed responses. Decide which conditions stop the task and which allow a clearly labeled partial view. “No data returned” should not casually become “nothing is wrong.”
Have intended users rehearse those cases. Name owners for support, access review, incidents and EHR changes. Agree on disabling conditions and the return to established workflow. The practical goal is a useful, bounded physician-designed tool—not a claim that an API connection or a BAA proves the product safe.
Official citations
[1] HL7 FHIR R4 security. [2] SMART App Launch 2.2 overview. [3] Epic LaunchPad. [4] HHS cloud guidance.
See Fabrica and book a 30-minute call
A free 30-minute call about your app or your practice's technology. You leave with a recommended next step. It is not an audit, a certification or legal advice.