
Diabetics on More Meds, More Returns: What’s Going Wrong with Their Care?
Using SQL and patient records from over 100,000 patients, I explored how medications, lab tests, and care changes affect hospital readmission risk.
In 2011 alone, American hospitals spent over $41 billion on diabetic patients who were readmitted within 30 days. That’s not just a financial drain—it’s a flashing red light pointing to potential gaps in care.
Using real-world claims data from 107,766 hospital encounters, I explored which factors most influence diabetic readmissions—and how hospitals could predict and prevent them using SQL and data analytics.
In today’s healthcare world, where Medicare ties payment to outcomes, these insights aren’t just interesting—they’re essential.

💭 What I Asked the Data
1. Are Diabetic Patients on More Meds Coming Back Sooner?
Are Certain Diabetes Medications Linked to Faster Returns?
Does Changing Treatment Actually Help—or Hurt?
Which Specialties Have the Highest Early Readmissions?
Are We Sending Patients Home Without Proper Testing?
🔎 What the Data Reveals
Are Diabetic Patients on More Meds Coming Back Sooner?
🟣 Query 1 – Readmission Status vs. Avg. Medications
What it does:
Groups patients by readmission status:
<30 days
>30 days
NO readmission
Then it calculates:
the average number of medications for each group
the total number of patients per group
Are Diabetic Patients on More Meds Coming Back Sooner?
Are Certain Diabetes Medications Linked to Faster Returns?
Does Changing Treatment Actually Help—or Hurt?
Which Specialties Have the Highest Early Readmissions?
Are We Sending Patients Home Without Proper Testing?

🟣 Query 2 – Readmission Rates by Medication Intensity
This SQL query groups patients into four medication buckets based on how many medications they were prescribed during their hospital stay:
Low (≤5 meds)
Medium (6–10)
High (11–15)
Very High (16+ meds)
Then it calculates:
The total number of patients in each group
The number of early readmissions (within 30 days)
The readmission rate percentage for each group
Are Diabetic Patients on More Meds Coming Back Sooner?
Are Certain Diabetes Medications Linked to Faster Returns?
Does Changing Treatment Actually Help—or Hurt?
Which Specialties Have the Highest Early Readmissions?
Are We Sending Patients Home Without Proper Testing?

Are Certain Diabetes Medications Linked to Faster Returns?
🟣Query 3 – Readmission Rates by Medication Type (Insulin, Metformin, Both, Neither).
This SQL query compares 30-day hospital readmission rates across four medication groups:
Patients taking only insulin
Patients taking only metformin
Patients taking both insulin and metformin
Patients taking neither
Using a CASE statement, it categorizes patients based on their medication records, then calculates:
The total number of patients in each group
The number of patients readmitted within 30 days
The readmission rate percentage for each group
This helps identify whether medication type or combination is linked to faster returns to the hospital.

Does Changing Treatment Actually Help—or Hurt?
🟣Query 4 – Readmission Rates by Treatment Change (Yes vs. No)
This SQL query checks whether changing a patient’s medication during their hospital stay is linked to a higher chance of readmission.
It groups patients by the change1 column (where:
'Ch' = medication changed
'No' = medication not changed),
Then it calculates:
The total number of patients in each group
The number of early readmissions (within 30 days)
The readmission rate percentage, with a % sign added for clarity
The results help highlight whether treatment changes may be helping or hurting patient recovery.

Which Specialties Have the Highest Early Readmissions?
🟣 Query 5 – Readmission Rates by Medical Specialty
This SQL query identifies which medical specialties are associated with the highest early (30-day) hospital readmission rates.
It does three things:
Groups patients by medical_specialty
Counts:
Total number of patients in each specialty
Number of patients readmitted within 30 days
Calculates the readmission rate as a percentage, formatted with % for clarity
To keep the table clean:
It uses the actual calculation inside the ORDER BY to sort by readmission rate
It does not display the numeric helper column, keeping only the formatted % column

