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 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_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)
āāā 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
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.