initial commit

This commit is contained in:
Roberto Treviño Cervantes
2026-09-21 10:23:42 -06:00
commit ca9d3ad81f
8 changed files with 128 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
__pycache__/
*.pyc
.venv/
.pytest_cache/
.coverage
*.egg-info/
.env
uv.lock
View File
+21
View File
@@ -0,0 +1,21 @@
from abc import ABC, abstractmethod
from typing import Any
class ScreeningModel(ABC):
"""Standard train()/predict() interface every screening model implements,
regardless of which of the three data marts (CaCu/CaMa/TEA) it targets.
Implementations are free to pull their own data straight from
`persistance.<domain>` — the same standard repository API WebApi uses —
or accept already-fetched rows from a caller; `data` is intentionally
untyped at this scaffolding stage.
"""
@abstractmethod
def train(self, data: Any = None) -> None:
"""Fit the model, optionally on `data` passed in by the caller."""
@abstractmethod
def predict(self, data: Any) -> Any:
"""Score `data` and return predictions."""
+19
View File
@@ -0,0 +1,19 @@
from typing import Any
from models.base import ScreeningModel
class CaCuModel(ScreeningModel):
"""Scaffold for the CaCu (cervical cancer) screening model.
Can pull its own training data straight from `persistance.cacu`'s
repositories (`paciente_repository`, `citologia_cervical_repository`,
`biopsia_cervical_repository`, ...) or be handed already-fetched rows.
No real model yet — this is interface scaffolding only.
"""
def train(self, data: Any = None) -> None:
raise NotImplementedError("CaCu training is not implemented yet.")
def predict(self, data: Any) -> Any:
raise NotImplementedError("CaCu prediction is not implemented yet.")
+19
View File
@@ -0,0 +1,19 @@
from typing import Any
from models.base import ScreeningModel
class CaMaModel(ScreeningModel):
"""Scaffold for the CaMa (breast cancer) screening model.
Can pull its own training data straight from `persistance.cama`'s
repositories (`paciente_repository`, `mastografia_repository`,
`biopsia_mama_repository`, ...) or be handed already-fetched rows.
No real model yet — this is interface scaffolding only.
"""
def train(self, data: Any = None) -> None:
raise NotImplementedError("CaMa training is not implemented yet.")
def predict(self, data: Any) -> Any:
raise NotImplementedError("CaMa prediction is not implemented yet.")
+19
View File
@@ -0,0 +1,19 @@
from typing import Any
from models.base import ScreeningModel
class TeaModel(ScreeningModel):
"""Scaffold for the TEA (autism spectrum disorder) screening model.
Can pull its own training data straight from `persistance.tea`'s
repositories (`pacientes_repository`, `evaluacion_psicologica_repository`,
...) or be handed already-fetched rows. No real model yet — this is
interface scaffolding only.
"""
def train(self, data: Any = None) -> None:
raise NotImplementedError("TEA training is not implemented yet.")
def predict(self, data: Any) -> Any:
raise NotImplementedError("TEA prediction is not implemented yet.")
+23
View File
@@ -0,0 +1,23 @@
[project]
name = "models"
version = "0.1.0"
description = "train()/predict() interfaces for the CaCu, CaMa and TEA screening models."
requires-python = ">=3.11"
dependencies = [
"persistance",
]
[tool.uv.sources]
persistance = { path = "../Persistance", editable = true }
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["models"]
[dependency-groups]
dev = [
"pytest>=8.0.0",
]
+19
View File
@@ -0,0 +1,19 @@
import pytest
from models.cacu import CaCuModel
from models.cama import CaMaModel
from models.tea import TeaModel
@pytest.mark.parametrize("cls", [CaCuModel, CaMaModel, TeaModel])
def test_train_not_implemented(cls):
model = cls()
with pytest.raises(NotImplementedError):
model.train()
@pytest.mark.parametrize("cls", [CaCuModel, CaMaModel, TeaModel])
def test_predict_not_implemented(cls):
model = cls()
with pytest.raises(NotImplementedError):
model.predict(data=None)