From cc84c3d5786b3b9beb68182d77e99f8523d5a8f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anne=20L=27H=C3=B4te?= Date: Mon, 6 Jan 2025 16:03:36 +0100 Subject: [PATCH] fix(ctis): Correct the filter on French clinical trials /2 --- bsoclinicaltrials/server/main/ctis.py | 2 +- bsoclinicaltrials/server/main/merge_sources.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bsoclinicaltrials/server/main/ctis.py b/bsoclinicaltrials/server/main/ctis.py index 613bb3e..b7e7d69 100644 --- a/bsoclinicaltrials/server/main/ctis.py +++ b/bsoclinicaltrials/server/main/ctis.py @@ -40,7 +40,7 @@ def harvest(): cts_fr = [] for ct in cts: # Filter on French clinical trials - if "france:" in [country.lower() for country in ct.get("trialCountries")]: + if "france" in [country.lower().split(":")[0] for country in ct.get("trialCountries")]: r = requests.get( f"https://euclinicaltrials.eu/ctis-public-api/retrieve/{ct.get('ctNumber')}", verify=False) cts_fr.append(r.json()) diff --git a/bsoclinicaltrials/server/main/merge_sources.py b/bsoclinicaltrials/server/main/merge_sources.py index 124014f..26b1f29 100644 --- a/bsoclinicaltrials/server/main/merge_sources.py +++ b/bsoclinicaltrials/server/main/merge_sources.py @@ -45,7 +45,7 @@ def merge_all(date_ct, date_euctr, date_ctis): matches = update_matches(matches, raw_trials["NCTId"], "NCTId", ["eudraCT"]) matches = update_matches(matches, raw_trials["eudraCT"], "eudraCT", ["NCTId"]) matches = update_matches(matches, raw_trials["CTIS"], "CTIS", ["NCTId"]) - known_ids = set([]) + known_ids = set() all_ct = [] for current_id_type in ["NCTId", "eudraCT", "CTIS"]: for ct in raw_trials[current_id_type]: @@ -112,10 +112,10 @@ def update_matches(matches, new_trials, id1_type, other_ids): id2 = ct[id2_type] if id1 not in matches: matches[id1] = [] - matches[id1].append({id2_type: id2}) + matches[id1].append({ id2_type: id2 }) if id2 not in matches: matches[id2] = [] - matches[id2].append({id1_type: id1}) + matches[id2].append({ id1_type: id1 }) return matches