fix(import): align child-parent pedigree mapping by using name cell row for vertical alignment
Some checks failed
CI / Backend Tests (.NET) (push) Successful in 1m9s
CI / Docker Build & Push (push) Has been cancelled
CI / Frontend Tests (Node/Vite) (push) Has been cancelled

This commit is contained in:
2026-06-21 22:11:53 +02:00
parent b53b8cf2ff
commit 4cb39cb180
3 changed files with 19 additions and 5 deletions

View File

@@ -211,6 +211,7 @@ def extract_stammbaum(path):
if not compact and not is_block_dob: if not compact and not is_block_dob:
continue continue
name_row = r
if compact: if compact:
name = clean_name(compact.group(1)) name = clean_name(compact.group(1))
dob, death, geno = parse_detail(t) dob, death, geno = parse_detail(t)
@@ -225,6 +226,7 @@ def extract_stammbaum(path):
if (c, rr) in cells and not re.match(r"^\*?\s?\d", cells[(c, rr)]) \ if (c, rr) in cells and not re.match(r"^\*?\s?\d", cells[(c, rr)]) \
and not gt.looks_like_genotype(cells[(c, rr)]): and not gt.looks_like_genotype(cells[(c, rr)]):
name = clean_name(cells[(c, rr)]) name = clean_name(cells[(c, rr)])
name_row = rr
used.add((c, rr)) used.add((c, rr))
break break
farbschlag = "" farbschlag = ""
@@ -275,7 +277,7 @@ def extract_stammbaum(path):
"sourceFiles": [fname], "sourceFiles": [fname],
"_gen": gen_of(c, col_offset), "_gen": gen_of(c, col_offset),
"_col": c, "_col": c,
"_row": r, "_row": name_row,
"_file": fname, "_file": fname,
"_zucht": norm_zucht(zraw), "_zucht": norm_zucht(zraw),
}) })

View File

@@ -882,17 +882,29 @@ def main():
m_dob = parse_date(mother_ref.get("dob")) m_dob = parse_date(mother_ref.get("dob"))
for p_cand in stammbaum_only_animals: for p_cand in stammbaum_only_animals:
p_gender = str(p_cand.get("gender") or "").lower().strip()
if p_gender in ["w", "f", "female", "weiblich"]:
continue
p_dob = parse_date(p_cand.get("dob"))
if dob_val and p_dob and p_dob >= dob_val:
continue
cand_call_norm = normalize_name(get_call_name(p_cand["name"])) or "unbekannt" cand_call_norm = normalize_name(get_call_name(p_cand["name"])) or "unbekannt"
cand_name_norm = normalize_name(p_cand["name"]) or "unbekannt" cand_name_norm = normalize_name(p_cand["name"]) or "unbekannt"
if cand_call_norm == normalize_name(f_name) or cand_name_norm == normalize_name(f_name): if cand_call_norm == normalize_name(f_name) or cand_name_norm == normalize_name(f_name):
if not f_dob or parse_date(p_cand.get("dob")) == f_dob: if not f_dob or p_dob == f_dob:
f_scoped_id = generate_guid(f"stammbaum-animal-{p_cand['id']}") f_scoped_id = generate_guid(f"stammbaum-animal-{p_cand['id']}")
break break
for p_cand in stammbaum_only_animals: for p_cand in stammbaum_only_animals:
p_gender = str(p_cand.get("gender") or "").lower().strip()
if p_gender in ["m", "male", "männlich"]:
continue
p_dob = parse_date(p_cand.get("dob"))
if dob_val and p_dob and p_dob >= dob_val:
continue
cand_call_norm = normalize_name(get_call_name(p_cand["name"])) or "unbekannt" cand_call_norm = normalize_name(get_call_name(p_cand["name"])) or "unbekannt"
cand_name_norm = normalize_name(p_cand["name"]) or "unbekannt" cand_name_norm = normalize_name(p_cand["name"]) or "unbekannt"
if cand_call_norm == normalize_name(m_name) or cand_name_norm == normalize_name(m_name): if cand_call_norm == normalize_name(m_name) or cand_name_norm == normalize_name(m_name):
if not m_dob or parse_date(p_cand.get("dob")) == m_dob: if not m_dob or p_dob == m_dob:
m_scoped_id = generate_guid(f"stammbaum-animal-{p_cand['id']}") m_scoped_id = generate_guid(f"stammbaum-animal-{p_cand['id']}")
break break

View File

@@ -10,9 +10,9 @@ _Automatisch erzeugt von `tools/import/extract.py` — **noch nichts in die Date
- in mehreren Dateien gefunden (Dubletten zusammengeführt): 460 - in mehreren Dateien gefunden (Dubletten zusammengeführt): 460
- Konflikte zur Klärung: **2** - Konflikte zur Klärung: **2**
- Mehrdeutige / unvollständige Einträge (ohne Name+Datum): **342** - Mehrdeutige / unvollständige Einträge (ohne Name+Datum): **342**
- Fotos zugeordnet: **418** - Fotos zugeordnet: **416**
- Würfe aus der Wurfchronik: **752** - Würfe aus der Wurfchronik: **752**
- Tiere mit Wurf verknüpft: **270** (davon über Geburtsdatum **und** Eltern: 167, nur über Geburtsdatum: 103; mehrdeutig: 17) - Tiere mit Wurf verknüpft: **271** (davon über Geburtsdatum **und** Eltern: 166, nur über Geburtsdatum: 105; mehrdeutig: 16)
- Würfe mit Datenqualitäts-Hinweisen: 113 (+ 138 Zeilen mit abweichendem Spaltenschema) - Würfe mit Datenqualitäts-Hinweisen: 113 (+ 138 Zeilen mit abweichendem Spaltenschema)
## Zusammenführungs-Schlüssel ## Zusammenführungs-Schlüssel