top of page

Insulin or Inequity? Exploring Treatment Patterns in Diabetic Inpatients

  • Writer: Tim Neill
    Tim Neill
  • Apr 28
  • 3 min read

Updated: Jun 27

Can data expose hidden truths in healthcare? That question drove me as I explored treatment patterns in over 70,000 diabetic inpatie nt records. Like a well-crafted documentary, the numbers began to tell a story - one of potential disparities, unexpected patterns, and deeper questions about equity in care. What started as a SQL project quickly became something more meaningful.


Why This Project?

My motivation for choosing this project came from a deep interest in both healthcare and data analysis. I’ve always believed that data has the power to uncover inequalities—especially in a field that touches so many lives. I wanted to explore whether patients from different backgrounds truly receive the same level of care. This project felt unique because it allowed me to combine technical skills with a socially meaningful question:

Do demographic factors influence the intensity of inpatient diabetes treatment, and are all patients being treated equally?

What You Will Gain:

By reading this article, you'll gain insight into:

  • The relationship between patient demographics and treatment intensity.

  • How the number of lab procedures influences hospital stays.

  • Variations in treatment across different medical specialties.

  • The efficiency of care provided to emergency patients.


Key Takeaways:
  • Racial disparities exist in treatment patterns.

  • More lab procedures lead to longer hospital stays.

  • Certain medical specialties perform more procedures than others.

  • The majority of patients have short hospital stays, but longer stays are often linked to higher care needs.


Dataset Details:

The dataset I used comes from Kaggle, containing over 70,000 clinical records of diabetic inpatients. Each record gives insight into patient demographics, admissions, procedures, and medications. Using this de-identified data is a great way to analyze real-world trends in healthcare, providing a solid foundation for my findings.


Analysis Process:

I began by cleaning the data to ensure accuracy. It was essential to transform the data into formats suitable for analysis. I used SQL to run queries that helped reveal patterns. I was surprised by how significant the findings were—especially regarding racial disparities in treatment and how treatment intensity correlates with longer hospital stays.


Visuals and Insights:

Average Lab Procedures by Race

Table showing average lab procedures by race: AfricanAmerican 44.1, unspecified 44, Other 43.7, Caucasian 42.8, Hispanic 42.7, Asian 40.9.

This table shows African-American patients had more lab procedures, hinting at potential disparities in treatment intensity.


Lab Procedures vs. Hospital Stay Groups

Table with two columns: "avg_time" and "procedure_frequency." Rows show data: 3.28 few, 3.92 average, 5.43 many. White background.

The summary table categorizes patients based on lab procedures and average hospital stay, suggesting that more procedures often mean longer stays.


Medical Specialties with High Procedure Counts

Table displaying medical specialties with average procedures and counts: Surgery-Thoracic, Surgery-Cardiovascular/Thoracic, Radiologist, Cardiology, Surgery-Vascular.

This table demonstrates that specialties like Thoracic Surgery and Cardiology performed more procedures, indicating high resource use.


Distribution of Hospital Stay Lengths

Bar chart displaying data over 14 days. "patent_total" and "bar" labeled columns show decreasing asterisks representing values.

The histogram illustrates most patients are discharged within 7 days, indicating efficient throughput for many cases.


Percentage of Patients Discharged Under 3 and 7 Days

Table with columns: "percent_under_3_days" showing 48.3%, and "percent_under_7_days" showing 85.0%. White background.
A summary table showing nearly half of patients discharge within 3 days and 85% within 7 days - short stays are typical.
Table with text "avg_length_of_stay" at the top and "4.4" below, indicating average stay duration. Simple, white background.

The average stay amongst all inpatients was 4.4 days.


Treatment Intensity: Short vs. Long Stays

Table comparing hospital stays: Short Stay (≤7 days) vs. Long Stay (>7 days), showing avg. lab procedures, medications, and emergency visits.
This table compares lab procedures and medications between short and long stays, confirming that longer stays usually involve higher acuity.
Main Takeaways:

This project highlighted how data can reveal important patterns in healthcare. I learned that understanding treatment intensity and its correlation with demographics is vital in addressing potential disparities among diabetic inpatients. By using SQL for real-world analysis, I was able to quantify differences in care that can lead to better decision-making in healthcare settings.


Conclusion and Personal Reflections:

This project taught me more than just technical skills—it showed me the power of data to surface hidden stories and challenge assumptions. From cleaning messy records to uncovering meaningful patterns, every step deepened my interest in using analytics to drive real-world impact. I'm excited to keep asking hard questions and using data to help shape a more equitable future in healthcare.


Call To Action:

I’d love to connect with like-minded individuals on LinkedIn. If you’re interested in data analysis or healthcare, let’s chat!


The README File:


bottom of page