EXAMPLE RUNPopular
Patient Data Synchronization – Run
Run the example to sync patient demographics between your system and Mediloop.
Language
TypeScript
Use case
Patient data
Complexity
Intermediate
Updated
May 12, 2024
Overview
Code
Setup
Run
Output
Error handling
1. Execute the example
WindowsmacOS / LinuxDocker
shellCopy
$ npx ts-node index.ts2. Execution progress
In progressInitializing
SDK initialized
00:02
Authenticating
Access token acquired
00:01
Fetching patients
Retrieving patient data
00:04
4
Synchronizing
Sending data to Mediloop
00:05
5
Completed
Finalizing summary
—
Live logs
liveCopy
10:24:01 [INFO] Initializing Mediloop Connector SDK v2.3.1
10:24:02 [INFO] Environment: Sandbox
10:24:02 [INFO] Authenticating...
10:24:03 [INFO] Authentication successful
10:24:03 [INFO] Fetching patients (page 1)
10:24:06 [INFO] Retrieved 50 patients
10:24:06 [INFO] Syncing batch 1/5
10:24:09 [INFO] Batch 1 completed (50/250)
10:24:12 [INFO] Syncing batch 3/5
10:24:15 [INFO] Batch 3 completed (150/250)3. API activity
POSThttps://api.mediloop.com/v1/patients/sync
AuthorizationBearer mlp_••••••••••••
Content-Typeapplication/json
Idempotency-Key9f8b7a6c-3e2d-4b1a-9c7d-...
X-Mediloop-Tenantyour_tenant_id
200 OKCopy
{
"status": "success",
"summary": {
"created": 35,
"updated": 182,
"skipped": 8,
"errors": 0,
"totalProcessed": 225
}
}