Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

58 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GeneScope πŸ§¬πŸ’™

πŸš€ Live Demo

Click here to try GeneScope


A web-based AI preventive health platform that predicts an individual's genetically inherited disease risks using family history, personal health records, and lifestyle data β€” then acts as a dynamic health coach by recommending prevention plans, screening tests, and urgent consultation when needed.


The Problem

Many people carry a genetic predisposition to serious conditions β€” Type 2 Diabetes, Coronary Artery Disease, Hereditary Cancer, Thalassemia, Sickle Cell Disease β€” without ever knowing until symptoms appear. Preventive healthcare, especially in India, remains reactive. Genetic testing is expensive and inaccessible. Adolescents and young adults rarely seek screening.

This platform bridges that gap: using family history and health records as a proxy for genetic risk, making early risk awareness accessible without expensive lab tests.


What It Does

  1. Collects user profile β€” age, weight, height, known conditions, lifestyle habits
  2. Collects family medical history β€” up to 2 generations (parents, grandparents), including their conditions and vitals
  3. Optionally parses uploaded medical documents via AI-powered OCR (lab reports, prescriptions)
  4. Runs multi-disease risk scoring using rule-based AI models with full explainability
  5. Returns risk classes I–IV (Low β†’ Very High) for each disease, with probability scores
  6. Generates personalized output per disease:
    • Plain-language disease explanation
    • Personalized prevention plan (diet, exercise, lifestyle)
    • Recommended screening tests with frequency and prep instructions
    • Urgency guidance β€” from "routine annual checkup" to "consult a doctor this week"

Diseases Covered

Disease Category
Type 2 Diabetes Metabolic
Coronary Artery Disease Cardiovascular
Hypertension Cardiovascular
Familial Hypercholesterolemia Cardiovascular
Hereditary Breast & Ovarian Cancer (BRCA) Oncological
Thalassemia Hematological
Sickle Cell Disease Hematological
Asthma Respiratory
Hypothyroidism Endocrine
PCOS Endocrine

Risk Classification

Class Label Action
I Low Risk Routine annual checkup
II Moderate Risk Screen within 3–6 months
III High Risk Consult doctor within 1 month
IV Very High Risk Urgent β€” consult within 1–2 weeks

Each class drives personalized prevention advice, test selection, frequency adjustments, and urgency messaging throughout the platform.


Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  FRONTEND (React + Vite)             β”‚
β”‚  LandingPage β†’ RegistrationForm β†’ FamilyHistoryForm  β”‚
β”‚  β†’ LifestyleForm β†’ UploadReport β†’ ResultsDashboard   β”‚
β”‚                                                      β”‚
β”‚  React Β· Vite Β· TailwindCSS Β· Lucide Icons Β· Axios   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚  REST API (Axios / JSON)
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   BACKEND (FastAPI)                  β”‚
β”‚                                                      β”‚
β”‚  POST /api/predict    β†’ prediction_service           β”‚
β”‚  POST /api/ocr        β†’ ocr_service                  β”‚
β”‚  GET  /api/disease-info/{id}                         β”‚
β”‚                                                      β”‚
β”‚  FastAPI Β· Uvicorn Β· Pydantic Β· Python-dotenv        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚  Python imports
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     AI MODULE                        β”‚
β”‚                                                      β”‚
β”‚  ai/risk/                                            β”‚
β”‚    risk_model.py       ← predict_risks() entry point β”‚
β”‚    scoring_rules.py    ← per-disease scoring rules   β”‚
β”‚    risk_classes.py     ← I–IV classification logic   β”‚
β”‚    explainability.py   ← human-readable reasons      β”‚
β”‚                                                      β”‚
β”‚  ai/coaching/                                        β”‚
β”‚    consult_logic.py       ← backend↔AI bridge        β”‚
β”‚    prevention_engine.py   ← personalized plans       β”‚
β”‚    test_recommender.py    ← screening test selection β”‚
β”‚                                                      β”‚
β”‚  ai/ocr/                                             β”‚
β”‚    ocr_pipeline.py     ← medical document parsing    β”‚
β”‚                                                      β”‚
β”‚  ai/data/                                            β”‚
β”‚    diseases_config.json   ← disease metadata         β”‚
β”‚    guidelines.json        ← prevention guidelines    β”‚
β”‚    tests_map.json         ← screening tests database β”‚
β”‚    sample_inputs.json     ← test payloads            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Project Structure

