From cb352bf9d14fde5c03d69887a6af730a13014f86 Mon Sep 17 00:00:00 2001 From: fbraza Date: Sat, 19 Jul 2025 11:56:40 +0200 Subject: [PATCH 1/2] fix: standardize import statements for package consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Convert relative imports to absolute imports using vitals package prefix - Update imports in biomarkers, phenoage, and score2 modules - Ensure consistent import style across the codebase - Fixes #3 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode --- vitals/biomarkers/helpers.py | 3 ++- vitals/biomarkers/io.py | 2 +- vitals/phenoage/compute.py | 3 ++- vitals/score2/compute.py | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/vitals/biomarkers/helpers.py b/vitals/biomarkers/helpers.py index 7029503..6c0fd9c 100755 --- a/vitals/biomarkers/helpers.py +++ b/vitals/biomarkers/helpers.py @@ -1,8 +1,9 @@ from typing import TypeVar -import schemas from pydantic import BaseModel +from vitals.biomarkers import schemas + Biomarkers = TypeVar("Biomarkers", bound=BaseModel) Units = schemas.PhenoageUnits | schemas.Score2Units diff --git a/vitals/biomarkers/io.py b/vitals/biomarkers/io.py index f9ed937..8858e1b 100755 --- a/vitals/biomarkers/io.py +++ b/vitals/biomarkers/io.py @@ -1,7 +1,7 @@ import json from pathlib import Path -import helpers +from vitals.biomarkers import helpers def update(input_file: Path) -> dict: diff --git a/vitals/phenoage/compute.py b/vitals/phenoage/compute.py index eb404ad..5397876 100755 --- a/vitals/phenoage/compute.py +++ b/vitals/phenoage/compute.py @@ -1,7 +1,8 @@ import numpy as np -from biomarkers import helpers, schemas from pydantic import BaseModel +from vitals.biomarkers import helpers, schemas + class LinearModel(BaseModel): """ diff --git a/vitals/score2/compute.py b/vitals/score2/compute.py index 457e08d..107d227 100644 --- a/vitals/score2/compute.py +++ b/vitals/score2/compute.py @@ -6,9 +6,10 @@ """ import numpy as np -from biomarkers import helpers, schemas from pydantic import BaseModel +from vitals.biomarkers import helpers, schemas + class ModelCoefficients(BaseModel): """ From 1a25f488cf53d93cb17da95aff12baaf550e505a Mon Sep 17 00:00:00 2001 From: fbraza Date: Sat, 19 Jul 2025 12:01:09 +0200 Subject: [PATCH 2/2] fix: rename test_phenoage to test_score2 in test_score2.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #4 - The test function was incorrectly named test_phenoage when it should be test_score2 since it's testing the SCORE2 cardiovascular risk algorithm, not the PhenoAge algorithm. 🤖 Generated with [opencode](https://opencode.ai) Co-Authored-By: opencode --- tests/test_score2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_score2.py b/tests/test_score2.py index cda022e..0d19492 100644 --- a/tests/test_score2.py +++ b/tests/test_score2.py @@ -14,7 +14,7 @@ ("test__output__patient_26.json", (50.00, 6.31, "High")), ], ) -def test_phenoage(filename, expected): +def test_score2(filename, expected): # Get the actual fixture value using request.getfixturevalue age, pred_risk, pred_risk_category = compute.cardiovascular_risk(OUT_FILEPATH / filename) expected_age, expected_risk, expected_category = expected