Skip to main content
Case 012026AI/ML Engineer & Backend Architect

AiDerm Cliniq

Multi-provider LLM failover

A clinical backend for AI-assisted dermatology. It routes analysis requests across three LLM providers with priority-ordered failover, runs a three-round conversational diagnostic pipeline over patient-uploaded skin images, and keeps Celery task state recoverable so a worker crash never loses a patient session.

FastAPIPostgreSQLSQLAlchemy 2.0 (Async)RedisCeleryFirebase FCM+4
01

Analysis survives a single-provider outage via priority-ordered failover

02

Zero task loss with late-ACK crash recovery

03

24-hour Redis result persistence

SnapshotAt a glance

AI/ML Engineer & Backend Architect

Ongoing

Key Components
LLM Failover Router
Celery Task Chains
Redis Prompt Registry
Async PostgreSQL ORM
JWT-RBAC Auth System
Outcomes

Analysis survives a single-provider outage via priority-ordered failover

Zero task loss with late-ACK crash recovery

24-hour Redis result persistence

10+ typed clinical audit events logged

Up to 3 automatic retries per failed task

Technologies Used

10 Technologies Integrated

FastAPI
PostgreSQL
SQLAlchemy 2.0 (Async)
Redis
Celery
Firebase FCM
GCP
Alembic
Python
Google OAuth 2.0
3 providers

Impact

Key Features

Feature Implementation

9 Features
95%
Feature CoverageProject Scope

Project Vision

A clinical backend where provider failure is a routing decision, not an outage.

Core Process

The process of Developing it.

Architected multi-provider LLM routing, adaptive diagnostic pipelines, and fault-tolerant Celery task queues on GCP.

Build notesWhat I built

05
  1. Multi-Provider AI Routing with Automatic Failover

    Architected an LLM router across Gemini 2.0 Flash, OpenAI GPT-4o, and DeepSeek with priority-ordered failover on rate limits or provider outages, so a single provider outage degrades throughput rather than stopping analysis, with runtime provider switching via Redis-backed model registry.

  2. Adaptive AI Diagnostic Pipeline

    Built a 3-round conversational diagnostic engine processing patient-uploaded skin images and structured symptom history to generate differential diagnoses, red flag detection, and personalised treatment plans via multi-stage Celery task chains.

  3. Crash Recovery and Offline Data Sync

    Engineered a fault-tolerant task queue with late-ACK acknowledgment, per-task retry policies (up to 3 retries), and 24-hour Redis result persistence, guaranteeing zero task loss on worker crash and so the Flutter client can resume where it left off.

  4. Runtime AI Prompt Registry with Version Control

    Designed a Redis-backed prompt management system supporting runtime overrides, full version history, and one-click rollback across all AI modules without redeployment, with append-before-write versioning ensuring zero silent data loss.

  5. Clinical Workflow, Audit Trail and Secure Authentication

    Delivered QR-based doctor assignment, append-only audit logging (10+ typed clinical events), FCM push notifications, automated xhtml2pdf report generation, and stateless JWT-RBAC authentication secured by SHA-256 OTP email verification and Google OAuth 2.0.

Inspiration
Make a dermatology triage tool that stays usable when an upstream provider does not.

Features

  • Multi-provider LLM routing with automatic failover
  • Adaptive 3-round conversational diagnostic engine
  • Crash recovery and offline data sync
  • Runtime AI prompt registry with version control
  • QR-based doctor assignment
  • Append-only clinical audit trail (10+ event types)
  • JWT-RBAC + Google OAuth 2.0 authentication
  • Automated xhtml2pdf report generation
  • Firebase FCM push notifications

Challenges

  • Keeping analysis available when a provider rate-limits or goes down
  • Fault-tolerant task processing with crash recovery
  • Managing prompt versions without redeployment
Solution

Priority-ordered LLM failover with Redis-backed model registry and late-ACK task queues for zero-loss processing.

Let's Talk-Knight's Gambit-Game On-
Consultant