Skip to content

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lilo Engine

AI-Powered Mental Health Platform | Healthcare AI | Production-Grade Microservices

Multi-Agent Therapeutic AI · Real-Time Crisis Detection · HIPAA Compliant

Python · Go · PyTorch · Transformers · RAG · LLM · Microservices · PostgreSQL · Redis


Python Go PyTorch HuggingFace Docker HIPAA Edge-First License

FastAPI PostgreSQL Redis Langfuse

A complete AI system I designed and built from scratch — 65K+ lines, 15 microservices, 7 therapeutic agents, 100% crisis detection recall


View Demo · Technical Deep Dive · Architecture


The Problem I Solved

Every 11 minutes, a senior in assisted living experiences a mental health crisis. Most go unnoticed for 15-30 minutes — or longer.

I built Lilo Engine to ensure none go unnoticed. It's a production-ready AI platform that provides:

  • 24/7 therapeutic companion with evidence-based interventions
  • Real-time crisis detection in under 1 second (regulatory requirement: 30s)
  • Instant care team alerts with severity-based escalation
  • Full HIPAA compliance for healthcare deployment

Key Achievements

100%

Crisis Recall
Zero false negatives on 871 test scenarios

92-95%

Intent Accuracy
214 prototypes, BGE semantic matching

65K+

Lines of Code
15 microservices built in 4 months

9

Complete Modules
XAI, streaming, emotion detection

7

AI Agents
Evidence-based therapeutic interventions

Quick Navigation

You Are Start Here Then Explore
Recruiter / Hiring Manager Technical Portfolio Code Samples
Investor / Partner Executive Summary Investor Overview
Engineer Process Flow Technical Portfolio
Healthcare Professional Demo Showcase FAQ

What I Built

AI/ML Engineering

  • Multi-agent orchestration — 214 intent prototypes across 10 therapeutic categories (92-95% accuracy)
  • RAG pipeline — 5 parallel retrieval streams with asyncio.gather() (~2x speedup)
  • Intelligent caching — Classification + Embedding + Conversation caching (60-80% hit rate)
  • Custom crisis detection — BGE embeddings + 5-message trajectory analysis (100% recall)
  • LLM inference — Qwen 2.5-7B on Apple Silicon (Metal GPU, streaming enabled)
  • Voice pipeline — Whisper STT + Piper TTS + Emotion detection
  • 9 complete modules — Coreference, XAI, streaming STT, memory consolidation

Backend & Infrastructure

  • 15 microservices — Go (Gin) + Python (FastAPI), 14 Docker + 1 Host
  • Real-time communication — WebSocket + Redis Pub/Sub
  • Vector search — PostgreSQL + pgvector (768-dim BGE embeddings)
  • Containerized deployment — Docker orchestration + edge prototype
  • HIPAA compliance — Full §164.312 technical safeguards
  • Edge-first architecture — 90% on-device / 10% cloud (Phase 1 Jul 2026)
  • FDA pathway — De Novo submission Oct 2026, clearance target Q2-Q3 2027

Business Opportunity

Metric Value
Total Addressable Market $3T+ (Elderly Care + Mental Health)
Target Market 30,600 US Assisted Living Facilities
Revenue Potential $720M-2.16B ARR at scale
Unit Economics $50-75/resident/month
Facility ROI $50K-150K annual savings per 100 beds
Path to $1M ARR 30 facilities by Dec 2027

Full Market Analysis | Partnership Models


Development Stage (Accelerated Timeline)

Milestone Status Date
Platform Architecture (15 services, 65K+ lines) ✅ Complete Done
HIPAA Compliance (§164.312) ✅ Complete Done
Crisis Detection (100% recall) ✅ Validated Done
9 Additional Modules (XAI, streaming, emotion) ✅ Complete Dec 2025
Module Integration & Edge Prototype 🔄 In Progress Feb 2026
Pilot Study (n=20) 📋 Planned Apr 2026
First Enterprise Contracts (3 facilities) 📋 Planned Jul 2026
FDA De Novo Submission 📋 Planned Oct 2026
FDA Clearance (target) 📋 Planned Q2-Q3 2027

Built with founder's capital — $875K-$1.7M equivalent value, $0 external funding


Architecture

Lilo Engine Platform Architecture

Complete platform architecture showing all 15 microservices (14 Docker + 1 Host), data flows, and integration points

View Interactive Mermaid Diagrams
flowchart LR
    Client[Clients] --> Gateway[API Gateway<br/>NGINX + Auth]
    Gateway --> AI[AI Router<br/>Intent + Crisis]
    AI --> Processing[Core Processing<br/>Safety · Agents · RAG]
    Processing --> LLM[Generation<br/>Qwen 2.5-7B]
    LLM --> Data[(Data Layer<br/>PostgreSQL + Redis)]

    style AI fill:#ff6b6b,color:#fff
    style Processing fill:#4ecdc4,color:#fff
    style LLM fill:#96ceb4,color:#fff
