diff options
author | Martin Czygan <martin.czygan@gmail.com> | 2021-06-01 17:38:18 +0200 |
---|---|---|
committer | Martin Czygan <martin.czygan@gmail.com> | 2021-06-01 17:38:18 +0200 |
commit | c541ab1a1cf28cb57dc18a7ea0bffe0c5cb1d9a8 (patch) | |
tree | 2cbf8a4d68a597ebfe63537e8f670c0356d9a0b6 /python | |
parent | 5c2597133c64ab0ffe2a54d1f23834249278db4a (diff) | |
download | refcat-c541ab1a1cf28cb57dc18a7ea0bffe0c5cb1d9a8.tar.gz refcat-c541ab1a1cf28cb57dc18a7ea0bffe0c5cb1d9a8.zip |
add task to extract a resolved container name
Diffstat (limited to 'python')
-rw-r--r-- | python/refcat/tasks.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/python/refcat/tasks.py b/python/refcat/tasks.py index 68ba208..01b3b46 100644 --- a/python/refcat/tasks.py +++ b/python/refcat/tasks.py @@ -839,6 +839,7 @@ class OpenLibraryEditionsMapped(Refcat): # ----- # + class UnmatchedMapped(Refcat): """ Map unmatched refs (converted to release schema on the fly) to titles to do @@ -869,12 +870,12 @@ class UnmatchedResolveJournalNames(Refcat): Keep only the resolved docs (for now). """ def requires(self): - return UnmatchedMapped() + return UnmatchedRefs() def run(self): output = shellout(""" zstdcat -T0 {input} | - skate-resolve-journal-name -R -f 2 -B -A {abbrev} | + skate-resolve-journal-name -R -f 1 -B -A {abbrev} | zstd -T0 -c > {output} """, abbrev=settings.JOURNAL_ABBREVIATIONS, @@ -885,6 +886,29 @@ class UnmatchedResolveJournalNames(Refcat): return luigi.LocalTarget(path=self.path(ext="tsv.zst"), format=Zstd) +class UnmatchedResolveJournalNamesMapped(Refcat): + """ + Take the augmented unmatched refs data and map the container names (abbrev + and full). + """ + def requires(self): + return UnmatchedResolveJournalNames() + + def run(self): + output = shellout(""" + zstdcat -T0 {input} | + skate-map -m vcns -skip-on-empty 1 | + LC_ALL=C sort -T {tmpdir} -k1,1 -S25% --parallel 4 | + 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="tsv.zst"), format=Zstd) + + class UnmatchedOpenLibraryMatchTable(Refcat): """ Run matching and write tabular results to file. About 50M rows. |