diff --git a/portality/scripts/231127_withdrawn_journals.py b/portality/scripts/231127_withdrawn_journals.py index 1eddf809de..e71a37e2c2 100644 --- a/portality/scripts/231127_withdrawn_journals.py +++ b/portality/scripts/231127_withdrawn_journals.py @@ -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}} ] } } @@ -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() @@ -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" @@ -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, ]) - - - -