summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/routes.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-09-04 12:04:08 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-09-04 12:04:08 -0700
commitf4da02fae5ebd179a0b3af4ff179543813fa146b (patch)
tree3f14fba54e6279a1bc042831ad4b7e273dc71f15 /python/fatcat_web/routes.py
parentb0223b6e10706554e55e5d90f36d1946d285c3e2 (diff)
downloadfatcat-f4da02fae5ebd179a0b3af4ff179543813fa146b.tar.gz
fatcat-f4da02fae5ebd179a0b3af4ff179543813fa146b.zip
start container coverage page
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r--python/fatcat_web/routes.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index f313fce0..3f5af621 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -230,6 +230,10 @@ def generic_editgroup_entity_view(editgroup_id, entity_type, ident, view_templat
def container_view(ident):
return generic_entity_view('container', ident, 'container_view.html')
+@app.route('/container/<ident>/coverage', methods=['GET'])
+def container_view_coverage(ident):
+ return generic_entity_view('container', ident, 'container_view_coverage.html')
+
@app.route('/container/<ident>/metadata', methods=['GET'])
def container_view_metadata(ident):
return generic_entity_view('container', ident, 'entity_view_metadata.html')
@@ -718,6 +722,21 @@ def container_ident_stats(ident):
abort(503)
return jsonify(stats)
+@app.route('/container/<ident>/ia_coverage_years.json', methods=['GET', 'OPTIONS'])
+@crossdomain(origin='*',headers=['access-control-allow-origin','Content-Type'])
+def container_ident_ia_coverage_years_json(ident):
+ try:
+ container = api.get_container(ident)
+ except ApiException as ae:
+ abort(ae.status)
+ try:
+ histogram = get_elastic_container_histogram(container.ident)
+ except Exception as ae:
+ app.log.error(ae)
+ abort(503)
+ histogram = [dict(year=h[0], in_ia=h[1], count=h[2]) for h in histogram]
+ return jsonify({'container_id': ident, "histogram": histogram})
+
@app.route('/release/<ident>.bib', methods=['GET'])
def release_bibtex(ident):
try: