Patient DB
medent FHIR
Epic Sandbox
Nutrition Care Program
🏥 3 clinics
Patient pipeline
Routing: Clinic assigned at DB pull Β· EHR determined per patient
Step β‘ 
Patient DB
Pull records
β†’
Step β‘‘
medent FHIR
Name+DOB+Ins/MRN
β†’
Step β‘’
Nutrition Care Program
Enroll patient
↔
Step β‘£
Notes writeback
PDF β†’ Program EMR + EHR
In DB
0
Matched
0
No match
0
Enrolled
0
Notes back
0
DB IDNameClinic β†’ EHRDOBIns. IDConditions EHR matchConfidenceProgramNotes
PDF notes written back to Program EMR + EHR DocumentReference
No notes yet β€” run the pipeline first
Clinic directory β€” EHR routing
Field mapping β€” both EHR targets
β‘  Patient DB β†’ middleware
db.first_name + last_name→match.namekey 1
db.date_of_birth→match.dobkey 2
db.insurance_id (optional)β†’match.insuranceIdkey 3 if present
db.mrn (optional)β†’match.mrndeterministic key
medent β‘‘ FHIR patient search + confidence scoring
GET /Patient?family={ln}&given={fn}&birthdate={dob}β†’candidatesbase +25 pts
Patient.identifier[mrn] == db.mrn→+40 ptsdeterministic
Patient.identifier[insurance] == db.insId→+35 pts (if present)confirmatory
score β‰₯70 β†’ matched Β· 50–69 β†’ review Β· <50 β†’ unmatchedβ†’matchStatusthreshold
Auth: RS384 JWT β†’ POST /token/index.php?medent_practice_id=…→Bearer token (300s)per MEDENT docs
POST {medentBase}/DocumentReference→medent patient chartwriteback
Epic β‘‘ Sandbox FHIR patient search + confidence scoring
GET /Patient?family={ln}&given={fn}&birthdate={dob}β†’candidatesbase +25 pts
Patient.identifier[MR] == db.mrn→+40 ptsMR identifier type
Patient.identifier[MB/SN] == db.insId→+35 pts (if present)MB=Medicare/SN=subscriber
score β‰₯70 β†’ matched Β· 50–69 β†’ review Β· <50 β†’ unmatchedβ†’matchStatussame threshold
Auth: JWT assertion β†’ POST /oauth2/token (Backend Services)β†’Bearer tokenRS384 JWT
Sandbox base: fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4β†’all FHIR callssandbox
POST {epicBase}/DocumentReference→Epic patient chartwriteback
β‘’ Middleware β†’ Nutrition Care Program (same regardless of EHR)
patient.fhirId→sylvan.externalEhrIdcross-ref key
patient.ehrSystem ('medent' | 'epic')β†’sylvan.externalEhrSystemrouting metadata
patient.name · dob · mrn · conditions · payer→sylvan enrollment payloadintake context
β‘£ Notes writeback β€” PDF as FHIR DocumentReference (same FHIR resource, different base URL)
sylvan PDF bytes (base64)β†’content[0].attachment.datainline PDF
LOINC 11488-4β†’type.coding[0].codeConsult note
LOINC LP29684-5β†’category[0].coding[0].codeNutrition & dietetics
patient.fhirId→subject = "Patient/{id}"patient link
medent: POST medentfhir.com/…/DocumentReferenceβ†’medent chartmedent FHIR
Epic: POST fhir.epic.com/…/api/FHIR/R4/DocumentReferenceβ†’Epic chartEpic sandbox
API trace
live