DEV Community

Cover image for Telemedicine at Scale: Architecting a HIPAA-Compliant, AI-Enabled Microservices HMS
Nzcares
Nzcares

Posted on

Telemedicine at Scale: Architecting a HIPAA-Compliant, AI-Enabled Microservices HMS

Not Every Hospital Looks Like an App—Until It Has To

Most hospitals weren’t built for real-time video consults, AI chatbots, or cloud-native operations.

But telemedicine changed that.

Healthcare software today juggles multiple systems, global compliance, and non-stop uptime—making it more than just a tech project. It’s an architectural challenge.

In India alone, 140M+ teleconsults have already taken place on eSanjeevani.
Telemedicine is no longer optional.

Microservices: Not Because It’s Trendy—Because It’s Necessary

When you’re processing video consults, generating prescriptions, syncing EMRs, and handling patient bills—tight coupling is a death trap.

We broke the hospital management system into the following services:

services:
  patient-service:
  doctor-service:
  billing-service:
  emr-service:
  teleconsult-service:
  ai-triage-service:
  prescription-service:
Enter fullscreen mode Exit fullscreen mode
  • Services communicate via an internal API Gateway
  • Kafka handles asynchronous events (e.g. appointment booked → EMR + email update)

Decouple the chaos. Scale what matters. Leave the rest alone.

HIPAA Isn’t a Checkbox—It’s a Core Architecture Principle

If your system touches PII, you’re liable. HIPAA isn’t an afterthought.

Minimal HIPAA Dev Checklist:

  • AES-256 encryption for all data at rest
  • HTTPS-only traffic
  • OAuth2 with RBAC
  • Audit logs for every action
  • Mask sensitive values in logs
  • Rotate keys regularly

We also added:

  • Real-time logging using ELK stack
  • Append-only logs for GDPR events
  • Slack alerts for abnormal behavior (e.g. HR accessing EMR at 3AM)

AI That Actually Helps (Not Just Claims to Replace Doctors)

We built an AI-powered teleconsultation platform with practical tools for clinicians—not gimmicks.

Real-world Use Cases:

  • Symptom Checker → Triage patients & auto-suggest specialists
  • SOAP Generator → Converts doctor’s input into structured clinical notes
  • Compliance Reminders → Auto-remind patients post-treatment

NZCares telemedicine software screenshot
Example API:

@app.post("/check-symptoms")
def analyze(text: str):
    doc = nlp(text)
    symptoms = [ent.text for ent in doc.ents if ent.label_ == "SYMPTOM"]
    return {"symptoms": symptoms}
Enter fullscreen mode Exit fullscreen mode

Real-Time Video via WebRTC + Live SOAP Notes

We used WebRTC for doctor-patient calls, backed by Coturn + Kubernetes ingress.

Fallback to relay servers in low-bandwidth areas.

Transcriptions handled by OpenAI Whisper, then parsed into:

  • Subjective
  • Objective
  • Assessment
  • Plan

Doctors can edit it. No one likes being locked in by an AI guess.

CI/CD & DevOps: Make It Fast, Make It Safe

Every microservice had its own:

  • GitHub repo
  • CI pipeline (GitHub Actions)
  • Docker → Helm → K8s

Deployment Strategy:

  • Argo Rollouts for canary deployments
  • Mozilla SOPS for encrypting secrets in Git
  • Configs decrypted during pipeline using GCP KMS

Data-Driven Care: More Than Just Logs

Every interaction emits structured events:

{
  "event": "video_consult_started",
  "doctor_id": "d235",
  "patient_id": "p493",
  "timestamp": "2025-06-19T09:03:21Z"
}
Enter fullscreen mode Exit fullscreen mode

Dashboards powered by Grafana + Prometheus.

What We Tracked:

  • No-show patterns
  • Department-wise delay metrics
  • Doctor efficiency
  • Pharmacy restocking forecasts

Failure Is Not an Exception—It’s a Constant

Telemedicine systems fail. That’s not the point.
The point is whether you recover fast.

Our biggest saves:

  • Kafka topic overflow (bad cron job)
  • SMS gateway outage on vaccination day
  • Video call dropped due to bad ingress config

Our Recovery Stack:

  • Hystrix circuit breakers
  • Exponential backoff retries
  • Dead-letter queues
  • Real-time Slack alerts

Final Thoughts

We didn’t start with a clean slate. We started with hospitals buried in Excel sheets and broken IVRs and offered them our telemedicine software.

Now:
50+ clinics.
Doctors spend time on care, not admin.
And yes, the engineers sleep better.

Key Takeaways:

  • Keep your HMS modular
  • Bake in HIPAA from day 1
  • Build for failure, not just success
  • AI should augment, not replace

Want to build something similar?
Let’s connect → sales@nzcares.com

Top comments (0)