Spaces:
Sleeping
Sleeping
github-actions[bot]
commited on
Commit
·
5626843
1
Parent(s):
b003d1d
Sync from main@9f9f9d4
Browse files- Dockerfile +3 -18
- README.md +43 -4
Dockerfile
CHANGED
|
@@ -28,25 +28,10 @@ RUN uv sync --locked --no-install-project
|
|
| 28 |
# copy the rest of the files needed for inference
|
| 29 |
COPY --chown=user . .
|
| 30 |
|
| 31 |
-
|
| 32 |
-
RUN printf '%s\n' \
|
| 33 |
-
'#!/usr/bin/env sh' \
|
| 34 |
-
'set -e' \
|
| 35 |
-
'' \
|
| 36 |
-
'echo "[entrypoint] Checking DVC metadata..."' \
|
| 37 |
-
'if [ -d ".dvc" ] || [ -f "dvc.yaml" ]; then' \
|
| 38 |
-
' echo "[entrypoint] Running dvc pull..."' \
|
| 39 |
-
' uv run dvc pull -v' \
|
| 40 |
-
'else' \
|
| 41 |
-
' echo "[entrypoint] No DVC metadata found, skipping dvc pull."' \
|
| 42 |
-
'fi' \
|
| 43 |
-
'' \
|
| 44 |
-
'exec "$@"' \
|
| 45 |
-
> /home/user/entrypoint.sh \
|
| 46 |
-
&& chmod +x /home/user/entrypoint.sh
|
| 47 |
|
| 48 |
EXPOSE 7860
|
| 49 |
|
| 50 |
-
ENTRYPOINT ["/
|
| 51 |
|
| 52 |
-
CMD ["uv", "run", "uvicorn", "predicting_outcomes_in_heart_failure.app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 28 |
# copy the rest of the files needed for inference
|
| 29 |
COPY --chown=user . .
|
| 30 |
|
| 31 |
+
RUN chmod +x predicting_outcomes_in_heart_failure/app/entrypoint.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
EXPOSE 7860
|
| 34 |
|
| 35 |
+
ENTRYPOINT ["predicting_outcomes_in_heart_failure/app/entrypoint.sh"]
|
| 36 |
|
| 37 |
+
CMD ["uv", "run", "uvicorn", "predicting_outcomes_in_heart_failure.app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
CHANGED
|
@@ -17,12 +17,20 @@ app_port: 7860
|
|
| 17 |
- [Milestone 2 - Reproducibility](#milestone-2---reproducibility)
|
| 18 |
- [Milestone 3 - Quality Assurance](#milestone-3---quality-assurance)
|
| 19 |
- [Milestone 4 - API Integration](#milestone-4---API-Integration)
|
|
|
|
| 20 |
|
| 21 |
## Project Overview
|
| 22 |
<a target="_blank" href="https://cookiecutter-data-science.drivendata.org/">
|
| 23 |
<img src="https://img.shields.io/badge/CCDS-Project%20template-328F97?logo=cookiecutter" />
|
| 24 |
</a>
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
This project develops a predictive pipeline for patient outcome prediction in heart failure, using a publicly available dataset of clinical records. The goal is to design and evaluate machine learning models within a reproducible workflow that can be integrated into larger systems for clinical decision support. The workflow addresses data heterogeneity, defines consistent preprocessing and feature engineering strategies, and explores alternative modeling approaches with systematic evaluation using clinically relevant metrics. It also emphasizes model transparency and auditability, ensuring that the resulting pipeline can be deployed as a reliable, adaptable software component in healthcare applications. The project aims not only to improve baseline predictive performance but also to demonstrate how data-driven models can be effectively integrated into end-to-end AI-enabled healthcare systems.
|
| 27 |
|
| 28 |
## Project Organization
|
|
@@ -191,8 +199,6 @@ We applied an explainability module:
|
|
| 191 |
We added a **Risk Classification** analysis for the system in accordance with **IMDRF** and **AI Act** regulations.
|
| 192 |
The documentation is available in the [`docs/`](./docs) folder.
|
| 193 |
|
| 194 |
-
Ecco la versione finale **in Markdown puro**, già formattata correttamente:
|
| 195 |
-
|
| 196 |
|
| 197 |
### Milestone 4 - API Integration
|
| 198 |
|
|
@@ -202,14 +208,14 @@ APIs are structured into four main routers:
|
|
| 202 |
|
| 203 |
#### **General Router**
|
| 204 |
- **GET /**
|
| 205 |
-
Returns
|
| 206 |
|
| 207 |
|
| 208 |
#### **Prediction Router**
|
| 209 |
- **POST /predictions**
|
| 210 |
Generates a binary prediction (0/1) for a single patient sample.
|
| 211 |
|
| 212 |
-
- **POST /
|
| 213 |
Accepts a list of patient samples and returns a prediction for each element in the batch.
|
| 214 |
|
| 215 |
- **POST /explanations**
|
|
@@ -237,3 +243,36 @@ During this milestone, we also created:
|
|
| 237 |
- a **model card** documenting the champion model itself
|
| 238 |
|
| 239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
- [Milestone 2 - Reproducibility](#milestone-2---reproducibility)
|
| 18 |
- [Milestone 3 - Quality Assurance](#milestone-3---quality-assurance)
|
| 19 |
- [Milestone 4 - API Integration](#milestone-4---API-Integration)
|
| 20 |
+
- [Milestone 5 - Deployment](#milestone-5---Deployment)
|
| 21 |
|
| 22 |
## Project Overview
|
| 23 |
<a target="_blank" href="https://cookiecutter-data-science.drivendata.org/">
|
| 24 |
<img src="https://img.shields.io/badge/CCDS-Project%20template-328F97?logo=cookiecutter" />
|
| 25 |
</a>
|
| 26 |
|
| 27 |
+
[](https://github.com/se4ai2526-uniba/CardioTrack/actions/workflows/ruff-linter.yml)
|
| 28 |
+
[](https://github.com/se4ai2526-uniba/CardioTrack/actions/workflows/pynblint.yml)
|
| 29 |
+
[](https://github.com/se4ai2526-uniba/CardioTrack/actions/workflows/pytestAndGX.yml)
|
| 30 |
+
[](https://github.com/se4ai2526-uniba/CardioTrack/actions/workflows/deploy.yml)
|
| 31 |
+
[](https://www.python.org/)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
This project develops a predictive pipeline for patient outcome prediction in heart failure, using a publicly available dataset of clinical records. The goal is to design and evaluate machine learning models within a reproducible workflow that can be integrated into larger systems for clinical decision support. The workflow addresses data heterogeneity, defines consistent preprocessing and feature engineering strategies, and explores alternative modeling approaches with systematic evaluation using clinically relevant metrics. It also emphasizes model transparency and auditability, ensuring that the resulting pipeline can be deployed as a reliable, adaptable software component in healthcare applications. The project aims not only to improve baseline predictive performance but also to demonstrate how data-driven models can be effectively integrated into end-to-end AI-enabled healthcare systems.
|
| 35 |
|
| 36 |
## Project Organization
|
|
|
|
| 199 |
We added a **Risk Classification** analysis for the system in accordance with **IMDRF** and **AI Act** regulations.
|
| 200 |
The documentation is available in the [`docs/`](./docs) folder.
|
| 201 |
|
|
|
|
|
|
|
| 202 |
|
| 203 |
### Milestone 4 - API Integration
|
| 204 |
|
|
|
|
| 208 |
|
| 209 |
#### **General Router**
|
| 210 |
- **GET /**
|
| 211 |
+
Returns Gradio UI interface
|
| 212 |
|
| 213 |
|
| 214 |
#### **Prediction Router**
|
| 215 |
- **POST /predictions**
|
| 216 |
Generates a binary prediction (0/1) for a single patient sample.
|
| 217 |
|
| 218 |
+
- **POST /batch-predictions**
|
| 219 |
Accepts a list of patient samples and returns a prediction for each element in the batch.
|
| 220 |
|
| 221 |
- **POST /explanations**
|
|
|
|
| 243 |
- a **model card** documenting the champion model itself
|
| 244 |
|
| 245 |
|
| 246 |
+
### Milestone 5 - Deployment
|
| 247 |
+
|
| 248 |
+
In this milestone, we implemented:
|
| 249 |
+
|
| 250 |
+
#### User Interface
|
| 251 |
+
A graphical interface based on *Gradio* was introduced to make the system accessible to non-technical users.
|
| 252 |
+
|
| 253 |
+
Key improvements include:
|
| 254 |
+
- Addition of a Gradio UI application.
|
| 255 |
+
- Introduction of wrapper functions and a wrapper class to decouple UI and core logic.
|
| 256 |
+
- Simplification of user interaction through more people-friendly outputs.
|
| 257 |
+
|
| 258 |
+
**Explainability Support**
|
| 259 |
+
Explainability was integrated into the application workflow and exposed through the interface.
|
| 260 |
+
|
| 261 |
+
#### Containerization
|
| 262 |
+
The project was prepared for container-based execution.
|
| 263 |
+
|
| 264 |
+
- Addition of *Dockerfile* and *.dockerignore*.
|
| 265 |
+
|
| 266 |
+
|
| 267 |
+
#### Continuos Integration
|
| 268 |
+
The overall codebase quality was improved through automated linting and formatting.
|
| 269 |
+
- GitHub Actions workflow for integration.
|
| 270 |
+
- *Ruff* linter configured with automatic autofix.
|
| 271 |
+
- Introduction of *pytest* for automated testing.
|
| 272 |
+
- Integration of *Great Expectations* for automated data quality checks.
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
#### Continuos Deployment
|
| 276 |
+
Automated deployment to *Hugging Face* was implemented through Github Actions workflow
|
| 277 |
+
*Hugging Face Space*: [Check Here](https://huggingface.co/spaces/CardioTrack/CardioTrack)
|
| 278 |
+
|