-
High-level system architecture showing the end-to-end workflow of AegisLab AI
-
Detailed workflow showing the secure API interaction and data validation between the Frontend Client and the Backend FastAPI Service.
-
Deep dive into backend data flow between TiDB and Google Gemini AI to produce the comprehensive diagnostic report.
-
Chat results of our application , ai lab diagnosis app working
-
another example again , showcasing app functions using real past patients data for testing
-
results also
Inspiration
In modern medical laboratories, technicians are under immense pressure. They process hundreds of samples daily, often relying on outdated infrastructure and manual cross-referencing to interpret complex biomarker relationships. This high cognitive load inevitably leads to human error—a missed subtle trend, a delayed critical alert, or a misdiagnosed pattern.
We realized that while AI is advancing rapidly, many clinics still lack the basic digital infrastructure to leverage it. We wanted to build a bridge: AegisLab AI, a tool that doesn't replace the lab technician, but acts as a relentless, highly accurate diagnostic copilot to eliminate cognitive overload and protect patient health.
What it does
AegisLab AI is an advanced clinical laboratory intelligence system that transforms raw lab data into life-saving insights.
- 🧠 Multi-Parameter Clinical Reasoning: Instead of just comparing single values to a reference range, AegisLab analyzes the relationships between markers (e.g., cross-referencing Hemoglobin, MCV, and Ferritin to pinpoint specific types of anemia).
- 🚨 Critical Risk Detection: Automatically categorizes patient risk levels (
LOW,MODERATE,HIGH,CRITICAL) and instantly flags life-threatening abnormalities like severe electrolyte imbalances or acute organ failure. - 📊 Longitudinal Trend Analysis: Tracks patient history over time. We built an interactive Chart.js dashboard that allows clinicians to visually monitor disease progression or treatment efficacy at a glance.
- 💬 Explainable Diagnostic Reports: Generates professional, human-readable clinical summaries detailing the "why" behind the AI's diagnostic confidence scores, ensuring doctors can trust the output.
- 🔐 Secure Patient Management: Fully secure patient database with one-click Google Sign-In for authorized medical personnel.
How we built it
We built AegisLab AI to be fast, resilient, and production-ready:
- Frontend: We designed a premium, responsive medical dashboard using Vanilla JavaScript, HTML5, and CSS3. We avoided heavy frameworks to ensure lightning-fast load times. We integrated Chart.js for dynamic patient history visualization.
- Backend: Powered by Python and FastAPI, creating a highly performant, asynchronous API layer.
- AI Engine (The Brain): The core diagnostic reasoning is powered by the Google Gemini API (
gemini-2.5-flash), utilizing strict prompt engineering to force structured JSON outputs. To ensure 100% uptime during the demo, we also engineered an automated fallback mechanism using the OpenAI API. - Database: We utilized TiDB (a distributed SQL database) connected via asynchronous SQLAlchemy (
aiomysql) to handle real-time patient record storage and historical data queries. - Security: Implemented Firebase Authentication (Google Sign-In) on the frontend and validated secure JWT tokens on the FastAPI backend using the Firebase Admin SDK.
Challenges we ran into
Building a secure, medical-grade application in a hackathon timeframe is tough. Some major hurdles we overcame:
- AI Hallucinations & Formatting: Getting an LLM to consistently return valid, parseable JSON for our frontend was challenging. We solved this by using
response_mime_type="application/json"and strictly defining Pydantic data models in FastAPI. - SDK Deprecation Mid-Flight: We discovered the
google.generativeaipackage was deprecated right as we were building. We had to rapidly refactor our entire AI service layer to use the new officially supportedgoogle-genaiSDK. - Authentication Routing: We hit several CORS and
auth/unauthorized-domainerrors when connecting our local Vanilla JS frontend to the Firebase Auth system. We built custom diagnostic UI error handlers to trace and resolve the issue. - Secret Management: GitHub's secret scanners blocked our commits because of
.envfiles. We had to master Git caching,.gitignoreconfigurations, and commit amending to secure our repository without losing our project history.
Accomplishments that we're proud of
- A Flawless UX/UI: The dashboard looks and feels like a premium SaaS product, not a hastily thrown-together hackathon project. We successfully replaced raw JSON inputs with user-friendly, categorized clinical form fields.
- AI Resiliency: Building the Gemini-to-OpenAI fallback architecture means our app won't crash even if an API rate-limits us during the live pitch.
- Full-Stack Integration: Successfully wiring up a Vanilla JS frontend to a secure FastAPI backend, saving data to a remote TiDB database, and rendering it back onto dynamic charts.
What we learned
We leveled up significantly in system architecture. We learned how to manage asynchronous database sessions in Python, how to effectively engineer prompts for deterministic AI outputs, and how to properly secure API endpoints using Bearer tokens and Firebase middleware. We also learned the hard (but valuable) way how to manage Git branches and push protections within a team environment.
What's next for AegisLab AI: Medical Lab Copilot
The next evolution of AegisLab AI moves it from a local prototype to a globally accessible tool:
- Cloud Deployment: Containerizing the application using Docker and deploying the backend to AWS or Google Cloud Platform, while hosting the frontend on Vercel or Firebase Hosting.
- EHR/EMR Integration: Building API bridges to connect directly with standard Electronic Health Record systems (like Epic or Cerner) so lab machines can feed data directly into AegisLab without any manual entry.
- Expanded Biomarker Support: Training the prompt architecture to handle more complex categories like endocrinology, toxicology, and genetic markers.
👥 Contributors Collistus Kibe - Project Lead & Core AI/Backend Engineer
Dennis Gerrard- Frontend and mostly JS expert
Wokabi Staney- Backend Dev
Log in or sign up for Devpost to join the conversation.