A reviewer's answer holds when more records join a person
This commit is contained in:
+4
-1
@@ -425,6 +425,9 @@ def run_link(p: str, node: Link):
|
||||
orphan = set(whole.unique_id[whole[facts].isna().all(axis=1)]) if facts else set()
|
||||
# no birth date to tell her apart (a pathology scan: a name, misread or not, and a sex)
|
||||
undated = set(whole.unique_id[whole["birth_date"].isna()]) if "birth_date" in fields else set()
|
||||
# Answers are kept by record; a person is known by any of hers, whatever joined since.
|
||||
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() # persons whose identifier is carried by one record only
|
||||
for f in ids:
|
||||
carried = persons.dropna(subset=[f]).groupby(["cluster_id", f]).size()
|
||||
@@ -439,7 +442,7 @@ def run_link(p: str, node: Link):
|
||||
very same identifier on a record that says nothing else (a scan read only in part)."""
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user