EXAMPLEPopular
Patient Data Synchronization
Sync patient demographics and identifiers between your system and Mediloop using the Connector SDK.
Language
TypeScript
Use case
Patient data
Complexity
Intermediate
Updated
May 12, 2024
Overview
Code
Setup
Run
Output
Error handling
About this example
This example demonstrates how to:
Authenticate with Mediloop APIs
Create or update patient records
Search and retrieve patient data
Handle pagination and errors
It uses the Mediloop Connector SDK for TypeScript.
Prerequisites
Node.js 18+
Mediloop account
API key with patient:write scope
Files in this example
index.ts
.env.example
package.json
tsconfig.json
README.md
index.ts
CopytypescriptCopy
import { MediloopClient } from '@mediloop/connector-sdk';
const client = new MediloopClient({
baseUrl: process.env.MEDILOOP_BASE_URL!,
apiKey: process.env.MEDILOOP_API_KEY!,
timeout: 30000,
});
async function upsertPatient() {
const patient = await client.patients.upsert({
externalId: 'ext-12345',
firstName: 'John',
lastName: 'Doe',
birthDate: '1980-01-01',
gender: 'male',
});
console.log('Patient synchronized:', patient.id);
}
upsertPatient();Language TypeScriptSDK Version 2.3.x (LTS)Lines of code 25
Setup
1 Install dependencies
npm install @mediloop/connector-sdk
2 Configure environment
MEDILOOP_API_KEY=...
3 Run the example
npx ts-node index.ts
Tip
Use the sandbox environment during development to avoid affecting production data.