Epic / FHIR / JWKS

Enterprise integration reference

Read-only FHIR for governed trial execution. How Damaros clinic nodes connect to Epic through SMART Backend Services: JWT assertions, JWKS discovery, cohort-scoped evidence, deterministic screening, and replay lineage. For integration teams, security reviewers, and sponsor diligence.

Damaros Runtime
00SCOPE

Document scope

Damaros connects to Epic as a Backend Systems application. Integration is read-only by default, cohort-scoped, and server-side only. This page covers authentication, JWKS, requested scopes, sync behavior, clinical boundaries, audit, and cutover posture.

IN_SCOPEOAuth flow, JWT assertions, JWKS URLs and rotation, FHIR scopes, sync model, data minimization, network egress, replay provenance
OUT_OF_SCOPECustomer Epic client IDs, private signing PEM, internal service topology, hospital-specific firewall rules
RUNTIMEEligibility verdicts are deterministic. PHI never reaches an LLM. See Damaros Runtime.
01OPERATING MODEL

Research execution on approved cohorts

Damaros is trial-capable care infrastructure. Site-approved FHIR binds locked protocol logic to a defined cohort, evaluates eligibility deterministically, and preserves criterion-level evidence on one audit path.

Deterministic core. Versioned protocol logic plus normalized clinical facts feed one eligibility engine. PASS, REVIEW, or FAIL at criterion granularity. No generative verdict on the screening path.

Trident compiles protocols. Luna makes every AI step inspectable. Neither issues eligibility verdicts.

No shadow EHR. Evidence ends in protocol-scoped screening artifacts. Epic remains system of record for longitudinal care.
02SYNC PIPELINE

FHIR sync to screening

Resolve cohort Fetch patient bundle Normalize facts Deterministic screen Replay record
COHORT_ENTRYGET Group/{id} resolves Epic-approved trial evidence list membership
PATIENT_BUNDLEPatient-scoped searches for Observation, Condition, MedicationRequest, Procedure, AllergyIntolerance, DocumentReference metadata
SEARCH_DISCIPLINEEpic-tuned searches per resource type. Not a full-chart bulk extract.
NORMALIZATIONOnly contract-mapped structured fields persist for evaluation. Unmapped FHIR fields are discarded before screening.
BULK_EXPORTOptional read-only bulk export where institution enables it. Same normalization and minimization rules apply.
PROVENANCEResource IDs, retrieval timestamps, and cohort snapshot ID attach to the replay bundle
03OAUTH FLOW

Backend Services token exchange

Production uses SMART on FHIR Backend Services. Damaros signs a short-lived JWT client assertion, posts it to Epic's token URL, and receives an access token. PKCE does not apply to Backend Systems. User-facing OAuth and browser token storage are not used for FHIR access.

Load signing key Build JWT assertion POST token URL Cache access token Read-only FHIR calls
GRANT_TYPEclient_credentials
CLIENT_ASSERTION_TYPEurn:ietf:params:oauth:client-assertion-type:jwt-bearer
ASSERTION_TTLexp within 300 seconds of iat; access token TTL from Epic; in-memory cache only
TOKEN_STORAGEServer-side process memory only. Never in browsers, localStorage, or client bundles.
REQUIRED_CLAIMSiss, sub (Epic client ID), aud (token URL), jti, iat, exp
HEADERalg (RS384 default), kid matching published JWKS entry, typ JWT
Illustrative token request body. Placeholder values only.
POST /oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials
&client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer
&client_assertion=<signed JWT>
Illustrative client assertion header and payload. Not for auth.
// Header
{ "alg": "RS384", "kid": "epic-prod-2026-04", "typ": "JWT" }

// Payload (claims abbreviated)
{
  "iss": "<Epic Backend Services client ID>",
  "sub": "<Epic Backend Services client ID>",
  "aud": "https://fhir.epic.com/interconnect-fhir-oauth/oauth2/token",
  "jti": "d7f3a1b2-4c8e-4f91-9a2d-1e6b0c8d4f2a",
  "iat": 1748736000,
  "exp": 1748736300
}
04PLATFORM ARCHITECTURE

Integration architecture summary

APPLICATION_AUDIENCEBackend Systems (Epic-registered Backend Services app)
PRIMARY_OAUTH_MODELclient_credentials + JWT client assertion to Epic token URL
FHIR_VERSIONR4
AUTH_STANDARDSMART on FHIR Backend Services (RFC 7523)
JWT_ALGORITHMRS384 (override via deployment config if Epic requires)
COHORT_RESOLUTIONGET Group/{id} for Epic-approved trial evidence lists
DEFAULT_ACCESSRead-only FHIR; no EHR write-back unless explicit env gates are set
EXECUTION_CHAINProtocol → Evidence → Screening → Replay on governed cohort snapshots
TRANSPORTTLS 1.2+ for all FHIR and OAuth traffic
05JWKS AND KEYS

