aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/refcat/tasks.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py
index 75a3daa..39d4486 100644
--- a/python/refcat/tasks.py
+++ b/python/refcat/tasks.py
@@ -438,6 +438,27 @@ class BrefWithDOI(Refcat):
return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd)
+class BrefDOITable(Refcat):
+ """
+ Extract a table with source ident, target ident, source doi, target doi.
+ """
+ def requires(self):
+ return BrefWithDOI()
+
+ def run(self):
+ output = shellout("""
+ zstdcat -T0 {input} |
+ parallel --block 10M -j 20 --pipe
+ "jq -rc '[.source_release_ident, .target_release_ident, .source_doi, .target_doi] | @tsv'
+ | zstd -c -T0 > {output}
+ """,
+ input=self.input().path)
+ luigi.LocalTarget(output).move(self.output().path)
+
+ def output(self):
+ return luigi.LocalTarget(path=self.path(ext="tsv.zst"))
+
+
class UnmatchedRefs(Refcat):
"""
File with not yet considered refs (e.g. no title, doi, ...); around