From 73547f2bb107e7057119dd85f499bec97d7042e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20Trevi=C3=B1o=20Cervantes?= Date: Mon, 21 Sep 2026 10:37:40 -0600 Subject: [PATCH] add readme --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..de51761 --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# models + +Python package with the standard `train()`/`predict()` interface for the +three screening models — CaCu, CaMa and TEA. Consumed by `WebApi`, but +independent of it: this package can read its own training/inference data +directly from `Persistance`, without going through `WebApi` at all. + +## Structure + +- `models/base.py` — `ScreeningModel`, the abstract base every model + implements (`train(data)` / `predict(data)`). +- `models/cacu.py`, `models/cama.py`, `models/tea.py` — one concrete + class per domain. + +## How entities are accessed from models + +This package depends on `../Persistance` (a local `uv` path dependency — +see `pyproject.toml`), and through it on `../Core`. **As of now this is +wiring, not usage**: `train()`/`predict()` in `cacu.py`/`cama.py`/`tea.py` +just raise `NotImplementedError` — no model imports `persistance` yet. + +When real training/inference logic is added, the access pattern is the +same repository instances `WebApi` reads from — no separate data layer +for `models` to maintain: + +```python +# models/models/cacu.py +from typing import Any + +from persistance.cacu import citologia_cervical_repository + +from models.base import ScreeningModel + + +class CaCuModel(ScreeningModel): + def train(self, data: Any = None) -> None: + if data is None: + data = citologia_cervical_repository.list(limit=10_000) + # ... fit on `data` + + def predict(self, data: Any) -> Any: + raise NotImplementedError("CaCu prediction is not implemented yet.") +``` + +The `data: Any = None` default on `train()`/`predict()` is what lets a +caller (e.g. `WebApi`) optionally hand over already-fetched rows instead +of forcing every call to hit the database — but a model implementation is +just as free to call `persistance.` itself when `data` is `None`, +exactly like the example above. + +Each domain's available repositories (`paciente_repository`, +`citologia_cervical_repository`, etc.) and how to extend one with +table-specific business logic are documented in +`../Persistance/README.md`.