Backend API for the Intelligent Health Assistant academic medical project.
- 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
- Node.js (v16 or higher)
- MongoDB (v5 or higher)
- npm or yarn
- Clone the repository
- Install dependencies:
npm install- Create
.envfile:
cp .env.example .env-
Update
.envwith your configuration (MongoDB URI, JWT secret, etc.) -
Start MongoDB service
-
Run the server:
# Development mode with nodemon
npm run dev
# Production mode
npm startThe server will start on http://localhost:5000
POST /api/auth/signup
Content-Type: application/json
{
"name": "John Doe",
"email": "john@example.com",
"password": "securePassword123"
}
POST /api/auth/login
Content-Type: application/json
{
"email": "john@example.com",
"password": "securePassword123"
}
All medical endpoints require authentication. Include JWT token in Authorization header:
Authorization: Bearer <your_jwt_token>
POST /api/activity/analyze
POST /api/cardiac/analyze
POST /api/sleep/predict
POST /api/food/analyze
POST /api/stress/predict
POST /api/medication/predict
POST /api/asthma/analyze
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
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT & bcrypt
- Validation: express-validator
- 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
This is an academic project. Feel free to extend individual modules with real ML models.
ISC - Academic Use