Are We Sending Patients Home Without Proper Testing?
🟣 Query 6 - Impact of Missing Lab Tests on Readmission Rates
This SQL query groups patients into four categories based on whether they received A1C and/or glucose testing before discharge:
No Tests
A1C Only
Glucose Only
Both Tests
It uses a CASE statement to label each group, then calculates:
Total number of patients in each group
Number of patients readmitted within 30 days
Readmission rate percentage for each group
This helps us explore whether skipping routine lab testing is linked to increased early hospital returns — and whether more consistent testing might help reduce readmissions.

Deep Insights
1. Medication Load & Readmission Risk
Patients taking 16+ medications had the highest early readmission rate (12.48%), while those on 5 or fewer had just 7.48%.
💡 More medications = higher readmission risk. While this may seem expected—sicker patients need more meds—it could also signal a deeper issue: Are hospitals doing enough to keep these high-risk patients from bouncing back? A medication review at discharge could simplify treatment and help prevent returns.
2. Medication Type Matters
Insulin users had the highest readmission rate (12.14%), compared to 10.27% for those not on any diabetes medication. Interestingly, metformin-only users had the lowest rate (9.31%).
💡 This suggests that insulin might not always be the most effective standalone option. Hospitals should examine whether patients on insulin are receiving adequate support, or if treatment plans need revision.
3. Treatment Changes = Trouble?
Patients whose medications were changed during their visit had a slightly higher readmission rate (11.04%) than those whose treatment remained steady (10.48%).
💡 Even small differences at scale can matter. This raises questions about how well treatment changes are communicated or implemented. Better follow-up or patient education may reduce bounce-backs.
4. Diabetes-Relevant Specialties Still Show High Readmission
Specialties like Nephrology (10.88%), Surgery-Vascular (10.26%), and General Practice (9.71%)—closely tied to diabetes care—rank among the top for early readmission.
💡 Hospitals could dig deeper into these departments' care paths to identify what’s leading to returns. More care coordination or preventive steps may be needed.
5. Missing Lab Tests = Missed Opportunities
Patients with NO A1C (3-month blood sugar check) or glucose tests had a higher readmission rate (11.42%) than those who were tested (as low as 8.87%).
💡 Testing matters. When hospitals skip key diabetes labs, they may miss early signs of instability. Ensuring labs are done before discharge could lower returns.
My Takeaways
Diabetes is a deeply complex condition — and even with data, there's no single answer that guarantees better outcomes. But one thing is clear from this project: many patients are struggling, and the numbers reflect a systemic issue.
The insights uncovered here don’t just raise questions for hospitals. They point toward the pharmaceutical and food industries as well. We all know diabetes is tightly linked to what we eat — and while medications may help control symptoms like high blood sugar or cholesterol, they often come with side effects that can harm other systems in the body.
Hospitals are often the last stop for diabetic patients in crisis. So maybe the solution shouldn’t rest solely on hospitals — but also on the combined efforts of healthcare, pharma, and the food industry. These sectors must work together, share data, and analyze outcomes to better understand:
How certain foods contribute to diabetes
How medications affect long-term health
And how we can shift from reactive care to proactive prevention
This project doesn’t just tell a story in numbers — it raises important questions about how we treat chronic illness in modern society.

Want to See Your Numbers Grow?
I'm open to full-time roles as a Data Analyst or Business Analyst, and also available for freelance or project-based work.
If you're a stakeholder who values growth, clarity, and insights that drive action, let’s connect.
I turn messy data into meaningful stories that help companies scale smarter, optimize faster, and waste less.
Email: data@lubobali.com
LinkedIn: linkedin.com/in/lubo-bali
Website: www.lubobali.com

