{"id":30734741,"url":"https://github.com/jchojdak/anemia-ml-service","last_synced_at":"2026-05-02T18:35:36.857Z","repository":{"id":311236505,"uuid":"1042926221","full_name":"jchojdak/anemia-ml-service","owner":"jchojdak","description":"Sub-repository for Lab Result.","archived":false,"fork":false,"pushed_at":"2025-08-22T23:20:14.000Z","size":725,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-23T01:32:32.498Z","etag":null,"topics":["fastapi","machine-learning","python","sklearn"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jchojdak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-22T20:12:26.000Z","updated_at":"2025-08-22T23:26:03.000Z","dependencies_parsed_at":"2025-08-23T01:32:33.889Z","dependency_job_id":"2306ac0f-906b-4354-8283-0df574ac25e2","html_url":"https://github.com/jchojdak/anemia-ml-service","commit_stats":null,"previous_names":["jchojdak/anemia-ml-service"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/jchojdak/anemia-ml-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchojdak%2Fanemia-ml-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchojdak%2Fanemia-ml-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchojdak%2Fanemia-ml-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchojdak%2Fanemia-ml-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jchojdak","download_url":"https://codeload.github.com/jchojdak/anemia-ml-service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchojdak%2Fanemia-ml-service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273494100,"owners_count":25115705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","machine-learning","python","sklearn"],"created_at":"2025-09-03T19:15:15.869Z","updated_at":"2025-10-24T23:06:41.304Z","avatar_url":"https://github.com/jchojdak.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Anemia Detection ML Service\n\n## Project Overview\nThis 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.\n\n\u003cimg width=\"911\" height=\"240\" alt=\"image\" src=\"https://github.com/user-attachments/assets/777e16a9-1b45-437d-bffb-680335963b85\" /\u003e\n\u003cimg width=\"429\" height=\"681\" alt=\"image\" src=\"https://github.com/user-attachments/assets/802a95b6-a27e-44a9-acd6-61a296b7849c\" /\u003e\n\n\n## Workflow\n1. **Data Analysis**\n   - 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).\n\n2. **Model Training**\n   - 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.\n\n3. **API Implementation**\n   - 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.\n\n## Directory Structure\n- `detect-anemia-by-blood-all-models.ipynb` — Data analysis and model comparison notebook\n- `train_models.py` — Model training script\n- `app/` — FastAPI application\n  - `core/` — Configuration and model loading\n  - `models/` — Model definitions\n  - `services/` — Business logic\n  - `api/v1/` — API endpoints\n- `data/` — Source datasets\n- `models/` — Saved models and scalers\n- `requirements.txt` — Python dependencies\n\n## How to Run\n1. **Install dependencies**:\n   ```bash\n   pip install -r requirements.txt\n   ```\n2. **Run the Jupyter Notebook** for data analysis (optional):\n   ```bash\n   jupyter notebook detect-anemia-by-blood-all-models.ipynb\n   ```\n3. **Train models** (if needed):\n   ```bash\n   python train_models.py\n   ```\n4. **Start the FastAPI service**:\n   ```bash\n   python -m uvicorn app.main:app --reload\n   ```\n\n## Requirements\nAll required Python packages are listed in `requirements.txt`.\n\n## Cleaning data\n\u003cimg width=\"418\" height=\"144\" alt=\"image\" src=\"https://github.com/user-attachments/assets/7677ba35-7824-43e8-9acf-309651e3cfbc\" /\u003e\n\n## Dataset overview\n\u003cimg width=\"438\" height=\"451\" alt=\"image\" src=\"https://github.com/user-attachments/assets/0fdcab63-38f5-4a1c-ac5e-c30de9fd2949\" /\u003e\n\n## Class distribution\n\u003cimg width=\"1313\" height=\"674\" alt=\"image\" src=\"https://github.com/user-attachments/assets/c2e9fe25-34d7-4e06-826c-3425fe3e4b93\" /\u003e\n\n## Feature analysis\n\u003cimg width=\"592\" height=\"536\" alt=\"image\" src=\"https://github.com/user-attachments/assets/746a22b1-ddff-4da7-8244-ab03b4bf058e\" /\u003e\n\u003cimg width=\"936\" height=\"626\" alt=\"image\" src=\"https://github.com/user-attachments/assets/9ef64421-6cc9-4f6b-b9f3-7cb0d7d007ec\" /\u003e\n\n## Machine learning models performance comparison\n\u003cimg width=\"1156\" height=\"799\" alt=\"image\" src=\"https://github.com/user-attachments/assets/936a1d95-c5a0-482f-b2ed-a082c2372811\" /\u003e\n\n## Credits\n- Datasets: `01-biswaranjanrao-anemia-dataset.csv`, `02-ragishehab-anemia-dataset.csv`\n- - https://www.kaggle.com/datasets/biswaranjanrao/anemia-dataset\n- - https://www.kaggle.com/datasets/ragishehab/anemia-data-set\n- ML models: Decision Tree, Random Forest, SVM, Logistic Regression, KNN, Naive Bayes, Gradient Boosting\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchojdak%2Fanemia-ml-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjchojdak%2Fanemia-ml-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchojdak%2Fanemia-ml-service/lists"}