This repository contains a small AIOps prototype combining a FastAPI backend (RCA + forecasting + LLM helpers), a React frontend, and training scripts for machine learning models.
This README summarizes the project layout, prerequisites, setup and run instructions for local development on Windows (PowerShell), plus pointers for training models and troubleshooting common issues.
backend/— FastAPI server,server.py, Python dependencies inrequirements.txt,ml_models/for saved models.frontend/— React app (CRACO + Tailwind) withpackage.jsonand build output infrontend/build/.ml_training/— standalone training scripts:train_rca_models.py,train_forecasting_models.py.tests/— test helpers and unit tests (if present).- Misc docs:
AUTH_GUIDE.md,ML_TRAINING_GUIDE.md,auth_testing.md, and other notes.
- Python 3.10+ (3.11 recommended)
- Node.js 18+ and
npm(oryarn) - MongoDB instance (connection string required by backend)
- Optional: GPU for faster LSTM training
On Windows (PowerShell), use the following commands to create a Python virtual environment and activate it:
cd backend
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install --upgrade pip
pip install -r requirements.txtMake sure you have a .env file (placed in backend/) with at least the following variables set:
MONGO_URL=mongodb://<user>:<pass>@host:port
DB_NAME=your_database_name
The backend expects a running MongoDB instance and an env var MONGO_URL and DB_NAME.
From backend/ with the virtual environment active:
# activate venv if not already active
.\.venv\Scripts\Activate.ps1
# start server (reload enabled)
uvicorn server:app --host 0.0.0.0 --port 8000 --reloadThe API is mounted under /api (e.g. http://localhost:8000/api/rca/predict).
Authentication: the backend uses session tokens and calls an external auth endpoint in create_session — see backend/server.py for details. You may need to adapt the auth flow or stub it for local development.
From the frontend/ folder:
cd frontend
npm install
npm startNotes:
- If
npm installfails due to peer dependency conflicts (common with mixed versions likedate-fnsandreact-day-picker) you can either:- Run
npm install --legacy-peer-depsto bypass strict peer resolution, or - Update
frontend/package.jsonto align versions (e.g. setdate-fnsto a^3.xversion required byreact-day-picker).
- Run
If you want, I can update frontend/package.json to match react-day-picker's peer requirement.
The ml_training/ scripts generate synthetic ticket data and train models used by the backend. Example usage (from repo root):
# ensure backend venv is active (see Prerequisites)
cd ml_training
python train_rca_models.py
python train_forecasting_models.pyThese scripts save models and artifacts into backend/ml_models/. If the scripts use absolute paths (e.g. /app/backend/ml_models), create backend/ml_models and run the scripts from the repository root so the expected folders exist.
Output includes:
decision_tree.pkl,random_forest.pkl, encoder picklesticket_history.csv, SARIMA and LSTM models and plots
Run tests (if present) from the repository root:
pytest -q- The backend relies on environment variables and a reachable MongoDB. If you get a
KeyErrorforMONGO_URLorDB_NAME, createbackend/.envor export the variables in your shell before starting the app. - The frontend may require resolving peer dependency warnings. Use
--legacy-peer-depsor update versions as mentioned above. - Training scripts can be CPU intensive — reduce epochs or sample sizes when experimenting locally.
- Some scripts and docker/container-oriented paths use absolute paths (e.g.
/app/backend/...). Adjust them or run scripts from the expected working directory.
backend/server.py— main FastAPI application and ML integration (RCA, forecasting, auth helpers)backend/requirements.txt— all Python dependencies for the backendfrontend/package.json— frontend dependencies and scriptsml_training/*— training scripts and documentation