From 2280a76a79fa5c1a93ba92a8c80ec6b17223cb9b Mon Sep 17 00:00:00 2001 From: Rikki Guy Date: Mon, 30 Sep 2024 17:32:43 +0100 Subject: [PATCH] additional_data: Use FTC linked_orgs_verified This commit expands the set of org-ids that are considered linked. FindThatCharity provides multiple options for a set of linked org-ids per given primary org-id. Previously the datastore used the conservative "orgIDs" field which included one-way only lookups directly provided by authorities e.g. the charity commission. This commit switches to the "linked_orgs_verified" field which expands the official one-way links to be two-way, and solves the issue of some organisations previously sharing non-primary org-ids. --- .../additional_data/sources/find_that_charity.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/datastore/additional_data/sources/find_that_charity.py b/datastore/additional_data/sources/find_that_charity.py index 05bb0e1..6f30236 100644 --- a/datastore/additional_data/sources/find_that_charity.py +++ b/datastore/additional_data/sources/find_that_charity.py @@ -78,12 +78,20 @@ def process_csv(self, file_data, org_type): # e.g. A name [with brackets] Association continue + # Fall back to orgIDs if linked_orgs_verified not available, otherwise a minimal orgIDs array containing + # just the primary orgID. if "orgIDs" not in row: - row["orgIDs"] = None + row["orgIDs"] = [row["id"]] + + if "linked_orgs_verified" not in row: + row["linked_orgs_verified"] = row["orgIDs"] bulk_list.append( OrgInfoCache( - data=row, org_type=org_type, org_id=row["id"], org_ids=row["orgIDs"] + data=row, + org_type=org_type, + org_id=row["id"], + org_ids=row["linked_orgs_verified"], ) ) added += 1