genescope/
β”œβ”€β”€ ai/
β”‚   β”œβ”€β”€ coaching/
β”‚   β”‚   β”œβ”€β”€ consult_logic.py          # Backend↔AI bridge, predict_risk()
β”‚   β”‚   β”œβ”€β”€ prevention_engine.py      # Personalized prevention plans
β”‚   β”‚   └── test_recommender.py       # Screening test selection & prioritization
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”œβ”€β”€ diseases_config.json      # Disease metadata and descriptions
β”‚   β”‚   β”œβ”€β”€ guidelines.json           # Prevention guidelines for all diseases
β”‚   β”‚   β”œβ”€β”€ sample_inputs.json        # Sample request payloads for testing
β”‚   β”‚   └── tests_map.json            # Screening test database per disease
β”‚   β”œβ”€β”€ ocr/
β”‚   β”‚   └── ocr_pipeline.py           # Medical document OCR pipeline
β”‚   β”œβ”€β”€ risk/
β”‚   β”‚   β”œβ”€β”€ explainability.py         # Human-readable risk reasons
β”‚   β”‚   β”œβ”€β”€ risk_classes.py           # Risk class I–IV assignment
β”‚   β”‚   β”œβ”€β”€ risk_model.py             # Main predict_risks() function
β”‚   β”‚   └── scoring_rules.py          # Per-disease scoring rules
β”‚   └── requirements.txt
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ main.py                   # FastAPI app entry point
β”‚   β”‚   β”œβ”€β”€ config.py                 # Settings and environment config
β”‚   β”‚   β”œβ”€β”€ routers/
β”‚   β”‚   β”‚   β”œβ”€β”€ diseases.py           # GET /api/disease-info/
β”‚   β”‚   β”‚   β”œβ”€β”€ ocr.py                # POST /api/ocr
β”‚   β”‚   β”‚   └── predict.py            # POST /api/predict
β”‚   β”‚   β”œβ”€β”€ schemas/
β”‚   β”‚   β”‚   β”œβ”€β”€ prediction.py         # RiskRequest, RiskResponse schemas
β”‚   β”‚   β”‚   β”œβ”€β”€ diseases.py           # Disease info schemas
β”‚   β”‚   β”‚   β”œβ”€β”€ family.py             # Family member schema
β”‚   β”‚   β”‚   β”œβ”€β”€ lab_values.py         # Lab results schema
β”‚   β”‚   β”‚   β”œβ”€β”€ lifestyle.py          # Lifestyle inputs schema
β”‚   β”‚   β”‚   └── profile.py            # Patient profile schema
β”‚   β”‚   └── services/
β”‚   β”‚       β”œβ”€β”€ prediction_service.py # Calls AI risk module
β”‚   β”‚       β”œβ”€β”€ ocr_service.py        # Calls OCR pipeline
β”‚   β”‚       └── disease_service.py    # Disease info lookup
β”‚   β”œβ”€β”€ .env.example
β”‚   └── requirements.txt
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”‚   β”œβ”€β”€ client.js             # Axios instance with interceptors
β”‚   β”‚   β”‚   β”œβ”€β”€ predict.js            # POST /api/predict
β”‚   β”‚   β”‚   β”œβ”€β”€ ocr.js                # POST /api/ocr
β”‚   β”‚   β”‚   └── diseases.js           # GET /api/disease-info/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ FileUpload.jsx        # Drag-and-drop medical document upload
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Footer.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ RiskCard.jsx          # Disease risk result card
β”‚   β”‚   β”‚   β”œβ”€β”€ RiskLegend.jsx        # Risk class color legend
β”‚   β”‚   β”‚   β”œβ”€β”€ ProgressStepper.jsx   # Multi-step form progress indicator
β”‚   β”‚   β”‚   β”œβ”€β”€ ErrorBanner.jsx
β”‚   β”‚   β”‚   └── LoadingSpinner.jsx
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ LandingPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ RegistrationForm.jsx  # Patient profile input
β”‚   β”‚   β”‚   β”œβ”€β”€ FamilyHistoryForm.jsx # Family medical history (2 generations)
β”‚   β”‚   β”‚   β”œβ”€β”€ LifestyleForm.jsx     # Lifestyle habits input
β”‚   β”‚   β”‚   β”œβ”€β”€ UploadReport.jsx      # Medical document upload (OCR)
β”‚   β”‚   β”‚   β”œβ”€β”€ Assessment.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ResultsDashboard.jsx  # Final results with all disease risks
β”‚   β”‚   β”‚   └── DiseaseDetail.jsx     # Per-disease detail with prevention plan
β”‚   β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”‚   └── useLocalStorage.js
β”‚   β”‚   └── utils/
β”‚   β”‚       β”œβ”€β”€ formatters.js
β”‚   β”‚       └── validators.js
β”‚   β”œβ”€β”€ .env.example
β”‚   └── package.json
β”œβ”€β”€ docs/
β”‚   └── api_contract.json             # Full OpenAPI-style contract
β”œβ”€β”€ render.yaml                       # Render.com deployment config
└── requirements.txt

Quickstart

