summaryrefslogtreecommitdiff
path: root/scraper/s2-citation-report.py
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-12-16 13:40:28 +0100
committerJules Laplace <julescarbon@gmail.com>2018-12-16 13:40:28 +0100
commit797b10edaf276305c2b64b25a564c4bdea21f555 (patch)
tree3040270c2304ac2871f06deb7240e44cb39af35c /scraper/s2-citation-report.py
parent7ade5fb2b8826725a63853d8906b17c0091e4707 (diff)
datasetsss
Diffstat (limited to 'scraper/s2-citation-report.py')
-rw-r--r--scraper/s2-citation-report.py11
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,