Public
Like
untitled-1082
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.
Viewing readonly version of main branch: v11View latest version
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).
- 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
- 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
- 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
- React 18 with TypeScript
- Tailwind CSS for styling
- React Router for navigation
- IndexedDB for offline storage
- Service Worker for PWA functionality
- Hono API framework
- Supabase with PGVector for vector search
- OpenAI/Mistral for AI responses
- Hugging Face for embeddings
-- 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() );
- Supabase project with PGVector extension
- OpenAI or Mistral API key
- Hugging Face API key (optional for server-side embeddings)
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)
- Set up environment variables in Val Town
- Deploy the backend API
- Access the PWA at your Val Town URL
- Install as PWA on your device
- Open the app in your mobile browser
- Tap "Add to Home Screen" or "Install App"
- Launch from your home screen for full-screen experience
- Open the app in Chrome/Edge
- Click the install icon in the address bar
- Launch from your desktop or start menu
āāā 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
- 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
- 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
This is a specialized medical AI assistant. Contributions should maintain medical accuracy and professional standards.
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.