fix: pass registration country into canonical company identity rules

This commit is contained in:
2026-09-07 18:15:47 +02:00
parent 76038205ca
commit 6f525c5c9e
+3 -7
View File
@@ -61,9 +61,6 @@ def _apply_matches(records: list[dict[str, Any]], pairs: list[dict[str, Any]]) -
parent = {rid: rid for rid in unique_ids}
members = {rid: {rid} for rid in unique_ids}
# Only explicit hard-rule non-matches are cluster-wide negative evidence.
# A normal score-based non_match merely means "insufficient similarity" and
# must not become a universal cannot-link rule.
hard_non_matches: set[frozenset[str]] = set()
for pair in pairs:
a, b = pair.get("record_a"), pair.get("record_b")
@@ -94,9 +91,6 @@ def _apply_matches(records: list[dict[str, Any]], pairs: list[dict[str, Any]]) -
members.pop(drop, None)
return True
# Hard-rule matches are applied before probabilistic/score matches; within
# each class, stronger scores go first. No later edge may violate a hard
# negative constraint established above.
match_pairs = [
p for p in pairs
if p.get("status") == "match"
@@ -187,10 +181,12 @@ async def resolve(
er_records = []
for rid, record in zip(unique_ids, records):
name = str(record.get("name") or "")
market = record.get("market")
er_records.append({
"record_id": rid,
"fields": {
"market": record.get("market"),
"market": market,
"registration_country": market,
"block_initial": name[:1].upper(),
"name": name,
"status": record.get("status"),