Prerequisites

  • Python 3.9+
  • Node.js 18+

1. Clone

git clone https://github.com/Jay-Jay-Tee/genescope.git
cd genescope

2. Backend

cd backend
cp .env.example .env
pip install -r requirements.txt
pip install -r ../ai/requirements.txt
uvicorn app.main:app --reload --port 8000

The API will be running at http://localhost:8000.

3. Frontend

cd frontend
cp .env.example .env
# Edit .env and set: VITE_API_URL=http://localhost:8000/api
npm install
npm run dev

The app will be running at http://localhost:5173.


API Reference

Method Endpoint Description
POST /api/predict Submit patient + family + lifestyle data, receive disease risk results
POST /api/ocr Upload medical document (PDF/image), extract structured health data
GET /api/disease-info/ List all supported diseases
GET /api/disease-info/{id} Detailed info for a specific disease

Full API contract: docs/api_contract.json

Sample prediction request

{
  "patient": {
    "age": 22,
    "gender": "M",
    "weight": 56.7,
    "height": 171,
    "known_issues": ["hypertension"]
  },
  "lifestyle": {
    "diet": "high_sugar",
    "exercise": "sedentary",
    "smoking": false,
    "stress_level": "high",
    "sleep_hours": 5
  },
  "family": [
    {
      "role": "mother",
      "generation": 1,
      "known_issues": ["diabetes", "hypertension", "heart-disease"]
    },
    {
      "role": "father",
      "generation": 1,
      "known_issues": ["diabetes", "cancer"]
    }
  ]
}

Sample prediction response (per disease)

{
  "disease_name": "Type 2 Diabetes",
  "disease_id": "type2_diabetes",
  "probability": 0.74,
  "risk_class": "III",
  "reasons": [
    "Mother has Type 2 Diabetes β€” first-degree family history significantly increases risk",
    "Father has Type 2 Diabetes β€” bilateral parental history compounds risk",
    "High-sugar diet identified as a modifiable risk factor",
    "Sedentary lifestyle increases insulin resistance risk"
  ],
  "prevention": { "diet": [...], "exercise": [...], "lifestyle": [...] },
  "recommended_tests": ["HbA1c", "Fasting Blood Glucose", "..."],
  "consult": "Consult doctor within 1 month"
}

AI Module Design

The risk engine is fully rule-based and explainable β€” no black-box ML. This was a deliberate design decision: in a health context, every factor that contributes to a risk score is surfaced to the user as a plain-language reason.

Scoring pipeline:

  1. risk_model.py β€” predict_risks(user_data) iterates over all covered diseases
  2. scoring_rules.py β€” per-disease rules weight family history, lifestyle, vitals, and lab values into a 0–1 probability
  3. risk_classes.py β€” probability mapped to class I / II / III / IV
  4. explainability.py β€” generates human-readable reason strings per contributing factor
  5. prevention_engine.py β€” personalized plan based on disease + class + user profile
  6. test_recommender.py β€” selects and prioritizes screening tests; adjusts frequency by risk class

Test recommendations by risk class:

Class Max tests shown
I 2
II 3
III 5
IV 6

Test frequency is automatically tightened as risk class increases (e.g. "Annually" β†’ "Every 6 months" for Class III, "Every 3–6 months" for Class IV).


Deployment

Deployed on Render using render.yaml.

  • Backend: Python web service running uvicorn app.main:app
  • Frontend: Static site β€” Vite builds to dist/, served as a static deploy

Environment variables on Render:

Variable Where Description
VITE_API_URL Frontend build env Backend API base URL
Backend secrets Backend service env See backend/.env.example

SDG Alignment

SDG 3: Good Health and Well-Being

GeneScope directly addresses the gap between knowing a disease runs in your family and understanding what to do about it. By making risk awareness accessible, actionable, and free, it supports early detection and preventive intervention β€” reducing long-term healthcare burden and avoidable complications.


Disclaimer

⚠️ GeneScope is a preventive decision-support tool, not a licensed medical diagnostic system. All high-risk outputs explicitly recommend professional medical consultation. Results should not replace clinical diagnosis, testing, or treatment by a qualified healthcare provider.


Team

Built at NIT Calicut, 2026:

  • Joshua Jacob Thomas (Lead)
  • HR Soorya Dev
  • Dinesh Paliwal
  • Mayank Singh
  • Aditya Singh
  • Nirmal Kumar Prajapath
  • Satrajit Mondal
  • Sai Pranav Parasuraman
  • Sagnik Dutta
  • Siddharth Madhavan

License

MIT License β€” see LICENSE

About

Web-based ML (hardcoded scoring scheme) platform for inherited disease risk prediction: uses family history, lifestyle & health records to generate personalized prevention plans and screening recommendations.

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages