This project is part of the Software Engineering for Machine Learning Systems course at Imperial College.
This project focuses on acute kidney injury (AKI) and is designed to provide hospitals with a comprehensive environment for disease prediction and alerting healthcare staff.
Before deploying a system to detect acute kidney injury from blood tests in the hospital production environment, we conduct our tests using a simulator.
Our system is designed to detect acute kidney injury (AKI) in real-time by processing HL7 messages received from the hospital’s Patient Administration System (PAS) and Laboratory Information Management System (LIMS). It ensures that the clinical team is promptly alerted whenever AKI is detected, enabling timely intervention and improving patient outcomes.
The system starts with the HL7 Input Parser, which listens for incoming HL7 messages over TCP/IP using the MLLP protocol. This listener acts as a gateway, validating, parsing, and routing incoming messages to the rest of the system. It processes the HL7 messages the PAS and LIMS generate. Messages are classified based on type, such as patient admissions/discharges (ADT^A01, ADT^A03) or blood test results (ORU^R01). The HL7 Input Parser is also responsible for storing the data needed for the AKI detection in the database.
The Patient Database serves as the central repository for all patient-related data needed for aki detection, including demographic details, admission/discharge states, and historical test results. This database supports accurate AKI predictions by maintaining consistent, accessible records for the AKI model.
The Data Processor is the core analytical component. For blood test messages, it extracts key details like the patient’s MRN, timestamp, and creatinine levels. It combines this data with the patient’s historical test records retrieved from the centralised Patient Database. Using the predictive AKI model, the predictor determines if the patient is at risk for AKI. If AKI is detected, an alert is prepared for immediate action.
Alerts are sent via the Pager System using an HTTP POST request, including the patient’s MRN and the timestamp of the triggering test result. This ensures that the clinical response team is notified as soon as a risk is identified, allowing for swift medical intervention.
Additionally, the system incorporates Monitoring and Logging to track performance metrics, log processed messages, and ensure system reliability. This capability supports debugging, auditing, and operational oversight.
Clone the repository and install the required dependencies:
bash pip install -r requirements.txt
To run the prediction system, use the Dockerfile file:
- Build the Docker image for the prediction system:
docker build -t aki-prediction . - Run the Docker container for the prediction system:
docker run -e MLLP_ADDRESS="127.0.0.1:8440" -e PAGER_ADDRESS="127.0.0.1:8441" aki-prediction
Unit and integration tests have been written using Pytest.
To run these tests, use the following commands:
- Install development dependencies:
pip install -r requirements-dev.txt
- Run tests:
python -m pytest
Building and pushing the image:
docker build -t imperialswemlsspring2025.azurecr.io/coursework6-devesa .docker push imperialswemlsspring2025.azurecr.io/coursework6-devesaApply the config:
kubectl apply -f kube_config.yamlGet the deployments:
kubectl --namespace=devesa get deploymentsGet the logs
kubectl logs --namespace=devesa -l app=aki-detection --tail=100Forward port 8000 to get Prometheus metrics
kubectl -n devesa port-forward <pod_name> 8000:8000
