aboutsummaryrefslogtreecommitdiffstats
path: root/notes/pipeline_commands.md
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-04-09 17:48:16 -0700
committerBryan Newbold <bnewbold@archive.org>2020-04-09 17:48:16 -0700
commit5b22495057fa9cb40271764c9e80166882ba3f21 (patch)
tree36f09901a62818b1a73135babb06136e20238a46 /notes/pipeline_commands.md
parent660ae5878ab235b3631e293e0f216846e2986c02 (diff)
downloadfatcat-covid19-5b22495057fa9cb40271764c9e80166882ba3f21.tar.gz
fatcat-covid19-5b22495057fa9cb40271764c9e80166882ba3f21.zip
inclusion notes and pipeline update
Diffstat (limited to 'notes/pipeline_commands.md')
-rw-r--r--notes/pipeline_commands.md35
1 files changed, 19 insertions, 16 deletions
diff --git a/notes/pipeline_commands.md b/notes/pipeline_commands.md
index a9eddcd..ca3106c 100644
--- a/notes/pipeline_commands.md
+++ b/notes/pipeline_commands.md
@@ -6,31 +6,34 @@ Dependencies:
Context:
- export CORDDATE="2020-03-27"
+ export TODAY="`TZ=UTC date --iso-8601=date`"
+ export CORDDATE="2020-04-03"
-Fetch and transform metadata:
+Fetch and transform CORD-19 metadata:
mkdir -p metadata fulltext_web
wget https://archive.org/download/s2-cord19-dataset/cord19.$CORDDATE.csv -O metadata/cord19.$CORDDATE.csv metadata
- ./bin/parse_cord19_csv.py metadata/cord19.$CORDDATE.csv > metadata/cord19.$CORDDATE.json
+ ./covid19_tool.py parse-cord19 metadata/cord19.$CORDDATE.csv > metadata/cord19.$CORDDATE.json
cat metadata/cord19.$CORDDATE.json | parallel -j10 --linebuffer --round-robin --pipe ./covid19_tool.py enrich-fatcat - | pv -l > metadata/cord19.$CORDDATE.enrich.json
cat metadata/cord19.$CORDDATE.enrich.json | jq 'select(.release_id == null) | .cord19_paper' -c > metadata/cord19.$CORDDATE.missing.json
-Download fulltext from wayback:
+Fetch fatcat query metadata:
+
+ ./covid19_tool.py query-fatcat | pv -l > metadata/fatcat_hits.$TODAY.enrich.json
- cat metadata/cord19.$CORDDATE.enrich.json | jq .fatcat_release -c | parallel -j20 --linebuffer --round-robin --pipe ./bin/deliver_file2disk.py --disk-dir fulltext_web - | pv -l > fatcat_web_$CORDDATE.log
+Combine and de-dupe:
- cut -f1 fatcat_web_$CORDDATE.log | sort | uniq -c | sort -nr
+ cat metadata/fatcat_hits.$TODAY.enrich.json metadata/cord19.$CORDDATE.enrich.json | ./covid19_tool.py dedupe | pv -l > metadata/combined.$TODAY.enrich.json
+
+Download fulltext from wayback:
-Extract text from PDFs:
+ cat metadata/combined.$TODAY.enrich.json | jq .fatcat_release -c | parallel -j20 --linebuffer --round-robin --pipe ./bin/deliver_file2disk.py --disk-dir fulltext_web - | pv -l > fatcat_web_$TODAY.log
- ls fulltext_web/pdf/ | parallel mkdir -p fulltext_web/pdftotext/{}
- fd -I .pdf fulltext_web/pdf/ | cut -c18-60 | parallel -j10 pdftotext fulltext_web/pdf/{}.pdf fulltext_web/pdftotext/{}.txt
+ cut -f1 fatcat_web_$TODAY.log | sort | uniq -c | sort -nr
-Create thumbnails:
+Update PDF derivative files (pdftotext and PNG thumbnail):
- ls fulltext_web/pdf/ | parallel mkdir -p fulltext_web/thumbnail/{}
- fd -I .pdf fulltext_web/pdf/ | cut -c18-60 | parallel -j10 pdftocairo -png -singlefile -scale-to-x 400 -scale-to-y -1 fulltext_web/pdf/{}.pdf fulltext_web/thumbnail/{}
+ ./bin/make_dir_derivatives.sh fulltext_web
Fetch GROBID:
@@ -43,9 +46,9 @@ Convert GROBID XML to JSON:
Create large derivatives file (including extracted fulltext):
- ./covid19_tool.py enrich-derivatives metadata/cord19.$CORDDATE.enrich.json --base-dir fulltext_web/ | pv -l > metadata/cord19.$CORDDATE.fulltext.json
+ ./covid19_tool.py enrich-derivatives metadata/combined.$TODAY.enrich.json --base-dir fulltext_web/ | pv -l > metadata/combined.$TODAY.fulltext.json
- cat metadata/cord19.$CORDDATE.fulltext.json | jq .fulltext_status -r | sort | uniq -c | sort -nr
+ cat metadata/combined.$TODAY.fulltext.json | jq .fulltext_status -r | sort | uniq -c | sort -nr
## ES Indices
@@ -56,7 +59,7 @@ Create fulltext index, transform to ES schema and index:
http put :9200/covid19_fatcat_fulltext < schema/fulltext_schema.v00.json
# in fatcat_covid19, pipenv shell
- ./covid19_tool.py transform-es metadata/cord19.$CORDDATE.fulltext.json | pv -l | esbulk -verbose -size 1000 -id fatcat_ident -w 8 -index covid19_fatcat_fulltext -type release
+ ./covid19_tool.py transform-es metadata/combined.$TODAY.fulltext.json | pv -l | esbulk -verbose -size 1000 -id fatcat_ident -w 8 -index covid19_fatcat_fulltext -type release
Create and index existing `fatcat_release` schema:
@@ -64,7 +67,7 @@ Create and index existing `fatcat_release` schema:
# in fatcat python directory, pipenv shell
export LC_ALL=C.UTF-8
- cat /srv/fatcat_covid19/src/metadata/cord19.$CORDDATE.enrich.json | jq .fatcat_release -c | rg -v '^null$' | pv -l | ./fatcat_transform.py elasticsearch-releases - - | esbulk -verbose -size 1000 -id ident -w 8 -index covid19_fatcat_release -type release
+ cat /srv/fatcat_covid19/src/metadata/combined.$TODAY.enrich.json | jq .fatcat_release -c | rg -v '^null$' | pv -l | ./fatcat_transform.py elasticsearch-releases - - | esbulk -verbose -size 1000 -id ident -w 8 -index covid19_fatcat_release -type release
## GROBID Processing