https://github.com/jchojdak/anemia-ml-service
Sub-repository for Lab Result.
https://github.com/jchojdak/anemia-ml-service
fastapi machine-learning python sklearn
Last synced: about 2 months ago
JSON representation
Sub-repository for Lab Result.
- Host: GitHub
- URL: https://github.com/jchojdak/anemia-ml-service
- Owner: jchojdak
- Created: 2025-08-22T20:12:26.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-08-22T23:20:14.000Z (10 months ago)
- Last Synced: 2025-08-23T01:32:32.498Z (10 months ago)
- Topics: fastapi, machine-learning, python, sklearn
- Language: Jupyter Notebook
- Homepage:
- Size: 708 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Anemia Detection ML Service
## Project Overview
This project provides a machine learning-based service for detecting anemia from blood test data. It leverages multiple classification models to predict anemia status and exposes the functionality via a FastAPI web service.

## Workflow
1. **Data Analysis**
- Initial data exploration, preprocessing, and model comparison were performed in the Jupyter Notebook: [`detect-anemia-by-blood-all-models.ipynb`](detect-anemia-by-blood-all-models.ipynb).
2. **Model Training**
- The script [`train_models.py`](train_models.py) was used to train several machine learning models on the processed datasets. Trained models and scalers are saved in the `models/` directory.
3. **API Implementation**
- The FastAPI application in the [`app/`](app/) directory loads the trained models and provides endpoints for anemia prediction. The main logic is organized into modules for configuration, model loading, services, and API controllers.
## Directory Structure
- `detect-anemia-by-blood-all-models.ipynb` — Data analysis and model comparison notebook
- `train_models.py` — Model training script
- `app/` — FastAPI application
- `core/` — Configuration and model loading
- `models/` — Model definitions
- `services/` — Business logic
- `api/v1/` — API endpoints
- `data/` — Source datasets
- `models/` — Saved models and scalers
- `requirements.txt` — Python dependencies
## How to Run
1. **Install dependencies**:
```bash
pip install -r requirements.txt
```
2. **Run the Jupyter Notebook** for data analysis (optional):
```bash
jupyter notebook detect-anemia-by-blood-all-models.ipynb
```
3. **Train models** (if needed):
```bash
python train_models.py
```
4. **Start the FastAPI service**:
```bash
python -m uvicorn app.main:app --reload
```
## Requirements
All required Python packages are listed in `requirements.txt`.
## Cleaning data

## Dataset overview

## Class distribution

## Feature analysis

## Machine learning models performance comparison

## Credits
- Datasets: `01-biswaranjanrao-anemia-dataset.csv`, `02-ragishehab-anemia-dataset.csv`
- - https://www.kaggle.com/datasets/biswaranjanrao/anemia-dataset
- - https://www.kaggle.com/datasets/ragishehab/anemia-data-set
- ML models: Decision Tree, Random Forest, SVM, Logistic Regression, KNN, Naive Bayes, Gradient Boosting
---