AI Powered Diagnostic Assistant
A Personal Healthcare Assistant web application designed to guide users through structured health checkups for 10 common diseases. This is a patient triage tool that collects symptom data, routes users through disease-specific question flows, and classifies outcomes using a RAG system (Red-Amber-Green).
The diagram above illustrates the complete user journey from initial questionnaire through the AI-powered triage system to final outcome and emergency code generation.
Users select from 10 disease categories:
- Chest Pain / Heart Concerns
- High Blood Pressure
- Breathing Problems
- Stomach & Bowel Symptoms
- Headache & Neurology
- Mood, Anxiety & Sleep
- Back, Joint & Muscle Pain
- Skin & Moles
- Urinary & Kidney
- Diabetes & Blood Sugar
Users answer an 11-step questionnaire covering:
- Site: Where is the problem?
- Onset: When did it start?
- Character: What does it feel like?
- Radiation: Does it spread?
- Associations: Any other symptoms?
- Timing: Pattern/duration?
- Exacerbating/Relieving: What makes it better/worse?
- Severity: How bad is it?
- Ideas: What do you think is causing this?
- Concerns: What worries you most?
- Expectations: What are you hoping for?
Up to 10 additional questions based on red flags identified in initial responses.
Outcomes classified into three categories:
-
π’ GREEN: Everything looks good
- Lifestyle advice provided
- 12-hour SMS follow-up check
- If symptoms persist β escalate to AMBER/RED
-
π‘ AMBER: Moderate concern
- "Call NHS 111" or "Book GP appointment soon"
-
π΄ RED: Emergency
- "Call 999 immediately"
- Unique consultation code generated (e.g., ABC123)
- Full summary available at
/emergency/[code]
For RED outcomes:
- Generates unique alphanumeric code
- User shares code with emergency services
- Clinicians access full consultation summary at
/emergency/[code] - Summary includes: timestamp, symptoms, severity, red flags, RAG outcome
- Framework: Next.js (App Router)
- Frontend: React components
- Backend: Next.js API routes
- Database: PostgreSQL
- SMS: Twilio
- Hosting: Vercel
- AI: OpenAI API
- β 5 disease buttons
- β Static RAG rules
- β Emergency code system
- π§ All 10 disease buttons
- π§ API clarifiers
- π§ SMS follow-up for GREEN outcomes
- β³ Multi-language support
- β³ AI-driven triage refinement
- β³ NHS/Telehealth integration
- β³ Media uploads (skin photos)
- β³ AHPF standardization (see below)
# Install dependencies
npm install
# Run development server
npm run dev
# Build for production
npm run build
# Start production server
npm run startOpen http://localhost:3000 to view the application.
- Safety-first logic: Defaults to AMBER/RED when uncertain
- Conservative thresholds: Prioritises user safety
- WCAG 2.1 AA compliant: Accessible design
- GDPR compliant: Anonymised data, encrypted storage
- HTTPS only: Secure communication
- Audit logging: Emergency page access tracked
illness-ai/
βββ src/
β βββ app/ # Next.js App Router pages
β β βββ page.tsx # Landing page (disease category selection)
β β βββ questions/
β β β βββ [slug]/page.tsx # Dynamic questionnaire pages (SOCRATES)
β β βββ results/page.tsx # RAG triage results (RED/AMBER/GREEN)
β β βββ emergency/
β β β βββ [code]/page.tsx # Emergency code access for clinicians
β β βββ debug/page.tsx # Debug/testing page
β β βββ api/
β β βββ triage/route.ts # Triage API endpoint (RAG classification)
β βββ components/ # React components
β βββ lib/ # Utility functions
β βββ types/ # TypeScript type definitions
βββ assets/ # Diagrams and documentation
βββ node_modules/ # Dependencies
βββ CLAUDE.md # AI assistant instructions
βββ package.json # Project dependencies
βββ tsconfig.json # TypeScript configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ README.md # This file
Currently, no industry standard exists for structuring diagnostic prompts to AI models. This project implements a comprehensive 10-question approach based on the SOCRATES framework, but we recognise the need for standardisation across the healthcare AI community.
We propose the Standardised AI Health Diagnostic Prompt Framework (AHPF) with quality tiers:
-
π₯ Bronze (Basic): Minimal data collection
- Age, gender, primary symptom
- Quick triage for non-critical cases
-
π₯ Silver (Standard): Enhanced context
- Bronze + medical history
- Current medications, allergies
- Symptom duration and severity
-
π₯ Gold (Comprehensive): Current implementation
- Silver + SOCRATES framework (11 questions)
- ICE integration (Ideas, Concerns, Expectations)
- Disease-specific clarifiers
- Red flag detection
-
π Platinum (Clinical Grade): Future expansion
- Gold + vital signs (BP, heart rate, temperature, SpO2)
- BMI and physical metrics
- Lab results integration
- Wearable device data
- Photo/video symptom documentation
We aim to:
- Open-source the AHPF specification for community adoption
- Create API standards for healthcare AI prompt construction
- Develop validation tools to ensure prompt quality
- Collaborate with medical institutions to refine tiers
- Publish research on prompt effectiveness across tiers
Contributions welcome! Help us build the future standard for AI-assisted healthcare diagnostics.
This project is open source and welcomes contributions from the community! We believe in collaborative healthcare technology development and encourage pull requests to add new features, improve existing functionality, and enhance user experience.
- Fork the repository and create a feature branch
- Make your changes following our code standards
- Test thoroughly - this is a safety-critical tool
- Submit a pull request with a clear description of your changes
This is a safety-critical healthcare tool. All contributions must:
- Follow conservative risk classification thresholds
- Never provide medical diagnoses
- Maintain clear disclaimers
- Preserve emergency code system integrity
- Include appropriate tests
- Follow accessibility standards (WCAG 2.1 AA)
- Add support for new disease categories
- Improve question flow UX/UI
- Enhance RAG triage logic
- Add multi-language support
- Implement additional follow-up mechanisms
- Improve accessibility features
- Write documentation and guides
We review all pull requests and appreciate your help in making healthcare more accessible!
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
