Panduan Cloud, Backend & Full Stack Engineer: Orkestrasi Telehealth Video Azure Communication Services (ACS) & Medplum FHIR
Spesialisasi Rekayasa Perangkat Lunak: Ditulis oleh Aldian Fazrihady — Senior Cloud Engineer, GCP Professional Cloud Architect, GCP Professional Data Engineer, Backend Engineer, AI Application Engineer & Full Stack Engineer.
1. Arsitektur Telehealth Berstandar HIPAA dengan Azure Communication Services (ACS) dan Medplum FHIR
Mengintegrasikan panggilan video real-time ke dalam platform kesehatan membutuhkan sinkronisasi ketat antara siklus hidup panggilan WebRTC di Azure Communication Services (ACS) dan model data klinis HL7 FHIR (Appointment, Encounter, Practitioner, dan Patient) di Medplum.
2. Penerbitan Token Identitas ACS di Backend & Manajemen State WebRTC di React/TypeScript
Sebagai Cloud Engineer, Backend Engineer, dan Full Stack Engineer, token akses ACS harus diterbitkan secara on-demand di sisi server dengan masa berlaku terbatas dan diikat ke referensi FHIR pengguna. Berikut adalah implementasi arsitektur dan kodenya:
import { AzureCommunicationTokenCredential } from '@azure/communication-common';
import {
CallWithChatComposite,
FluentThemeProvider,
createAzureCommunicationCallWithChatAdapter
} from '@azure/communication-react';
const joinCall = useCallback(async (): Promise<void> => {
if (!accessToken || !acsGroupId || !acsChatThreadId || !userId || !endpoint) return;
setLoading(true);
try {
const tokenCredential = new AzureCommunicationTokenCredential(accessToken);
const locator = {
callLocator: { groupId: acsGroupId },
chatThreadId: acsChatThreadId,
};
// Create unified ACS adapter
const callAdapter = await createAzureCommunicationCallWithChatAdapter({
userId: { communicationUserId: userId },
displayName: patientName || 'Patient',
credential: tokenCredential,
endpoint,
locator,
});
// Initially join with camera and microphone muted
callAdapter.joinCall({ cameraOn: false, microphoneOn: false });
setAdapter(callAdapter);
setStep('waiting');
} catch (err) {
console.error('Failed to bootstrap ACS Adapter:', err);
setError('Failed to initialize session.');
} finally {
setLoading(false);
}
}, [accessToken, acsGroupId, acsChatThreadId, userId, endpoint]);
useEffect(() => {
if (!adapter || step !== 'waiting') return;
const onParticipantsJoined = (): void => {
// Clinician joined - launch camera, unmute local mic, and start call
adapter.startCamera().catch(console.error);
adapter.unmute().catch(console.error);
setStep('active-call');
// Start call duration timer
setElapsedSeconds(0);
timerRef.current = setInterval(() => {
setElapsedSeconds(prev => prev + 1);
}, 1000);
};
adapter.on('callParticipantsJoined', onParticipantsJoined);
return () => {
adapter.off('callParticipantsJoined', onParticipantsJoined);
};
}, [adapter, step]);
useEffect(() => {
if (step !== 'post-call' || !appointmentId) return;
const fetchClinicalNotes = async (): Promise<void> => {
setLoadingNotes(true);
try {
const response = await fetch(botLambdaUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'get-appointment-documents',
appointmentId,
}),
});
const data = await response.json();
if (data.success) {
const notes = data.documents
.filter((d: any) => d.type === 'clinical-note')
.map((d: any) => ({
id: d.id,
title: d.title,
textContent: d.textContent,
date: d.date,
}));
setClinicalNotes(notes);
}
} catch (err) {
console.error('Failed to sync appointment notes:', err);
} finally {
setLoadingNotes(false);
}
};
fetchClinicalNotes().catch(console.error);
}, [step, appointmentId]);
Ringkasan Arsitektur Produksi & Praktik Terbaik (Checklist Teknis)
- Keandalan & Observabilitas Produksi: Setiap implementasi wajib dilengkapi metrik latensi P50/P95/P99, penanganan kegagalan idempoten, dan pengujian otomatis di CI/CD.
- Keamanan & Isolasi Least-Privilege: Validasi seluruh input eksternal, gunakan enkripsi standar industri, dan terapkan prinsip hak akses minimum pada layanan cloud maupun penyimpanan lokal.
- Konsultasi & Implementasi 1 Hari: Butuh bantuan mengimplementasikan arsitektur ini di sistem produksi Anda? Pesan Layanan Pemrograman 1 Hari (Rp 1.000.000 via QRIS / Virtual Account atau $100 USD) atau hubungi melalui Upwork.