improve ingestion system to match isssteleon setup
This commit is contained in:
@@ -65,24 +65,21 @@ def test_a_matched_field_is_written_on_the_existing_resultado(cacu_catalog, know
|
||||
assert procedimiento.fuente_id == known_patient
|
||||
|
||||
|
||||
def test_an_unmatched_field_mints_a_resultado_and_is_written_too(cacu_catalog, known_patient):
|
||||
def test_an_unmatched_field_is_counted_and_the_catalog_left_untouched(cacu_catalog, known_patient):
|
||||
"""A caption the catalog doesn't know is counted, not written, and the
|
||||
catalog file isn't edited: it's versioned with the code. Fails if the
|
||||
import path mints catalog entries again."""
|
||||
before = cacu_catalog.read_text(encoding="utf-8")
|
||||
result = commit_discovered_fields(
|
||||
[_record(known_patient, [("Tipo de fijador", "Formol")])], proyecto="cacu", estudio_id="citologia"
|
||||
)
|
||||
assert result.fields_minted == 1
|
||||
nombres = set(catalogos._leer(cacu_catalog)["citologia"]["resultados"])
|
||||
assert nombres == {"calidad_muestra", "tipo_de_fijador"} # the fixture's field, plus the minted one
|
||||
minted_id = "citologia.tipo_de_fijador"
|
||||
|
||||
catalogo = catalogos.catalogo_desde_toml(cacu_catalog, tablas=tablas_de("cacu"))
|
||||
assert minted_id in {r.resultado_id for r in catalogo.resultados}
|
||||
assert (result.records_written, result.fields_minted, result.fields_unmatched) == (0, 0, 1)
|
||||
assert cacu_catalog.read_text(encoding="utf-8") == before
|
||||
|
||||
from persistance.cacu import carga_repository
|
||||
|
||||
with carga_repository.open_session() as sesion:
|
||||
[observacion] = sesion.exec(select(carga_repository.observacion)).all()
|
||||
assert observacion.resultado_id == minted_id
|
||||
assert observacion.valor_texto == "Formol"
|
||||
assert sesion.exec(select(carga_repository.observacion)).all() == []
|
||||
|
||||
|
||||
def test_a_patient_outside_persona_is_skipped_not_dropped_silently(cacu_catalog, known_patient):
|
||||
|
||||
Reference in New Issue
Block a user