How glaucojrcarvalho/customer-churn-saas works
This repository is a FastAPI customer-churn prediction service. Customers submit records as JSON or upload a CSV; the corresponding route validates or normalizes the input, runs the saved classifier pipeline, and returns churn probabilities with labels. A separate training workflow reads labeled data, prepares features, fits the pipeline, and saves the model artifact used by both routes. The graph follows the sampled route and training code plus README-documented capabilities; unsampled implementation details are not inferred.
Main entry points: predict.py JSON prediction · upload.py CSV upload · train_model.py Pipeline training · main.py FastAPI app
Components 9
API
- FastAPI app
app/main.py - JSON prediction
app/routers/predict.py - CSV upload
app/routers/upload.py - Request and response schemas
app/utils/schemas.py
Prediction
- Feature normalization
app/services/preprocessing.py - Saved model pipeline
app/models/churn_pipeline.pkl
Model training
- Pipeline training
app/services/train_model.py - Training dataset
data/train.csv
Other components
- Customer
Connections 12
- Customer → FastAPI app: submits request
README.md - FastAPI app → JSON prediction: routes /predict
app/main.py - FastAPI app → CSV upload: routes /upload
app/main.py - JSON prediction → Request and response schemas: validates and formats
app/routers/predict.py - CSV upload → Request and response schemas: formats results
app/routers/upload.py - JSON prediction → Feature normalization: normalizes records
app/routers/predict.py - CSV upload → Feature normalization: normalizes rows
app/routers/upload.py - JSON prediction → Saved model pipeline: loads and predicts
app/routers/predict.py - CSV upload → Saved model pipeline: loads and predicts
app/routers/upload.py - Pipeline training → Training dataset: reads labeled data
README.md - Pipeline training → Feature normalization: uses feature preparation
app/services/train_model.py - Pipeline training → Saved model pipeline: saves fitted pipeline
README.md