Environment separation, JWKS hosting, and rotation

Epic validates Damaros client assertions against public keys published in JWKS documents. Private signing material never leaves secret stores. Public keys are the only cryptographic material exposed on the wire or in public JSON.

NON_PRODUCTIONSeparate Epic sandbox client ID, signing keypair, and JWKS URL
PRODUCTIONIndependent Epic production client ID, signing keypair, and JWKS URL
JWKS_NONPROD_URLhttps://www.damaros.ai/.well-known/jwks-nonprod.json
JWKS_PROD_URLhttps://www.damaros.ai/.well-known/jwks-prod.json
JWKS_HOSTINGPublic JWKS documents served over HTTPS from Damaros-controlled DNS and TLS
JWKS_CONTENTPublic RSA keys only: kty, use, alg, kid, n, e. No private material, no certificates unless required by registrar.
SECRET_STORAGEPrivate signing PEM from secret manager or secure mount; never in git, CI logs, or client bundles
ASSERTION_KIDJWT header kid must match a published JWKS entry for the active environment
KEY_LENGTHRSA 2048-bit minimum for new keypairs
Rotation protocol. (1) Generate new keypair in secret store. (2) Append public key to JWKS with new kid. (3) Confirm Epic resolves the new key. (4) Switch signing to new kid. (5) Retire prior public key after overlap window. Never remove the incumbent key before Epic confirms the successor.
Illustrative JWKS document. Fictitious modulus, not for auth.
{
  "keys": [{
    "kty": "RSA",
    "use": "sig",
    "alg": "RS384",
    "kid": "epic-prod-2026-04",
    "n": "1tCLz4Y...TRUNCATED...lpUmU3w",
    "e": "AQAB"
  }]
}
Rotation-ready JWKS. Two overlapping keys.
{
  "keys": [
    { "kid": "epic-prod-2026-04", "alg": "RS384", "..." },
    { "kid": "epic-prod-2026-10", "alg": "RS384", "..." }
  ]
}
06OAUTH SCOPES

Initial requested scopes

An OAuth floor of eight system/*.read scopes covers the per-patient eligibility bundle plus cohort membership via GET Group/{id}. No write scopes on first deployment. The connector never calls FHIR Binary; DocumentReference ingest keeps metadata only.

EXCLUDEDAll write scopes, system/Binary.read, user-facing SMART scopes, offline refresh tokens in browsers
RATIONALEEligibility runs on structured fields the protocol maps. Narrative and attachment content are out of scope for deterministic screening.
No Binary. Epic registration omits Binary web services and any Binary read scope.
07RESOURCE HANDLING

FHIR resource handling and minimization

PatientDemographics and identifiers needed for cohort binding and criterion evaluation. Stored per deployment retention policy.
GroupCohort membership resolution only. Not used as a longitudinal record.
ObservationStructured lab and vital values mapped to protocol facts. Reference ranges and coded values preferred over free text.
ConditionActive and problem-list diagnoses mapped to protocol concepts. Uncoded text triggers REVIEW where mapping is ambiguous.
MedicationRequestOutpatient orders relevant to inclusion or exclusion windows.
ProcedureHistorical procedures referenced by criteria.
AllergyIntoleranceStructured allergy entries via patient-scoped search.
DocumentReferenceMetadata only: type, date, status, identifiers. No Binary retrieval. No narrative body storage for screening.
08CLINICAL DATA BOUNDARY

Clinical data boundary

09AUDIT AND REPLAY

Audit, determinism, and replay

10SECURITY AND LOGGING

Security, privacy, and logging

11EPIC REGISTRATION

Epic app registration posture

Each deployment registers as a Backend Systems application in Epic App Orchard or the institution's equivalent process. Registration lists the JWKS URL, requested scopes, and Backend Services audience. Sandbox and production registrations remain separate.

APP_TYPEBackend Systems / confidential client with JWT assertion
JWKS_URIEnvironment-specific URL registered with Epic
REDIRECT_URISNot used for Backend Services FHIR access
WRITE_APISNot requested on initial deployment
BINARYNot registered
12VALIDATION CUTOVER

Validation to production cutover

Validation and production share the same eligibility engine, protocol compiler, and replay model. Sandbox FHIR credentials, JWKS URLs, and signing keys stay isolated from production. Retrospective validation runs produce replay artifacts that carry the same structure sponsors expect in live operations.

Cutover is a credential and environment swap, not a workflow rebuild. Integration teams verify token exchange, cohort resolution, scope coverage, and replay completeness in sandbox before production JWKS and client IDs are activated.

13RELATED DOCUMENTS

Related documents

14CONTACT

Contact

Website    damaros.ai
JWKS (prod)    /.well-known/jwks-prod.json
JWKS (sandbox)    /.well-known/jwks-nonprod.json
Integration    [email protected]