diff --git a/.gitignore b/.gitignore index 5c26bd1..6c56ff1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,2 @@ __pycache__/ -node_modules/ -dist/ -.angular/ +.pytest_cache/ diff --git a/models/graph.py b/models/graph.py index fe1d37c..28679cc 100644 --- a/models/graph.py +++ b/models/graph.py @@ -413,6 +413,8 @@ def run_link(p: str, node: Link): known = [f for f in ("birth_date", "sex") if f in fields] orphan = set(whole.unique_id[whole[facts].isna().all(axis=1)]) if facts else set() undated = set(whole.unique_id[whole["birth_date"].isna()]) if "birth_date" in fields else set() + whose = persons.set_index("unique_id")["cluster_id"].to_dict() + answered = {frozenset((whose.get(r, r) for r in e)) for e in decided} lone = set() for f in ids: carried = persons.dropna(subset=[f]).groupby(["cluster_id", f]).size() @@ -421,7 +423,7 @@ def run_link(p: str, node: Link): def settle(r) -> tuple[str, str] | None: a, b = (r.unique_id_l, r.unique_id_r) sides = [(getattr(r, f"{f}_l"), getattr(r, f"{f}_r")) for f in known] - if frozenset((a, b)) in decided or any( + if frozenset((a, b)) in answered or any( (pd.notna(x) and pd.notna(y) and (x != y) for x, y in sides) ): return None