How youngturing/stroke-prediction works
This repository is a stroke-probability application: users submit patient features to a FastAPI endpoint, which validates and preprocesses them, loads a serialized classifier, and returns a probability. A separate modeling workflow loads transformed stroke data, splits and optionally oversamples it, trains classifiers, evaluates them, and saves model and metric artifacts. The repository also includes a dataset-download utility. The inference model artifact is referenced by the API but is not present in the file tree; edges reflect only relationships shown in the excerpts or README.
Main entry points: main.py FastAPI routes · model.py Training workflow · download_stroke_dataset.py Dataset downloader · stroke_data_transformed.csv Transformed stroke data
Components 16
Prediction API
- FastAPI routes
app/main.py - Patient input model
app/main.py - Feature preparation
app/main.py - Serialized classifier
- Prediction response
app/main.py
Model development
- Training workflow
model/model.py - Data loading
model/model.py - Split and SMOTE
model/model.py - Classifier training
model/model.py - Model evaluation
model/model.py - Trained model files
- Evaluation metrics
model/model.py
Dataset
- Dataset downloader
data/download_stroke_dataset.py - Transformed stroke data
data/stroke_data_transformed.csv
Other components
- Application user
- Kaggle dataset service
Connections 15
- Application user → FastAPI routes: submits features
README.md - FastAPI routes → Patient input model: validates input
app/main.py - FastAPI routes → Feature preparation: prepares features
app/main.py - FastAPI routes → Serialized classifier: loads model
app/main.py - FastAPI routes → Serialized classifier: requests probability
app/main.py - FastAPI routes → Prediction response: returns prediction
app/main.py - Training workflow → Data loading: loads data
model/model.py - Data loading → Transformed stroke data: reads CSV
model/model.py - Training workflow → Split and SMOTE: splits and resamples
model/model.py - Training workflow → Classifier training: trains classifiers
model/model.py - Classifier training → Trained model files: saves models
model/model.py - Training workflow → Model evaluation: evaluates models
model/model.py - Model evaluation → Trained model files: loads models
model/model.py - Model evaluation → Evaluation metrics: writes metrics
model/model.py - Dataset downloader → Kaggle dataset service: downloads archive
data/download_stroke_dataset.py