The import's catalog matching and commit read the WebApi's catalog, silver batch and table maps; add_resultado moves here
How: `catalog_matching`, `catalog_commit_service` and the imports blueprint import `Catalogo`, `catalogo_desde_toml`, `ruta_de_catalogo`, `CatalogoInvalido`, `LotePlata`, `valor_de_observacion` and `tablas_de` from `webapi.orchestration`; the commit writes through `carga_repository.save_load` and `catalog_repository.sync`. `add_resultado` and its tests come over unchanged from the indicator kit. Implications: the import path no longer needs the indicator kit, which isn't a dependency.
This commit is contained in:
@@ -11,7 +11,7 @@ the import report lists them (`webapi.imports.audit`).
|
||||
There is no staging row for these — the whole point is a field outside
|
||||
today's structured schemas — so this bypasses `DESDE_STAGING` and writes
|
||||
straight through the domain's existing `carga_repository`, the same one
|
||||
`webapi.orquestacion`'s `cargar` step uses for staging-derived batches.
|
||||
`webapi.orchestration`'s `load` step uses for staging-derived batches.
|
||||
|
||||
Marked clearly apart from every staging-derived procedimiento:
|
||||
`fuente_tabla` is the sentinel `FUENTE_CATALOGO_ABIERTO`, never a real
|
||||
@@ -27,11 +27,11 @@ from dataclasses import dataclass
|
||||
from importlib import import_module
|
||||
|
||||
from extraction import ExtractedRecord
|
||||
from indicadores_kit.plata.procedimiento import LotePlata
|
||||
from indicadores_kit.registry.catalogos import Catalogo, catalogo_desde_toml, ruta_de_catalogo
|
||||
from indicadores_kit.tablas import tablas_de
|
||||
|
||||
from webapi.imports.schemas.catalog_matching import MatchedField, match_or_mint
|
||||
from webapi.orchestration.reference.catalogs import Catalogo, catalogo_desde_toml, ruta_de_catalogo
|
||||
from webapi.orchestration.silver.procedures import LotePlata
|
||||
from webapi.orchestration.tables import tablas_de
|
||||
|
||||
FUENTE_CATALOGO_ABIERTO = "catalogo_abierto"
|
||||
|
||||
@@ -93,7 +93,7 @@ def commit_discovered_fields(
|
||||
|
||||
if procedures:
|
||||
_sync_catalog(dominio, proyecto, tablas)
|
||||
dominio.carga_repository.guardar_carga(
|
||||
dominio.carga_repository.save_load(
|
||||
fuente=FUENTE_CATALOGO_ABIERTO, personas=(), plata=LotePlata(procedures, observations, {})
|
||||
)
|
||||
return result
|
||||
@@ -120,4 +120,4 @@ def _sync_catalog(dominio, proyecto: str, tablas) -> None:
|
||||
runs: `procedimiento.estudio_id` and `observacion`'s catalog both need
|
||||
the matching `cat_estudio`/`cat_resultado` row to already be there."""
|
||||
catalogo: Catalogo = catalogo_desde_toml(ruta_de_catalogo(proyecto), tablas=tablas)
|
||||
dominio.catalogo_repository.sincronizar(catalogo.estudios, catalogo.resultados, catalogo.valores)
|
||||
dominio.catalog_repository.sync(catalogo.estudios, catalogo.resultados, catalogo.valores)
|
||||
|
||||
Reference in New Issue
Block a user