Globe Bank International — Customer Retention Analysis
Globe Bank International — Customer Retention Analysis Python Portfolio Project | End-to-End Customer Churn Analysis
The project is to demonstrate the use of SQL to extract meaningful insights from a hospital database. This includes analysing patient demographics, hospital stays, risk factors, and other relevant metrics to improve hospital operations and patient care.
SELECT
patient_id,
department_name
FROM appointment_analysis
WHERE department_name = 'pediatrics';
Insight: Identifies which patients have appointments in the Pediatrics department, aiding in resource management and patient distribution analysis.
SELECT AVG(days_in_the_hospital) AS average_days_cardiology
FROM hospital_records
WHERE department_name = 'Cardiology';
Insight: Calculates the average length of stay for patients in the Cardiology department, helping to assess efficiency and recovery times.
SELECT
department_name,
AVG(days_in_the_hospital) AS avg_days_per_department
FROM hospital_records
GROUP BY department_name
ORDER BY avg_days_per_department DESC;
Insight: Lists the average patient stay across all departments, highlighting departments with longer or shorter stays.
SELECT
patient_id,
days_in_the_hospital,
CASE
WHEN days_in_the_hospital <=3 THEN 'Short'
WHEN days_in_the_hospital <= 5 THEN 'Medium'
ELSE 'Long'
END AS stay_category
FROM hospital_records;
Insight: Categorizes patients based on the length of their hospital stay, aiding in resource utilization analysis.
SELECT
CASE
WHEN days_in_the_hospital <=3 THEN 'Short'
WHEN days_in_the_hospital <= 5 THEN 'Medium'
ELSE 'Long'
END AS stay_category,
COUNT(*) AS number_of_records
FROM hospital_records
GROUP BY
CASE
WHEN days_in_the_hospital <=3 THEN 'Short'
WHEN days_in_the_hospital <= 5 THEN 'Medium'
ELSE 'Long'
END;
Insight: Provides a count of patients in each stay category, useful for capacity planning.
SELECT
appointment_date,
DAYOFWEEK(appointment_date) AS day_of_the_week
FROM appointment_analysis;
Insight: Extracts the day of the week from appointment dates, useful for identifying patterns in appointment scheduling and patient flow on different days.
SELECT
appointment_time,
HOUR(appointment_time) AS appointment_hour
FROM appointment_analysis;
Insight: Provides the hour of appointments, which can help in analyzing peak times and scheduling efficiency.
SELECT
patient_id,
diagnosis,
medication_prescribed,
smoker_status,
CASE
WHEN smoker_status = 'Y' AND medication_prescribed IN ('Insulin', 'Metformin', 'Lisinopril') THEN 'Potential Safety Concern: Smoking and Medication Interactions'
ELSE 'No Safety Concern Identified'
END AS 'safety_concern'
FROM outpatient_visits;
Insight: Flags potential safety concerns related to smoking and specific medications, critical for patient safety management.
SELECT
patient_id,
patient_name,
bmi,
family_history_of_hypertension,
CASE
WHEN bmi >= 30 AND family_history_of_hypertension = 'Yes' THEN 'High Risk'
WHEN bmi >= 25 AND family_history_of_hypertension = 'Yes' THEN 'Medium Risk'
ELSE 'Low Risk'
END risk_category
FROM hospital_records;
Insight: Classifies patients into risk categories based on BMI and family history, supporting targeted health interventions.
SELECT
gender,
CASE
WHEN TIMESTAMPDIFF(YEAR, date_of_birth, CURDATE()) BETWEEN 18 AND 30 THEN '18-30'
WHEN TIMESTAMPDIFF(YEAR, date_of_birth, CURDATE()) BETWEEN 31 AND 50 THEN '31-50'
WHEN TIMESTAMPDIFF(YEAR, date_of_birth, CURDATE()) BETWEEN 51 AND 70 THEN '51-70'
ELSE '71+'
END AS age_group,
COUNT(*) AS patient_count
FROM patients_table AS p
INNER JOIN outpatient_visits AS ov
ON p.patient_id = ov.patient_id
WHERE diagnosis = 'Diabetes'
GROUP BY
gender,
CASE
WHEN TIMESTAMPDIFF(YEAR, date_of_birth, CURDATE()) BETWEEN 18 AND 30 THEN '18-30'
WHEN TIMESTAMPDIFF(YEAR, date_of_birth, CURDATE()) BETWEEN 31 AND 50 THEN '31-50'
WHEN TIMESTAMPDIFF(YEAR, date_of_birth, CURDATE()) BETWEEN 51 AND 70 THEN '51-70'
ELSE '71+'
END;
Insight: Provides demographic characteristics of diabetic patients, aiding in understanding population distribution and tailoring healthcare services.
This documentation highlights essential SQL queries used in analyzing hospital data. These queries help in patient care management, risk assessment, and demographic analysis, contributing to better decision-making in hospital operations.
Globe Bank International — Customer Retention Analysis Python Portfolio Project | End-to-End Customer Churn Analysis
Training Analytics Dashboard Power BI Portfolio Project | Data-Driven Talent Development Insights
Introduction This SQL project involves analyzing the sales and customer data of H+ Sport, a fictitious company that sells nutritional products and active lif...
Introduction The project is to demonstrate the use of SQL to extract meaningful insights from a hospital database. This includes analysing patient demographi...
Your brain has two systems, a slow analytical side and a quick, instinctive “gut” side. For the most part, the instinctual side is lazy, conserving its energ...
“Color does not add a pleasant quality to design—it reinforces it.” — Pierre Bonnard
Tips for Designing a Color Palette In the first two sections of this book, Color Limitations and Color and Emotions, we looked at some interesting facts abou...
Color and Emotions Mention Thanksgiving to any American and they will paint a picture in their head with gold, orange, red, and brown hues. It will also like...