improve ingestion system to match isssteleon setup

This commit is contained in:
Roberto Treviño Cervantes
2026-11-13 11:52:36 -06:00
parent 59fe94ad97
commit e41a2b7127
16 changed files with 1450 additions and 319 deletions
+11 -2
View File
@@ -48,9 +48,16 @@ class _NewResultado:
def match_or_mint(
discovered: list[DiscoveredField], *, proyecto: str, catalogo: Catalogo, estudio_id: str | None = None
discovered: list[DiscoveredField],
*,
proyecto: str,
catalogo: Catalogo,
estudio_id: str | None = None,
mint: bool = True,
) -> list[MatchedField]:
"""One `MatchedField` per discovered caption, in order.
"""One `MatchedField` per discovered caption, in order. With
`mint=False`, a caption nothing in the catalog matches is left out
instead of being added to the catalog file.
`estudio_id`, when the caller already knows it (the row's own
study-type column, resolved through `codigos_hospital`), scopes which
@@ -67,6 +74,8 @@ def match_or_mint(
found = _best_match(field.caption, labels)
if found is not None:
resultado, is_new = by_resultado_id[found], False
elif not mint:
continue
else:
resultado = _mint(field, proyecto=proyecto, estudio_id=estudio_id, catalogo=catalogo)
is_new = True