A web application for using machine learning models to calculate laser arcuate incisions for astigmatism correction in cataract surgery.
- Patient data input validation (e.g., Corneal Astigmatism: 0.25-1.50 D)
- AI-powered incision length prediction (using XGBoost or Ridge Regression model)
- Visual representation of arcuate incisions
- Support for both single and paired arcuates
- Selectable prediction model (XGBoost or Ridge Regression, XGBoost is default)
- Python 3.8 or higher
- Node.js 16 or higher
- npm (Node Package Manager)
- Clone the repository
- Install Python dependencies:
cd backend # Navigate to backend directory first
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
cd .. # Go back to the root directory- Install Node.js dependencies:
npm installTo run the application in development mode:
- Start the backend server:
cd backend
source venv/bin/activate # Or venv\Scripts\activate on Windows
uvicorn main:app --reload # Use uvicorn directly for development reload
cd ..- In a separate terminal, start the frontend development server:
npm run devThe application will be available at:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
To build the frontend assets for production:
npm run buildTo serve the application in a production-like environment (using the built frontend assets):
cd backend
source venv/bin/activate # Or venv\Scripts\activate on Windows
# Ensure your .env or environment variables are set for production if needed
uvicorn main:app --host 0.0.0.0 --port 8000 # Use uvicorn directly, adjust host/port as needed
cd ..Note: For a true production deployment, consider using a process manager like Gunicorn or Supervisor behind a reverse proxy like Nginx.
The application uses an XGBoost model (default) and optionally a Scikit-learn Ridge Regression model for predictions.
The XGBoost model incorporates a comprehensive set of patient-specific data to deliver personalized arcuate incision recommendations. It analyzes critical features including:
- Corneal astigmatism
- Steep axis position
- Eye laterality (OD/OS)
- White-to-white distance (WTW)
- Axial length (AL)
- Patient age
The model has been specifically designed with a monotonic constraint on the astigmatism feature, ensuring that as corneal astigmatism increases, the recommended arcuate incision length will never decrease. This constraint ensures clinical relevance and predictability in surgical planning.
Important: For privacy and security, the model file (XGBoost_smooth_model_latest.json) is not included in this public repository and are listed in .gitignore.
To run the application locally or deploy it, you need to obtain these files and place them in the backend/ directory:
- XGBoost_smooth_model_latest.json (XGBoost model)
These files are required for the application predictions to function. For deployment (e.g., on Render), these files should be securely uploaded to the server environment (e.g., using Render Persistent Disks) rather than being committed to the repository.
- Enterprise readiness checklist for backend licensing/due diligence:
backend/ENTERPRISE_READINESS.md. - The frontend sends only de-identified clinical parameters to the backend prediction API (
age,eye,corneal_astigmatism,steep_axis,WTW,AL,LASIK). Patient name/ID/date fields are not sent by this codebase. - For production deployments, configure backend allowlists via environment variables:
ALLOWED_ORIGINS(comma-separated full origins to permit for CORS)ALLOW_ORIGIN_REGEX(optional regex for dynamic origins such as preview domains)
- Prefer HTTPS-only ingress, strict firewall rules, and minimal logging retention for healthcare-adjacent workflows.
The backend requires Python packages listed in backend/requirements.txt, including fastapi, xgboost, pandas, numpy, scikit-learn, and joblib.
The frontend requires Node.js packages listed in package.json, including vue and vuetify.