From 302da85e33b8e6ce1e54606916d3323667512b5c Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 18 Apr 2022 12:25:38 +0100 Subject: [PATCH] Optional isa_filter for wikidata_isa_counts --- matcher/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/matcher/api.py b/matcher/api.py index 5de289e..8b6aee5 100644 --- a/matcher/api.py +++ b/matcher/api.py @@ -418,7 +418,7 @@ def wikidata_items_count(bounds, isa_filter=None): return q.count() -def wikidata_isa_counts(bounds): +def wikidata_isa_counts(bounds, isa_filter=None): db_bbox = make_envelope(bounds) q = ( @@ -426,6 +426,9 @@ def wikidata_isa_counts(bounds): .filter(func.ST_Covers(db_bbox, model.ItemLocation.location)) ) + if isa_filter: + q = add_isa_filter(q, isa_filter) + db_items = q.all() counts = get_isa_count(db_items)