diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-06-23 17:23:37 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-06-23 17:23:37 -0700 |
commit | 427f25fb9a362348df644afae2f56124634ca67d (patch) | |
tree | 1fc8ef796abdaac009121bca2093214e4ff77578 /chocula/directories/vanished_inactive.py | |
parent | 571b1f77e9375c7bab5ccbe8ae41c60dd2c64779 (diff) | |
download | chocula-427f25fb9a362348df644afae2f56124634ca67d.tar.gz chocula-427f25fb9a362348df644afae2f56124634ca67d.zip |
vanished journal metadata importer
Diffstat (limited to 'chocula/directories/vanished_inactive.py')
-rw-r--r-- | chocula/directories/vanished_inactive.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/chocula/directories/vanished_inactive.py b/chocula/directories/vanished_inactive.py new file mode 100644 index 0000000..7996084 --- /dev/null +++ b/chocula/directories/vanished_inactive.py @@ -0,0 +1,50 @@ +import csv +from typing import Iterable, Optional + +from chocula.util import clean_str, clean_issn, parse_lang, parse_country +from chocula.common import DirectoryLoader +from chocula.database import DirectoryInfo + + +class VanishedInactiveLoader(DirectoryLoader): + """ + Journal-level metadata from the "Vanished Journals" project. This is the + "inactive" dataset. + + CSV headers: + + - Source + - Title + - Identifier + - Publisher + - Comment + - Language + - ISSN + - EISSN + - Keyword + - Start Year + - End Year + - Added on date + - Subjects + - Country + - Publication fee + - Further Information + """ + + source_slug = "vanished_inactive" + + def open_file(self) -> Iterable: + return csv.DictReader(open(self.config.vanished_inactive.filepath)) + + def parse_record(self, record) -> Optional[DirectoryInfo]: + + info = DirectoryInfo( + directory_slug=self.source_slug, + raw_issn=clean_issn(record["ISSN"]), + issne=clean_issn(record["EISSN"]), + name=clean_str(record["Title"]), + publisher=clean_str(record["Publisher"]), + langs=[parse_lang(record["Language"])], + country=parse_country(record["Country"]), + ) + return info |