diff options
Diffstat (limited to 'scraper/s2-citation-report.py')
| -rw-r--r-- | scraper/s2-citation-report.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scraper/s2-citation-report.py b/scraper/s2-citation-report.py index 96400d45..fc52cc35 100644 --- a/scraper/s2-citation-report.py +++ b/scraper/s2-citation-report.py @@ -5,9 +5,12 @@ import simplejson as json import math import operator import click +import subprocess #import builder from util import * +DIR_PUBLIC_CITATIONS = "../site/datasets/citations" + @click.command() def s2_citation_report(): addresses = AddressBook() @@ -30,6 +33,12 @@ def s2_citation_report(): print("citations: {}".format(paper_count)) print("geocoded: {} ({}%)".format(geocode_count, percent(geocode_count, paper_count))) + sts = subprocess.call([ + "s3cmd", "sync", + DIR_PUBLIC_CITATIONS + '/', + "s3://megapixels/v1/citations/", + ]) + def write_papers_report(fn, title, papers, key, reverse=False): sorted_papers = [] for paper in sorted(papers, key=lambda x: x[key], reverse=reverse): @@ -262,7 +271,7 @@ def process_paper(row, addresses, success): f.write('<script src="../map.js"></script>') f.write("</html>") # template = env.get_template('paper.html') - with open('reports/citations/{}.json'.format(paper.paper_id), 'w') as f: + with open('{}/{}.json'.format(DIR_PUBLIC_CITATIONS, paper.paper_id), 'w') as f: json.dump({ 'id': paper.paper_id, 'paper': res, |
