Skip to content

azucena-m/nursing-staffing-optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🩺 Nursing Staffing & Patient Safety Optimizer

Bridging Clinical Expertise with Data Science

Python MySQL

📝 Overview

As a healthcare professional with 10 years of clinical nursing experience, I developed this project to address a critical gap in hospital operations: how staffing composition impacts patient safety.

This tool uses Logistic Regression to quantify how patient-to-nurse ratios and team experience levels impact the probability of adverse events (e.g., falls, medication errors).


🛠️ Technical Stack

  • Backend: Python 3.13
  • Database: MySQL (Relational Schema Design)
  • Data Engineering: Pandas, SQLAlchemy, Urllib (Secure Credential Masking)
  • Statistics/ML: Statsmodels (Logit Regression)
  • Visualization: Seaborn, Matplotlib

📊 Key Findings from Latest Model Run

In the most recent analysis of 200 shifts, the model identified Nursing Experience as the primary driver of patient safety.

| Metric | Coefficient | P-Value (P>|z|) | Interpretation | | :--- | :--- | :--- | :--- | | Experience | -0.1420 | 0.019 | Significant. More experience reduces error risk. | | Staffing Ratio | -0.0648 | 0.636 | Not significant in this specific sample. | | Model Fit | Pseudo R-squ: 0.04 | LLR p-value: 0.046 | The model is statistically better than a null model. |


🚀 Project Workflow

1. Automated ETL Pipeline

The system features a "self-healing" initialization script. It automatically:

  • Creates the healthcare_db schema in MySQL if not present.
  • Handles special characters in database passwords via URL-encoding.
  • Populates tables with synthetic, logically-weighted clinical data.

2. Statistical Root Cause Analysis

Instead of basic descriptive statistics, this project utilizes a Logistic Regression model to calculate the "Log-Odds" increase in risk. In this dataset, the model proves that Experience has a higher correlation with safety than raw Ratios.

3. Predictive Alerting

The script identifies "Red Zone" shifts and exports them to a dedicated high_risk_shifts_alerts table in MySQL for administrative intervention.


📂 Project Structure

├── staffing_optimizer.py   # Main ETL and Analysis pipeline
├── requirements.txt        # Project dependencies
├── README.md               # Project documentation
└── staffing_risk_correlation.png # Saved visualization

⚙️ Installation & Usage

1. Prerequisites

  • MySQL Server: Ensure you have a local instance running.
  • Python 3.10+: Recommended for compatibility with statsmodels.

2. Environment Setup

Clone this repository and navigate to the project folder:

git clone [https://github.com/azucena-m/nursing-staffing-optimizer.git]

cd nursing-staffing-optimizer

3. Install Dependencies

pip install -r requirements.txt

4. Configuration

  1. Create a .env file in the root directory.
  2. Add your MySQL credentials to the .env file (see example below):
    DB_USER=your_user
    DB_PASSWORD=your_password
    DB_HOST=127.0.0.1
    DB_NAME=healthcare_db
    
    

5. Run the Analysis

python staffing_optimizer.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages