aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-07-31 15:51:45 -0700
committerBryan Newbold <bnewbold@archive.org>2020-08-03 10:50:14 -0700
commit482f185496b7baa9e421829c6ebe8da31d7850d8 (patch)
treedc63dbca7a5cb83d8a1b39f4bc370f178fa688fc
parentee65634b8f7d8cc482b8bbe521f7ad9e62e4211c (diff)
downloadchocula-482f185496b7baa9e421829c6ebe8da31d7850d8.tar.gz
chocula-482f185496b7baa9e421829c6ebe8da31d7850d8.zip
fatcat export improvements
-rw-r--r--chocula/database.py37
1 files changed, 28 insertions, 9 deletions
diff --git a/chocula/database.py b/chocula/database.py
index fa8d105..e266b1c 100644
--- a/chocula/database.py
+++ b/chocula/database.py
@@ -684,7 +684,10 @@ class ChoculaDatabase:
)
extra = dict(
- issnp=row["issnp"], issne=row["issne"], country=row["country"],
+ issnp=row["issnp"],
+ issne=row["issne"],
+ country=row["country"],
+ publisher_type=row["publisher_type"],
)
if row["lang"]:
extra["languages"] = [
@@ -786,24 +789,40 @@ class ChoculaDatabase:
"SELECT * FROM directory WHERE issnl = ?;", [row["issnl"]]
)
for drow in cur:
+ dextra = dict()
+ if drow["extra"]:
+ dextra = json.loads(drow["extra"])
if drow["slug"] == "ezb":
- ezb = json.loads(drow["extra"])
extra["ezb"] = dict(
- ezb_id=drow["identifier"], color=ezb["ezb_color"]
+ ezb_id=drow["identifier"], color=dextra["ezb_color"]
)
elif drow["slug"] == "szczepanski":
- extra["szczepanski"] = drow["extra"]
+ extra["szczepanski"] = dict(as_of=dextra["as_of"])
+ elif drow["slug"] == "norwegian":
+ extra["norwegian"] = dict(as_of=dextra["as_of"], level=dextra.get("level"))
elif drow["slug"] == "doaj":
- extra["doaj"] = json.loads(drow["extra"])
+ extra["doaj"] = dict(as_of=dextra["as_of"])
+ for k in ("seal", "default_license", "crawl_permission", "archive", "mimetypes"):
+ if dextra.get(k) is not None:
+ extra["doaj"][k] = dextra[k]
elif drow["slug"] == "scielo":
- extra["scielo"] = json.loads(drow["extra"])
+ extra["scielo"] = dict()
+ for k in ("collection", "status"):
+ if dextra.get(k) is not None:
+ extra["scielo"][k] = dextra[k]
elif drow["slug"] == "sim":
extra["ia"] = extra.get("ia", {})
- extra["ia"]["sim"] = json.loads(drow["extra"])
- extra["ia"]["sim"]["sim_pubid"] = drow["identifier"]
+ extra["ia"]["sim"] = dict(sim_pubid=drow["identifier"])
+ for k in ("year_spans", "pub_type", "peer_reviewed", "scholarly_peer_reviewed"):
+ if dextra.get(k) is not None:
+ extra["ia"]["sim"][k] = dextra[k]
elif drow["slug"] in ("lockss", "clockss", "portico", "jstor"):
extra["kbart"] = extra.get("kbart", {})
- extra["kbart"][drow["slug"]] = json.loads(drow["extra"])
+ extra["kbart"][drow["slug"]] = dict(year_spans=dextra['year_spans'])
+ if dextra.get('abbrev'):
+ extra['abbrev'] = dextra['abbrev']
+ if dextra.get('platform'):
+ extra['platform'] = dextra['platform']
out["extra"] = extra
print(json.dumps(out))