Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<<<<<<< HEAD

MEDICO - Medical Diagnosis System

A comprehensive medical diagnosis system with AI-powered symptom analysis.

Project Structure

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

Features Implemented

Phase 1 - System Foundation

  1. Project Environment Setup

    • Complete folder structure
    • Dependency management with requirements.txt
    • Environment configuration files
  2. Authentication & Role Management

    • User registration and login endpoints
    • JWT token generation and verification
    • Role-based routing (Patient/Doctor)
    • Google OAuth2 login integration
  3. Patient Dashboard

    • Chat interface for symptom description
    • Mock diagnosis responses
    • Session management
  4. API Routing Framework

    • RESTful endpoints for authentication
    • User profile management
    • Diagnosis service (stubbed)
    • Health check endpoint
  5. Service Interconnection Blueprint

    • Defined interfaces for future AI integration
    • Consistent response formats

Phase 2 - AI Consultation Workflow

  1. Disease Database Integration

    • Dynamic JSON loading without system restart
    • Hot reload watcher for real-time updates
    • Symptom-to-disease mapping cache
  2. NLP Symptom Extraction

    • Text cleaning and normalization
    • Symptom pattern matching with synonyms
    • Fallback mode for offline operation
  3. Diagnosis Inference Engine

    • Symptom-disease matching using Jaccard similarity
    • Confidence scoring based on symptom overlap
    • Top-3 disease predictions with medications and tests
  4. AI Chatbot Connection

    • Real-time symptom analysis
    • Formatted diagnosis results
    • User-friendly chat interface

Phase 3 - Architecture Restructure (Latest)

  1. 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
  2. Enhanced Context Management

    • Complete session context sent to AI for every message
    • Improved context persistence and retrieval
    • Elimination of redundant questions
  3. Dynamic Conversation Flow

    • AI generates follow-up questions dynamically
    • Context-aware responses without hardcoded branches
    • Natural, fluid conversation experience

Google OAuth2 Integration

The Medico app now supports Google login using OAuth2 authentication. This allows users to sign in with their Google accounts.

Backend Implementation

  • 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

Frontend Implementation

  • Added Google Sign-In button to the login page
  • Uses Google Identity Services for authentication
  • Handles token exchange with the backend

Setup Instructions

  1. 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:
    • Add authorized redirect URIs (if needed):
    • Copy the generated Client ID
  2. Configure Backend:

    • Open backend_service/.env
    • Replace YOUR_GOOGLE_CLIENT_ID_HERE with your actual Google Client ID:
      GOOGLE_CLIENT_ID=your_actual_google_client_id_here
      
  3. Configure Frontend:

    • Open frontend_service/app.js
    • Replace YOUR_GOOGLE_CLIENT_ID_HERE with your actual Google Client ID:
      const clientId = "your_actual_google_client_id_here";
  4. Install Dependencies:

    cd backend_service
    pip install google-auth google-auth-oauthlib google-auth-httplib2
  5. 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
  6. Test the Integration:

    • Visit http://localhost:3000
    • Click on the "Login" link
    • Click the "Sign in with Google" button
    • Complete the Google authentication flow

Getting Started

Prerequisites

  • Python 3.8+
  • pip package manager

Installation

  1. Clone the repository
  2. Navigate to the project directory
  3. Run the startup script:

Windows:

start-app.bat

Unix/Linux/Mac:

./start-app.sh

Manual Startup

Backend Service:

cd backend_service
pip install -r requirements.txt
python run.py

Frontend Service:

cd frontend_service
python -m http.server 3000

API Endpoints

  • POST /auth/register - User registration
  • POST /auth/login - User login
  • POST /auth/google - Google OAuth2 login
  • GET /api/user/profile - Get user profile
  • POST /api/diagnosis - Get diagnosis
  • POST /api/diagnosis/symptoms - Extract symptoms
  • POST /api/data/reload - Reload disease data
  • GET /api/data/stats - Get disease statistics
  • GET /api/system/health - System health check

Technologies Used

  • 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

Documentation

Future Enhancements

  • Integration with advanced AI/NLP models
  • PostgreSQL database implementation
  • Doctor dashboard and features
  • Advanced medical record management
  • Teleconsultation features =======

MEDCO

AI POWERED MEDICAL DIAGONIS APP

72dd9e799f19eceb81482d08c582173178d46436

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages