Skip to content

Random Forest Classifier model for predicting likelihood of Sepsis on ICU patients. Built API using Fast API and containerized with Docker.

License

Notifications You must be signed in to change notification settings

Azie88/Sepsis-Prediction-Fast-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sepsis-Prediction-with-Supervised-Machine-Learning

The image should showcase the integration of high

Project Overview 📖

In this project, we leverage supervised machine learning techniques, specifically classification, to develop a predictive model aimed at identifying the likelihood of sepsis occurrence among patients admitted to Intensive Care Units (ICUs). Our classification model is designed to discriminate between patients who are likely to develop sepsis and those who are not, based on a comprehensive set of features.

Sepsis is a medical term which refers to any “generalized inflammatory response associated with a serious infection”. This lethal transmitted response occurs when the host's response to infection, systemic and severe inflammation of the body, causes damage to its own tissues and organs. It is accompanied by a cytokine shock. It is a potentially life-threatening condition and risk factors include:

  • being very young or old
  • a weakened immune system from conditions such as cancer or diabetes, major trauma, and burns.

(Source : Wikipedia)

The purpose is to enhance early detection and intervention for sepsis, thereby improving patient outcomes and reducing healthcare costs associated with prolonged ICU stays and intensive treatments.

The project is guided by the CRISP-DM (Cross-Industry Standard Process for Data Mining) framework.

Project Links 🔗

Notebook Docker Image Published Article
Sepsis ML model notebook Docker image on Docker Hub Sepsis Prediction Article

Table of Contents 🔖

Some Tools Used For The Project 🛠️

vscode pandas numpy python jupyter docker

Data Fields 💾

Column Name Attribute/Target Description
ID N/A Unique number to represent patient ID
PRG Attribute1 Plasma glucose
PL Attribute 2 Blood Work Result-1 (mu U/ml)
PR Attribute 3 Blood Pressure (mm Hg)
SK Attribute 4 Blood Work Result-2 (mm)
TS Attribute 5 Blood Work Result-3 (mu U/ml)
M11 Attribute 6 Body mass index (weight in kg/(height in m)^2
BD2 Attribute 7 Blood Work Result-4 (mu U/ml)
Age Attribute 8 patients age (years)
Insurance N/A If a patient holds a valid insurance card
Sepssis Target Positive: if a patient in ICU will develop a sepsis , and Negative: otherwise

Repository Setup

Install the required packages to be able to run the API locally.

You need to have Python 3 on your system. Then you can clone this repo and being at the repo's root :: repository_name> ... follow the steps below:

  • Windows:

      python -m venv venv; venv\Scripts\activate; python -m pip install -q --upgrade pip; python -m pip install -qr requirements.txt  
    
  • Linux & MacOs:

      python3 -m venv venv; source venv/bin/activate; python -m pip install -q --upgrade pip; python -m pip install -qr requirements.txt  
    

The two long command-lines have the same structure. They pipe multiple commands using the symbol ; but you can manually execute them one after the other.

  1. Create the Python's virtual environment that isolates the required libraries of the project to avoid conflicts;
  2. Activate the Python's virtual environment so that the Python kernel & libraries will be those of the isolated environment;
  3. Upgrade Pip, the installed libraries/packages manager to have the up-to-date version that will work correctly;
  4. Install the required libraries/packages listed in the requirements.txt file so that they can be imported into the python script and notebook without any issue.

NB: For MacOs users, please install Xcode if you have an issue.

Run FastAPI

  • Run the API (being at the repository root):

    FastAPI:

    • Main

      uvicorn src.main:app --reload 
      

Here is a tutorial for fastAPI

FastAPI Screenshots

  • App documentation

Sepsis 1

  • Input

Sepsis 2

  • Prediction

Sepsis 3

Author ✍️

Andrew Obando

Connect with me on LinkedIn: LinkedIn Profile


Feel free to star ⭐ this repository if you find it helpful!

About

Random Forest Classifier model for predicting likelihood of Sepsis on ICU patients. Built API using Fast API and containerized with Docker.

Topics

Resources

License

Stars

Watchers

Forks

Languages