aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/routes.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-07-24 20:00:29 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-07-30 18:28:03 -0700
commit19094b9994a1fc45450a96989ed41910d849c6d7 (patch)
tree2ae346a565ebbeeeeb9813e542804ae90873624a /python/fatcat_web/routes.py
parent1f6f9c0e251f45f220dd48242d48fa61922fe55f (diff)
downloadfatcat-19094b9994a1fc45450a96989ed41910d849c6d7.tar.gz
fatcat-19094b9994a1fc45450a96989ed41910d849c6d7.zip
make some ES agg methods work on general queries
Eg, instead of container-specific year histogram, have the histogram fetch function take a ReleaseQuery. This is in preparation for more generic coverage visualization pages.
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r--python/fatcat_web/routes.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 203d1621..45f6b0b6 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -205,7 +205,9 @@ def generic_entity_view(entity_type, ident, view_template):
entity._random_releases = get_elastic_container_random_releases(entity.ident)
if view_template == "container_view_coverage.html":
entity._stats = get_elastic_container_stats(entity.ident, issnl=entity.issnl)
- entity._type_preservation = get_elastic_container_preservation_by_type(ident)
+ entity._type_preservation = get_elastic_preservation_by_type(
+ ReleaseQuery(container_id=ident),
+ )
return render_template(view_template, entity_type=entity_type, entity=entity, editgroup_id=None)
@@ -828,8 +830,9 @@ def container_ident_preservation_by_year_json(ident):
container = api.get_container(ident)
except ApiException as ae:
abort(ae.status)
+ query = ReleaseQuery(container_id=container.ident)
try:
- histogram = get_elastic_container_preservation_by_year(container.ident)
+ histogram = get_elastic_preservation_by_year(query)
except Exception as ae:
app.log.error(ae)
abort(503)
@@ -842,8 +845,9 @@ def container_ident_preservation_by_year_svg(ident):
container = api.get_container(ident)
except ApiException as ae:
abort(ae.status)
+ query = ReleaseQuery(container_id=container.ident)
try:
- histogram = get_elastic_container_preservation_by_year(container.ident)
+ histogram = get_elastic_preservation_by_year(query)
except Exception as ae:
app.log.error(ae)
abort(503)