Hospitals want to know which diabetic patients are likely to be readmitted within 30 days. Before any model can help, the data has to be ingested, cleaned, governed, and made queryable. This project builds that foundation on AWS, using only serverless services and a strict free-tier budget.
- 101,766
- patient encounters (UCI Diabetes 130-US Hospitals)
- 22
- AWS components wired together
- ~7 min
- for the full daily pipeline run
- ~$0.49
- estimated monthly cost against a $5 budget
The pipeline
- 01Ingesta Lambda function loads the raw CSV into the S3 bronze zone as date-partitioned JSON, while a simulator streams new records every minute
- 02CatalogueGlue crawlers discover the schemas and register them in the Glue Data Catalog
- 03Bronze to silvera PySpark Glue job casts types, removes duplicates, derives features such as age group and readmission flags, and writes partitioned Parquet
- 04Quality gatesa Lambda runs four Athena checks, and the pipeline stops if any fail
- 05Silver to golda second Glue job aggregates 40 patient cohorts with readmission rates from 2.4% to 20.1%
- 06ServeAthena for analytics, and an API that returns a cohort's readmission risk and logs every request to DynamoDB
The whole flow is orchestrated by Step Functions, runs daily at 06:00 UTC, and is monitored with CloudWatch dashboards, alarms, SNS email alerts, CloudTrail, and an AWS budget.
What the data showed
About 11% of encounters led to readmission within 30 days, 35% after more than 30 days, and 54% had no readmission. Risk varied strongly by cohort, from 2.4% to 20.1%.
An honest look at the model
A Random Forest trained on 50,000 encounters reached an AUC of 0.569. That is only modestly better than chance, and below the 0.60 to 0.65 often reported for this dataset. For that reason the deployed API uses the transparent cohort risk rates from the gold layer rather than the model.
The value of this project is the platform: reliable, governed, monitored data. A stronger model is the natural next step, and the pipeline is ready for it.
What I would do next
- Train a gradient-boosted model with richer features and deploy it as a real-time SageMaker endpoint.
- Replace the simulator with true streaming (Kinesis and HL7 FHIR).
- Add a VPC, CI/CD, and stricter healthcare compliance controls before any real patient data.