Skip to content

Commit

Permalink
Merge tag '2023-12-11_withdrawn_journals_without_None' into develop
Browse files Browse the repository at this point in the history
Update to withdrawn journals script
  • Loading branch information
Steven-Eardley committed Dec 11, 2023
2 parents c76aab2 + cd0168f commit 6de7cb8
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions portality/scripts/231127_withdrawn_journals.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
from portality.models import Journal
import csv


NOT_IN_DOAJ = {
"query" : {
"bool" : {
"must" : [
{"term" : {"admin.in_doaj" : False}}
"query": {
"bool": {
"must": [
{"term": {"admin.in_doaj": False}}
]
}
}
}

IN_DOAJ = {
"query" : {
"bool" : {
"must" : [
{"term" : {"admin.in_doaj" : True}}
"query": {
"bool": {
"must": [
{"term": {"admin.in_doaj": True}}
]
}
}
Expand All @@ -25,6 +24,7 @@
if __name__ == "__main__":

import argparse

parser = argparse.ArgumentParser()
parser.add_argument("-o", "--out", help="output file path")
args = parser.parse_args()
Expand All @@ -37,7 +37,7 @@
with open(args.out, "w", encoding="utf-8") as f:
writer = csv.writer(f)
writer.writerow(["ID",
"Journal Name",
"Journal Title",
"Journal URL",
"E-ISSN",
"P-ISSN"
Expand All @@ -49,19 +49,17 @@
in_doaj_issns.add(bibjson.get_one_identifier(bibjson.E_ISSN))
in_doaj_issns.add(bibjson.get_one_identifier(bibjson.P_ISSN))

# Remove the value None so we don't match on all records
in_doaj_issns.discard(None)

for journal in Journal.iterate(q=NOT_IN_DOAJ, keepalive='5m', wrap=True):
bibjson = journal.bibjson()
eissn = bibjson.get_one_identifier(bibjson.E_ISSN)
pissn = bibjson.get_one_identifier(bibjson.P_ISSN)
if (eissn not in in_doaj_issns and pissn not in in_doaj_issns):
if eissn not in in_doaj_issns and pissn not in in_doaj_issns:
writer.writerow([journal.id,
bibjson.title,
bibjson.get_single_url(urltype="homepage"),
eissn,
pissn,
])




0 comments on commit 6de7cb8

Please sign in to comment.