FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
zee1205
zee1205untitled-1082
Public
Like
untitled-1082
Home
Code
4
backend
3
frontend
2
README.md
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
6/3/2025
Viewing readonly version of main branch: v10
View latest version
README.md

Nelson-GPT: Medical AI Assistant

A production-grade Progressive Web App (PWA) that provides a ChatGPT-like interface for medical professionals and students, powered by the Nelson Textbook of Pediatrics through advanced Retrieval-Augmented Generation (RAG).

šŸ„ Features

Core Functionality

  • Medical AI Assistant: Specialized responses based on Nelson Textbook of Pediatrics
  • RAG Pipeline: Vector search with Supabase PGVector for evidence-based answers
  • Real-time Chat: Streaming responses with typing indicators
  • Offline Support: Full PWA with IndexedDB caching
  • Cross-Platform: Installable on Android, iOS, and desktop

User Experience

  • ChatGPT-like Interface: Familiar chat experience optimized for medical use
  • Medical Theming: Professional healthcare-focused design
  • Responsive Design: Optimized for mobile, tablet, and desktop
  • Accessibility: WCAG compliant with screen reader support

Technical Features

  • Progressive Web App: Full offline functionality with service worker
  • Vector Search: Semantic search through medical content
  • Real-time Streaming: Live AI response generation
  • Local Storage: Conversation history and user preferences
  • Error Handling: Robust fallback mechanisms

šŸ—ļø Architecture

Frontend

  • React 18 with TypeScript
  • Tailwind CSS for styling
  • React Router for navigation
  • IndexedDB for offline storage
  • Service Worker for PWA functionality

Backend

  • Hono API framework
  • Supabase with PGVector for vector search
  • OpenAI/Mistral for AI responses
  • Hugging Face for embeddings

Database Schema

-- Medical content chunks with embeddings CREATE TABLE medical_content ( id SERIAL PRIMARY KEY, content TEXT NOT NULL, embedding VECTOR(384), chapter VARCHAR(255), specialty VARCHAR(100), page_reference VARCHAR(50), created_at TIMESTAMP DEFAULT NOW() ); -- User conversations CREATE TABLE conversations ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), user_id VARCHAR(255), title VARCHAR(255), messages JSONB, created_at TIMESTAMP DEFAULT NOW(), updated_at TIMESTAMP DEFAULT NOW() );

šŸš€ Getting Started

Prerequisites

  • Supabase project with PGVector extension
  • OpenAI or Mistral API key
  • Hugging Face API key (optional for server-side embeddings)

Environment Variables

SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key
OPENAI_API_KEY=your_openai_key
HUGGING_FACE_API_KEY=your_hf_key (optional)

Installation

  1. Set up environment variables in Val Town
  2. Deploy the backend API
  3. Access the PWA at your Val Town URL
  4. Install as PWA on your device

šŸ“± PWA Installation

Mobile (Android/iOS)

  1. Open the app in your mobile browser
  2. Tap "Add to Home Screen" or "Install App"
  3. Launch from your home screen for full-screen experience

Desktop

  1. Open the app in Chrome/Edge
  2. Click the install icon in the address bar
  3. Launch from your desktop or start menu

šŸ”§ Development

Project Structure

ā”œā”€ā”€ backend/
│   ā”œā”€ā”€ database/
│   │   ā”œā”€ā”€ migrations.ts    # Database schema
│   │   └── queries.ts       # Vector search queries
│   ā”œā”€ā”€ routes/
│   │   ā”œā”€ā”€ chat.ts         # Chat API endpoints
│   │   ā”œā”€ā”€ embeddings.ts   # Embedding generation
│   │   └── static.ts       # Static file serving
│   └── index.ts            # Main API entry point
ā”œā”€ā”€ frontend/
│   ā”œā”€ā”€ components/
│   │   ā”œā”€ā”€ Chat/           # Chat interface components
│   │   ā”œā”€ā”€ Layout/         # App layout components
│   │   ā”œā”€ā”€ PWA/            # PWA-specific components
│   │   └── UI/             # Reusable UI components
│   ā”œā”€ā”€ hooks/              # Custom React hooks
│   ā”œā”€ā”€ services/           # API and storage services
│   ā”œā”€ā”€ types/              # TypeScript type definitions
│   ā”œā”€ā”€ utils/              # Utility functions
│   ā”œā”€ā”€ index.html          # Main HTML template
│   └── index.tsx           # React entry point
ā”œā”€ā”€ shared/
│   ā”œā”€ā”€ types.ts            # Shared type definitions
│   └── utils.ts            # Shared utilities
└── public/
    ā”œā”€ā”€ manifest.json       # PWA manifest
    ā”œā”€ā”€ sw.js              # Service worker
    └── icons/             # PWA icons

šŸ”’ Security & Compliance

  • Medical Disclaimers: All responses include appropriate medical disclaimers
  • Data Privacy: Local storage with optional cloud sync
  • HIPAA Considerations: No PHI storage or transmission
  • Content Validation: Responses based on peer-reviewed medical literature

šŸ“Š Performance

  • Offline First: Full functionality without internet
  • Fast Loading: Optimized bundle size and lazy loading
  • Efficient Search: Vector similarity search with caching
  • Responsive: <100ms UI interactions

šŸ¤ Contributing

This is a specialized medical AI assistant. Contributions should maintain medical accuracy and professional standards.

āš ļø Medical Disclaimer

Nelson-GPT is an educational tool for healthcare professionals and students. It is not intended to replace professional medical judgment or provide direct patient care recommendations. Always consult current medical literature and follow institutional protocols.

Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
Ā© 2025 Val Town, Inc.