MedVisionAI is a full-stack machine learning application that predicts whether a patient is likely to be readmitted to the hospital. It is built for healthcare professionals to make informed decisions and improve patient care.
This project was built as a hackathon submission for the Cognizant team, combining AI, full-stack web, and cloud deployment into one seamless solution.
Frontend: React + Vite + Tailwind CSS
Backend: Flask (Python)
ML Model: Random Forest (trained & saved as rf_model2.pkl)
Database: Firebase (Firestore)
Deployment: Docker + GitHub Actions CI/CD + Google Cloud Run
- Doctor interacts with the React frontend.
- Frontend sends patient data to the Flask backend API.
- Flask backend loads and runs the ML model prediction.
- Predictions and patient data are stored in Firebase Firestore.
- Entire application is containerized using Docker.
- GitHub Actions CI/CD pipeline automatically builds and deploys the app to Google Cloud Run on every push to
main.
- Doctor logs in to the application.
- Doctor enters patient medical data through the web UI.
- Frontend sends this data to the Flask backend.
- The backend uses the Random Forest model to predict readmission.
- Prediction results are sent back to the frontend and displayed to the user.
- All patient data and prediction results are stored in Firestore for future reference.
- Doctors can view a list of all previous predictions.
COGNIZANT-PROJECT/
├── dist/ # Built frontend output (production-ready)
├── node_modules/ # Installed frontend dependencies
├── public/ # Static assets and root index.html
├── src/ # React (Vite) application source code
├── .env # Environment variables (Firebase keys, API endpoints)
├── .gitignore # Files/folders ignored by Git
├── app.py # Flask backend main application
├── bun.lockb # Bun package manager lockfile (if used)
├── components.json # UI component configuration (for shadcn/ui etc.)
├── Dockerfile # Docker build instructions (for full-stack deployment)
├── dummy_patients.py # Script to generate or seed dummy patient data
├── eslint.config.js # Linting rules for the frontend
├── index.html # Entry HTML (used by Vite)
├── package-lock.json # NPM lockfile for dependency versions
├── package.json # Frontend dependencies and scripts
├── postcss.config.js # PostCSS configuration for Tailwind
├── README.md # Project documentation file
├── requirements.txt # Python dependencies for backend
├── rf_model2.pkl # Trained machine learning model (serialized)
├── serviceAccountKey.json # Firebase service credentials
├── tailwind.config.ts # Tailwind CSS configuration
├── train_columns.npy # Numpy file for model input feature columns
├── tsconfig.app.json # TypeScript config for app
├── tsconfig.json # Root TypeScript config
├── tsconfig.node.json # Node environment TS config
└── vite.config.ts # Vite build configuration
- Doctor login system (session-based authentication)
- Input form for patient medical data
- Predicts readmission probability using trained Random Forest model
- Logs prediction data to Firestore
- Displays prediction history
- Deployed using Docker + Google Cloud Run
- Automated deployments using GitHub Actions CI/CD
git clone https://github.com/<your-username>/COGNIZANT-PROJECT.git
cd COGNIZANT-PROJECT
npm install
npm run build
pip install -r requirements.txt
Create a .env file:
VITE_FIREBASE_API_KEY=...
VITE_FIREBASE_AUTH_DOMAIN=...
VITE_FIREBASE_PROJECT_ID=...
And add your serviceAccountKey.json in the root folder.
docker build -t medvisionai .
docker run -p 8080:8080 medvisionai
The app will be available at: http://localhost:8080
-
Every push to the
mainbranch triggers the CI/CD pipeline. -
GitHub Actions:
- Builds the Docker image
- Pushes to Google Artifact Registry
- Deploys to Google Cloud Run
This ensures zero-downtime deployments and production-ready releases.
- Achieved around 80% accuracy on the test dataset.
- Predictions are fast (under 1 second) and reliable.
- Successfully deployed the full-stack container to GCP.
- Add patient dashboards and analytics
- Role-based authentication (Doctors/Admins)
- Integration with hospital EHR systems
- Improve the model with more real-world training data