<<<<<<< HEAD
A comprehensive medical diagnosis system with AI-powered symptom analysis.
MEDICO4/
├── frontend_service/ # Frontend application
├── backend_service/ # Backend API service
├── ai_service/ # AI/NLP service
├── data_service/ # Database service
├── tests/ # Test suite
├── docs/ # Documentation
├── start-app.bat # Windows startup script
└── start-app.sh # Unix/Linux startup script
-
Project Environment Setup
- Complete folder structure
- Dependency management with requirements.txt
- Environment configuration files
-
Authentication & Role Management
- User registration and login endpoints
- JWT token generation and verification
- Role-based routing (Patient/Doctor)
- Google OAuth2 login integration
-
Patient Dashboard
- Chat interface for symptom description
- Mock diagnosis responses
- Session management
-
API Routing Framework
- RESTful endpoints for authentication
- User profile management
- Diagnosis service (stubbed)
- Health check endpoint
-
Service Interconnection Blueprint
- Defined interfaces for future AI integration
- Consistent response formats
-
Disease Database Integration
- Dynamic JSON loading without system restart
- Hot reload watcher for real-time updates
- Symptom-to-disease mapping cache
-
NLP Symptom Extraction
- Text cleaning and normalization
- Symptom pattern matching with synonyms
- Fallback mode for offline operation
-
Diagnosis Inference Engine
- Symptom-disease matching using Jaccard similarity
- Confidence scoring based on symptom overlap
- Top-3 disease predictions with medications and tests
-
AI Chatbot Connection
- Real-time symptom analysis
- Formatted diagnosis results
- User-friendly chat interface
-
AI-Centric Architecture
- AI as the primary conversation orchestrator
- Backend as a context relay layer only
- NLP as a data extraction service only
- Clean separation of concerns
-
Enhanced Context Management
- Complete session context sent to AI for every message
- Improved context persistence and retrieval
- Elimination of redundant questions
-
Dynamic Conversation Flow
- AI generates follow-up questions dynamically
- Context-aware responses without hardcoded branches
- Natural, fluid conversation experience
The Medico app now supports Google login using OAuth2 authentication. This allows users to sign in with their Google accounts.
- Added new endpoint:
POST /auth/google - Uses Google's
id_token.verify_oauth2_token()for token verification - Automatically creates new users or fetches existing ones
- Returns a JWT token for Medico's internal auth system
- Added Google Sign-In button to the login page
- Uses Google Identity Services for authentication
- Handles token exchange with the backend
-
Obtain Google OAuth2 Credentials:
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Select "Web application" as the application type
- Add authorized JavaScript origins:
- http://localhost:3000 (for local development)
- Add authorized redirect URIs (if needed):
- Copy the generated Client ID
-
Configure Backend:
- Open
backend_service/.env - Replace
YOUR_GOOGLE_CLIENT_ID_HEREwith your actual Google Client ID:GOOGLE_CLIENT_ID=your_actual_google_client_id_here
- Open
-
Configure Frontend:
- Open
frontend_service/app.js - Replace
YOUR_GOOGLE_CLIENT_ID_HEREwith your actual Google Client ID:const clientId = "your_actual_google_client_id_here";
- Open
-
Install Dependencies:
cd backend_service pip install google-auth google-auth-oauthlib google-auth-httplib2 -
Run the Application:
# Start backend cd backend_service python run.py # Start frontend (in a new terminal) cd frontend_service python -m http.server 3000
-
Test the Integration:
- Visit http://localhost:3000
- Click on the "Login" link
- Click the "Sign in with Google" button
- Complete the Google authentication flow
- Python 3.8+
- pip package manager
- Clone the repository
- Navigate to the project directory
- Run the startup script:
Windows:
start-app.batUnix/Linux/Mac:
./start-app.shBackend Service:
cd backend_service
pip install -r requirements.txt
python run.pyFrontend Service:
cd frontend_service
python -m http.server 3000POST /auth/register- User registrationPOST /auth/login- User loginPOST /auth/google- Google OAuth2 loginGET /api/user/profile- Get user profilePOST /api/diagnosis- Get diagnosisPOST /api/diagnosis/symptoms- Extract symptomsPOST /api/data/reload- Reload disease dataGET /api/data/stats- Get disease statisticsGET /api/system/health- System health check
- Backend: FastAPI, Python, SQLite
- Frontend: HTML, CSS, JavaScript
- Authentication: JWT, Google OAuth2
- Database: SQLite (will migrate to PostgreSQL later)
- AI Services: Custom NLP implementation with GPT4All integration
- Data Management: JSON-based disease database with hot reload
- AI Workflow Summary
- API Reference
- Disease Database Guide
- Foundation Validation
- Architecture Restructure Summary
- New Architecture Diagram
- Integration with advanced AI/NLP models
- PostgreSQL database implementation
- Doctor dashboard and features
- Advanced medical record management
- Teleconsultation features =======
AI POWERED MEDICAL DIAGONIS APP
72dd9e799f19eceb81482d08c582173178d46436