Skip to content

cheimaabarhoumi/machine_learning_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intelligent Health Assistant - Backend

Backend API for the Intelligent Health Assistant academic medical project.

🏥 Features

  • Authentication System: JWT-based authentication with bcrypt password hashing
  • 7 Medical Modules:
    • Physical Activity Analysis
    • Cardiac Anomaly Detection
    • Sleep Analysis
    • Food Recognition
    • Stress Prediction
    • Medication Adherence
    • Asthma Prediction

🚀 Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (v5 or higher)
  • npm or yarn

Installation

  1. Clone the repository
  2. Install dependencies:
npm install
  1. Create .env file:
cp .env.example .env
  1. Update .env with your configuration (MongoDB URI, JWT secret, etc.)

  2. Start MongoDB service

  3. Run the server:

# Development mode with nodemon
npm run dev

# Production mode
npm start

The server will start on http://localhost:5000

📚 API Documentation

Authentication Endpoints

Register User

POST /api/auth/signup
Content-Type: application/json

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "securePassword123"
}

Login User

POST /api/auth/login
Content-Type: application/json

{
  "email": "john@example.com",
  "password": "securePassword123"
}

Medical Module Endpoints

All medical endpoints require authentication. Include JWT token in Authorization header:

Authorization: Bearer <your_jwt_token>

Physical Activity

POST /api/activity/analyze

Cardiac Anomaly

POST /api/cardiac/analyze

Sleep Analysis

POST /api/sleep/predict

Food Recognition

POST /api/food/analyze

Stress Prediction

POST /api/stress/predict

Medication Adherence

POST /api/medication/predict

Asthma Prediction

POST /api/asthma/analyze

🏗️ Project Structure

backend/
├── src/
│   ├── app.js                 # Express app configuration
│   ├── server.js              # Server entry point
│   ├── config/
│   │   └── db.js              # MongoDB connection
│   ├── middleware/
│   │   └── auth.middleware.js # JWT authentication middleware
│   └── modules/
│       ├── auth/              # Authentication module
│       ├── activity/          # Physical activity module
│       ├── cardiac/           # Cardiac anomaly module
│       ├── sleep/             # Sleep analysis module
│       ├── food/              # Food recognition module
│       ├── stress/            # Stress prediction module
│       ├── medication/        # Medication adherence module
│       └── asthma/            # Asthma prediction module
├── package.json
└── .env

🔧 Technology Stack

  • Runtime: Node.js
  • Framework: Express.js
  • Database: MongoDB with Mongoose ODM
  • Authentication: JWT & bcrypt
  • Validation: express-validator

📝 Notes for Academic Development

  • Each medical module is isolated for parallel development
  • Mock predictions are returned (ready to integrate ML models)
  • All data is stored in MongoDB for future analysis
  • Ready to extend with real machine learning models

🤝 Contributing

This is an academic project. Feel free to extend individual modules with real ML models.

📄 License

ISC - Academic Use

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors