A full-stack web application for predicting diabetes risk based on various health parameters using machine learning.
- User authentication (login/register)
- Profile management with image upload
- Diabetes risk prediction using machine learning
- BMI calculation
- Responsive design
- Google Sheets integration for data storage
- Secure password hashing
- File upload with size and type validation
├── server.js # Main Express server
├── app.py # Python Flask server for ML predictions
├── train_model.py # Script for training the ML model
├── diabetes_model.joblib # Trained ML model
├── scaler.joblib # Data scaler for preprocessing
├── diabetes.csv # Training dataset
├── public/ # Static files
├── templates/ # HTML templates
└── requirements.txt # Python dependencies
The Node.js server (server.js) handles user authentication, profile management, and serves static files and HTML templates. It communicates with the Python Flask server (app.py) to perform diabetes risk predictions.
- Clone the repository
- Install Node.js dependencies:
npm install
- Install Python dependencies:
pip install -r requirements.txt
- Create a
.envfile with the following variables:GOOGLE_SERVICE_ACCOUNT_EMAIL=your-service-account-email GOOGLE_PRIVATE_KEY=your-private-key GOOGLE_SHEETS_ID=your-sheets-id SESSION_SECRET=your-session-secret PORT=3000 - Start the development servers:
# Terminal 1 - Node.js server npm run dev # Terminal 2 - Python server python app.py
- Create a free account on Render
- Create two new Web Services:
- One for Node.js backend
- One for Python ML server
- Connect your GitHub repository
- Configure the services:
- Node.js service:
- Build Command:
npm install - Start Command:
npm start
- Build Command:
- Python service:
- Build Command:
pip install -r requirements.txt - Start Command:
python app.py
- Build Command:
- Node.js service:
- Add environment variables in Render dashboard
- Deploy!
GOOGLE_SERVICE_ACCOUNT_EMAIL: Google Cloud service account emailGOOGLE_PRIVATE_KEY: Google Cloud private keyGOOGLE_SHEETS_ID: Google Sheets ID for data storageSESSION_SECRET: Secret key for session managementPORT: Server port (default: 3000)
- Node.js
- Express.js
- Google Sheets API
- Python
- Flask
- Scikit-learn
- Joblib
- The system uses a Random Forest Classifier model for diabetes prediction.
- The model was trained on the Pima Indians Diabetes Dataset (
diabetes.csv).
- HTML/CSS/JavaScript
- Bootstrap
- Multer for file uploads
- Google Sheets
- Local file system (for profile images)
- bcrypt for password hashing
- express-session for session management
- Input validation and sanitization
- File upload restrictions
- POST
/register- Register new user - POST
/login- User login - GET
/logout- User logout
- GET
/profile- Get user profile - POST
/profile/update- Update user profile - POST
/profile/upload- Upload profile image
- POST
/predict- Get diabetes risk prediction
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request