@@ -0,0 +1,1384 @@
+from portality import models%0Afrom portality.core import app%0Afrom portality.clcsv import UnicodeWriter%0Aimport esprit%0Aimport codecs%0A%0A%0ANOT_IN_DOAJ = %7B%0A    %22query%22 : %7B%0A        %22bool%22 : %7B%0A            %22must%22 : %5B%0A                %7B%22term%22 : %7B%22admin.in_doaj%22 : False%7D%7D%0A            %5D%0A        %7D%0A    %7D%0A%7D%0A%0Aif __name__ == %22__main__%22:%0A%0A    import argparse%0A    parser = argparse.ArgumentParser()%0A    parser.add_argument(%22-o%22, %22--out%22, help=%22output file path%22)%0A    args = parser.parse_args()%0A%0A    if not args.out:%0A        print %22Please specify an output file path with the -o option%22%0A        parser.print_help()%0A        exit()%0A%0A    conn = esprit.raw.make_connection(None, app.config%5B%22ELASTIC_SEARCH_HOST%22%5D, None, app.config%5B%22ELASTIC_SEARCH_DB%22%5D)%0A%0A    with codecs.open(args.out, %22wb%22, %22utf-8%22) as f:%0A        writer = UnicodeWriter(f)%0A        writer.writerow(%5B%22ID%22, %22Journal Name%22, %22E-ISSN%22, %22P-ISSN%22, %22Article Count%22%5D)%0A%0A        for j in esprit.tasks.scroll(conn, models.Journal.__type__, q=NOT_IN_DOAJ, page_size=100, keepalive='5m'):%0A            journal = models.Journal(_source=j)%0A            bibjson = journal.bibjson()%0A            issns = bibjson.issns()%0A            count = models.Article.count_by_issns(issns)%0A%0A            if count %3E 0:%0A                writer.writerow(%5Bjournal.id, bibjson.title, bibjson.get_one_identifier(bibjson.E_ISSN), bibjson.get_one_identifier(bibjson.P_ISSN), count%5D)%0A%0A%0A%0A%0A

add script to output csv of all journals which are not in_doaj and which have articles