From e337df94dc3d4e46ffcf30fa84121fc198e8ac88 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Mon, 2 Aug 2021 16:44:57 +0200 Subject: tasks: match follow up tasks --- python/refcat/tasks.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'python') diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py index 4b70b9f..6aae27f 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -1278,6 +1278,51 @@ class BrefCombined(Refcat): # * [ ] [D] sort COCI by citing (or cited) # * [ ] [E] compare COCI and "ASC" doi matches (as set ops, only COCI, only "ASC", etc + +class ExtraMatchedByWorkIdent(Refcat): + """ + Matched sorted by source work ident. + """ + def requires(self): + return BrefCombined() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m bref -skip-on-empty 1 | + LC_ALL=C sort -T {tmpdir} -k1,1 -S25% | + zstd -T0 -c > {output} + """, + tmpdir=self.tmpdir, + input=self.input().path) + luigi.LocalTarget(output).move(self.output().path) + + def output(self): + return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd) + + +class ExtraReleaseByWorkIdent(Refcat): + """ + Fatcat entries by work id. + """ + def requires(self): + return ReleaseExportReduced() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m rewo -skip-on-empty 1 | + LC_ALL=C sort -T {tmpdir} -k1,1 -S25% | + zstd -T0 -c > {output} + """, + tmpdir=self.tmpdir, + input=self.input().path) + luigi.LocalTarget(output).move(self.output().path) + + def output(self): + return luigi.LocalTarget(path=self.path(ext="json.zst"), format=Zstd) + + # Extra # ----- # -- cgit v1.2.3