My Takeaways
Diabetes is a deeply complex condition — and even with data, there's no single answer that guarantees better outcomes. But one thing is clear from this project: many patients are struggling, and the numbers reflect a systemic issue.
The insights uncovered here don’t just raise questions for hospitals. They point toward the pharmaceutical and food industries as well. We all know diabetes is tightly linked to what we eat — and while medications may help control symptoms like high blood sugar or cholesterol, they often come with side effects that can harm other systems in the body.
Hospitals are often the last stop for diabetic patients in crisis. So maybe the solution shouldn’t rest solely on hospitals — but also on the combined efforts of healthcare, pharma, and the food industry. These sectors must work together, share data, and analyze outcomes to better understand:
How certain foods contribute to diabetes
How medications affect long-term health
And how we can shift from reactive care to proactive prevention
This project doesn’t just tell a story in numbers — it raises important questions about how we treat chronic illness in modern society.


Are We Sending Patients Home Without Proper Testing?
🟣 Query 6 - Impact of Missing Lab Tests on Readmission Rates
This SQL query groups patients into four categories based on whether they received A1C and/or glucose testing before discharge:
No Tests
A1C Only
Glucose Only
Both Tests
It uses a CASE statement to label each group, then calculates:
Total number of patients in each group
Number of patients readmitted within 30 days
Readmission rate percentage for each group
This helps us explore whether skipping routine lab testing is linked to increased early hospital returns — and whether more consistent testing might help reduce readmissions.
Does Changing Treatment Actually Help—or Hurt?
🟣Query 4 – Readmission Rates by Treatment Change (Yes vs. No)
This SQL query checks whether changing a patient’s medication during their hospital stay is linked to a higher chance of readmission.
It groups patients by the change1 column (where:
'Ch' = medication changed
'No' = medication not changed),
Then it calculates:
The total number of patients in each group
The number of early readmissions (within 30 days)
The readmission rate percentage, with a % sign added for clarity
The results help highlight whether treatment changes may be helping or hurting patient recovery.


Are Certain Diabetes Medications Linked to Faster Returns?
🟣Query 3 – Readmission Rates by Medication Type (Insulin, Metformin, Both, Neither).
This SQL query compares 30-day hospital readmission rates across four medication groups:
Patients taking only insulin
Patients taking only metformin
Patients taking both insulin and metformin
Patients taking neither
Using a CASE statement, it categorizes patients based on their medication records, then calculates:
The total number of patients in each group
The number of patients readmitted within 30 days
The readmission rate percentage for each group
This helps identify whether medication type or combination is linked to faster returns to the hospital.


🟣 Query 2 – Readmission Rates by Medication Intensity
This SQL query groups patients into four medication buckets based on how many medications they were prescribed during their hospital stay:
Low (≤5 meds)
Medium (6–10)
High (11–15)
Very High (16+ meds)
Then it calculates:
The total number of patients in each group
The number of early readmissions (within 30 days)
The readmission rate percentage for each group
Are Diabetic Patients on More Meds Coming Back Sooner?
Are Certain Diabetes Medications Linked to Faster Returns?
Does Changing Treatment Actually Help—or Hurt?
Which Specialties Have the Highest Early Readmissions?
Are We Sending Patients Home Without Proper Testing?




💭 What I Asked the Data
1. Are Diabetic Patients on More Meds Coming Back Sooner?
Are Certain Diabetes Medications Linked to Faster Returns?
Does Changing Treatment Actually Help—or Hurt?
Which Specialties Have the Highest Early Readmissions?
Are We Sending Patients Home Without Proper Testing?
🔎 What the Data Reveals
Are Diabetic Patients on More Meds Coming Back Sooner?
🟣 Query 1 – Readmission Status vs. Avg. Medications
What it does:
Groups patients by readmission status:
<30 days
>30 days
NO readmission
Then it calculates:
the average number of medications for each group
the total number of patients per group
Are Diabetic Patients on More Meds Coming Back Sooner?
Are Certain Diabetes Medications Linked to Faster Returns?
Does Changing Treatment Actually Help—or Hurt?
Which Specialties Have the Highest Early Readmissions?
Are We Sending Patients Home Without Proper Testing?
In 2011 alone, American hospitals spent over $41 billion on diabetic patients who were readmitted within 30 days. That’s not just a financial drain—it’s a flashing red light pointing to potential gaps in care.
Using real-world claims data from 107,766 hospital encounters, I explored which factors most influence diabetic readmissions—and how hospitals could predict and prevent them using SQL and data analytics.
In today’s healthcare world, where Medicare ties payment to outcomes, these insights aren’t just interesting—they’re essential.


