From b6e75a26d83adaeca493a2c680e8676772fa2165 Mon Sep 17 00:00:00 2001 From: Williams Date: Wed, 13 Dec 2023 11:27:19 -0500 Subject: [PATCH 1/2] Adding check for bad sources that trip up appraiser --- tr_sys/tr_ars/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tr_sys/tr_ars/utils.py b/tr_sys/tr_ars/utils.py index 38b26710..ea0b9258 100644 --- a/tr_sys/tr_ars/utils.py +++ b/tr_sys/tr_ars/utils.py @@ -887,11 +887,18 @@ def decorate_edges_with_infores(data,inforesid): edge['sources']=[self_source] else: for source in edge['sources']: + bad_sources=[] + if 'resource_id' not in source.keys(): + bad_sources.append(source) + #if the source is no good, we don't need to do anything else with it. + continue if source['resource_id']==inforesid: has_self=True if source['resource_role']=="primary_knowledge_source": has_primary=True + for source in bad_sources: + edge['sources'].remove(source) if not has_self: #if we already have a primary knowledge source but not our self, we add ourself as an aggregator if has_primary: From b54c9e038e6d4bf1b73fc95b4af6506699ca1c3c Mon Sep 17 00:00:00 2001 From: Shervin <59394220+ShervinAbd92@users.noreply.github.com> Date: Wed, 13 Dec 2023 11:50:24 -0500 Subject: [PATCH 2/2] Update utils.py --- tr_sys/tr_ars/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tr_sys/tr_ars/utils.py b/tr_sys/tr_ars/utils.py index ea0b9258..86281ea4 100644 --- a/tr_sys/tr_ars/utils.py +++ b/tr_sys/tr_ars/utils.py @@ -886,8 +886,8 @@ def decorate_edges_with_infores(data,inforesid): if 'sources' not in edge.keys() or edge['sources'] is None or len(edge['sources'])==0: edge['sources']=[self_source] else: + bad_sources=[] for source in edge['sources']: - bad_sources=[] if 'resource_id' not in source.keys(): bad_sources.append(source) #if the source is no good, we don't need to do anything else with it.