Loading
flowchart TB
    subgraph Clients["CLIENT LAYER"]
        C1["6 Healthcare Dashboards"]
        C2["WebSocket Chat"]
        C3["Voice Interface"]
        C4["REST API"]
    end

    subgraph Gateway["API GATEWAY"]
        G1["NGINX + Rate Limiting"]
        G2["JWT Auth + RBAC"]
        G3["HIPAA Middleware"]
    end

    subgraph AI["AI ROUTER - Port 8100"]
        direction TB
        A1["Intent Classification"]
        A2["Crisis Detection"]
        A3["Agent Orchestrator"]
    end

    subgraph Core["CORE PROCESSING"]
        subgraph Safety["SAFETY LAYER"]
            S1["Crisis Detector V4"]
            S2["Trajectory Analysis"]
            S3["Clinical Context"]
        end
        subgraph Agents["7 THERAPEUTIC AGENTS"]
            AG1["Behavioral Activation"]
            AG2["Reminiscence"]
            AG3["Grounding"]
            AG4["Safety Assessment"]
        end
        subgraph RAG["RAG PIPELINE"]
            R1["Knowledge Base"]
            R2["Life Story"]
            R3["Clinical Assessments"]
            R4["Chat History"]
        end
    end

    subgraph Gen["GENERATION LAYER"]
        E1["BGE Embeddings<br/>Port 8005"]
        L1["Qwen 2.5-7B LLM<br/>Port 8006"]
        V1["Whisper + Piper<br/>Port 8007"]
    end

    subgraph Data["DATA LAYER"]
        D1[("PostgreSQL 16<br/>+ pgvector")]
        D2[("Redis 7<br/>Cache + PubSub")]
        D3["Langfuse<br/>Observability"]
    end

    Clients --> Gateway
    Gateway --> AI
    AI --> Safety
    AI --> Agents
    AI --> RAG
    Safety --> Gen
    Agents --> Gen
    RAG --> Gen
    Gen --> Data

    style Safety fill:#ff6b6b,color:#fff
    style Agents fill:#4ecdc4,color:#fff
    style RAG fill:#45b7d1,color:#fff
    style Gen fill:#96ceb4,color:#fff
Loading

Tech Stack

AI/ML

  • PyTorch 2.8
  • Transformers 4.48
  • Sentence-Transformers
  • FAISS, scikit-learn
  • llama.cpp (Metal)

Backend

  • Python (FastAPI)
  • Go (Gin)
  • PostgreSQL 16 + pgvector
  • Redis 7
  • Docker

AI Models

  • Qwen 2.5-7B (LLM)
  • BGE-base-en-v1.5 (Embeddings)
  • Whisper large-v3 (STT)
  • Piper (TTS)

Technical Skills Demonstrated

Category Technologies Evidence
AI/ML PyTorch, Transformers, RAG, BGE Embeddings, XAI Crisis Detection
Backend Python (FastAPI), Go (Gin), WebSockets Code Samples
Data PostgreSQL, pgvector (768-dim), Redis, Vector Search Process Flow
Infrastructure Docker (14 services), Edge Deployment, HIPAA Compliance Architecture
LLM Engineering Qwen 2.5-7B, Streaming, Context Management, Caching Technical Portfolio

Crisis Detection System

The safety-first architecture processes every message through the crisis detection pipeline before any other operation:

Detection Layer Method Performance
Semantic Matching BGE embeddings against 871 crisis patterns (214 crisis + 657 non-crisis) <50ms
Clinical Context PHQ-9, GAD-7, UCLA-3, life story risk factors Integrated
Trajectory Analysis 5-message sliding window for deterioration Real-time
4-Level Stratification IMMEDIATE → URGENT → ELEVATED → MODERATE <1s total

Risk-Level Response Times (Joint Commission Compliant)

Risk Level Response Time Actions
🔴 IMMEDIATE <30s (regulatory) Auto-escalate 911, emergency protocol
🟠 URGENT <5 minutes Physician + nurse notification, C-SSRS assessment
🟡 ELEVATED <1 hour Physician + social worker, enhanced monitoring
🟢 MODERATE <24 hours Routine monitoring, schedule follow-up

Result: 100% recall (zero missed crises), <5% false positive rate


HIPAA Compliance

Full implementation of HIPAA §164.312 Technical Safeguards:

Requirement Implementation
Access Control JWT + Redis token blacklist, 15-min sessions
Audit Controls Tamper-proof logging with HMAC chains
Integrity End-to-end verification
Transmission Security TLS 1.3

Documentation

Document Audience Description
Technical Architecture Brief CTOs/Architects Comprehensive 9-section technical deep-dive + 12 appendices
Demo Showcase Everyone 33+ screenshots of all dashboards
Technical Portfolio Engineers/Recruiters 12 engineering deep-dives
Code Samples Engineers Production code patterns
Process Flow Tech Evaluators Complete 11-step request flow
Executive Summary Investors/Partners 1-page overview
Investor Overview Investors Market opportunity & roadmap
FAQ Everyone Common questions answered

About This Repository

This is a showcase repository for the Lilo Engine platform. The full source code is proprietary and maintained in a private repository.

What's demonstrated here:

  • System architecture and design decisions
  • Technical capabilities and performance metrics
  • Production UI screenshots
  • Code patterns and engineering approaches

Let's Connect

I'm open to opportunities in AI/ML Engineering, Healthcare Technology, and Backend Systems.

LinkedIn Email


Next Steps

Interest Action
Technical Discussion Review Technical Portfolio then connect on LinkedIn
Investment Inquiry Read Executive Summary then schedule a discussion
Partnership Opportunity Explore Partnership Models then reach out

Built by Aejaz Sheriff · AI/ML Engineer · Healthcare AI Specialist

Python · Go · PyTorch · Transformers · LLM · RAG · Multi-Agent AI · Healthcare AI · HIPAA · Microservices · Crisis Detection · Real-time Systems

Releases

Packages

Contributors