Which Specialties Have the Highest Early Readmissions?
🟣 Query 5 – Readmission Rates by Medical Specialty
This SQL query identifies which medical specialties are associated with the highest early (30-day) hospital readmission rates.
It does three things:
Groups patients by medical_specialty
Counts:
Total number of patients in each specialty
Number of patients readmitted within 30 days
Calculates the readmission rate as a percentage, formatted with % for clarity
To keep the table clean:
It uses the actual calculation inside the ORDER BY to sort by readmission rate
It does not display the numeric helper column, keeping only the formatted % column




Deep Insights
1. Medication Load & Readmission Risk
Patients taking 16+ medications had the highest early readmission rate (12.48%), while those on 5 or fewer had just 7.48%.
💡 More medications = higher readmission risk. While this may seem expected—sicker patients need more meds—it could also signal a deeper issue: Are hospitals doing enough to keep these high-risk patients from bouncing back? A medication review at discharge could simplify treatment and help prevent returns.
2. Medication Type Matters
Insulin users had the highest readmission rate (12.14%), compared to 10.27% for those not on any diabetes medication. Interestingly, metformin-only users had the lowest rate (9.31%).
💡 This suggests that insulin might not always be the most effective standalone option. Hospitals should examine whether patients on insulin are receiving adequate support, or if treatment plans need revision.
3. Treatment Changes = Trouble?
Patients whose medications were changed during their visit had a slightly higher readmission rate (11.04%) than those whose treatment remained steady (10.48%).
💡 Even small differences at scale can matter. This raises questions about how well treatment changes are communicated or implemented. Better follow-up or patient education may reduce bounce-backs.
4. Diabetes-Relevant Specialties Still Show High Readmission
Specialties like Nephrology (10.88%), Surgery-Vascular (10.26%), and General Practice (9.71%)—closely tied to diabetes care—rank among the top for early readmission.
💡 Hospitals could dig deeper into these departments' care paths to identify what’s leading to returns. More care coordination or preventive steps may be needed.
5. Missing Lab Tests = Missed Opportunities
Patients with NO A1C (3-month blood sugar check) or glucose tests had a higher readmission rate (11.42%) than those who were tested (as low as 8.87%).
💡 Testing matters. When hospitals skip key diabetes labs, they may miss early signs of instability. Ensuring labs are done before discharge could lower returns.
5. Missing Lab Tests = Missed Opportunities
Patients with NO A1C (3-month blood sugar check) or glucose tests had a higher readmission rate (11.42%) than those who were tested (as low as 8.87%).
💡 Testing matters. When hospitals skip key diabetes labs, they may miss early signs of instability. Ensuring labs are done before discharge could lower returns.




Want to See Your Numbers Grow?
I'm open to full-time roles as a Data Analyst or Business Analyst, and also available for freelance or project-based work.
If you're a stakeholder who values growth, clarity, and insights that drive action, let’s connect.
I turn messy data into meaningful stories that help companies scale smarter, optimize faster, and waste less.
Email: data@lubobali.com
LinkedIn: linkedin.com/in/lubo-bali
Website: www.lubobali.com

Diabetics on More Meds, More Returns: What’s Going Wrong with Their Care?
Using SQL and patient records from over 100,000 patients, I explored how medications, lab tests, and care changes affect hospital readmission risk.
