Skip to content

Latest commit

 

History

History
619 lines (540 loc) · 16.8 KB

edit.org

File metadata and controls

619 lines (540 loc) · 16.8 KB

Editorial Organization

Checklist for each paper

  • Correct SWH id
  • Remove the 000 DOI
  • Add journal number
    • Volume: 8, Issue: 2
    • Accepted date: April 11, 2022
    • Publication date: May 23, 2022
  • Total Papers: 47 + 1 (for editorial)

Investigate the code DOI case

Dependency: ruamel

from ruamel import yaml
import glob
import os

# print(os.chdir("2021/"))
metadata_files = glob.glob("**/journal/metadata.yaml")
metadata_files = [x for x in metadata_files if "template" not in x]
metadata_files = [x for x in metadata_files if "editorial" not in x]

print("Total projects: ", len(metadata_files))

issues = []
for mfile in metadata_files:
    try:
        paper = mfile.split("/")[0]
        meta = yaml.safe_load(open(mfile))
        code_items = {k: v for d in meta["code"] for k, v in d.items()}
        print(paper, code_items["doi"])
    except:
        issues.append(paper)

print(f"Found {len(issues)}")
print(issues)

Investigate code SWH

from ruamel import yaml
import glob


metadata_files = glob.glob("**/journal/metadata.yaml")
metadata_files = [x for x in metadata_files if "template" not in x]
metadata_files = [x for x in metadata_files if "editorial" not in x]

print(len(metadata_files))

issues = []
for mfile in metadata_files:
    try:
        paper = mfile.split("/")[0]
        meta = yaml.safe_load(open(mfile))
        code_items = {k: v for d in meta["code"] for k, v in d.items()}
        print(paper, code_items["swh"])
        print("------")
    except:
        issues.append(paper)

print(f"Found {len(issues)}")
print(issues)

Do we have all projects?

Check if all teams submitted their projects.

pip install bibtexparser
import bibtexparser

with open('accepted.bib') as bibtex_file:
    bib_database = bibtexparser.load(bibtex_file)

print(len(bib_database.entries))

bibkeys = set(bib_database.entries_dict.keys())
print(bibkeys - set(article_number.keys()))

So one guy decided to not submit a camera ready version!

Pre Publishing Steps

Zenodo Access Tokens

Get access tokens from Zenodo, and then populate here.

Sandbox

export ZENODO_SANDBOX_TOKEN=""

Production

export ZENODO_TOKEN=""

In python

zenodo_tokens = {
    'sandbox': "",
    'production': ""
}

Reserve DOI

import json
import yaml
import requests

def reserve_doi(server, token):
    """ Reserve a new DOI on Zenodo """

    headers = { "Content-Type": "application/json" }
    url = f'https://{server}/api/deposit/depositions'
    response = requests.post(url, params={'access_token': token},
                             json={}, headers=headers)
    if response.status_code != 201:
        raise IOError("%s: " % response.status_code +
                      str(response))
    data = response.json()
    return data["id"], data["metadata"]["prereserve_doi"]["doi"]

Test Reserve DOI

zenodo_url = {
    "sandbox": "sandbox.zenodo.org",
    "production": "zenodo.org"
}

def reserve_zenodo_info(server="sandbox"):
    server_url = zenodo_url[server]
    token = zenodo_tokens[server]
    article_id, article_doi = reserve_doi(server_url, token)
    article_url = f"https://{server_url}/record/{article_id}/files/article.pdf"
    return article_id, article_doi, article_url
print(reserve_zenodo_info("production"))

Add journal metadata

The following script automatically updates the metadata.yaml files with the publishing information, and reserves the DOI from Zenodo. Test this script first setting “zenodo_server” to “sandbox”.

import glob
import re

metadata_files = glob.glob("**/journal/metadata.yaml")
metadata_files = [x for x in metadata_files if "template" not in x]
metadata_files = [x for x in metadata_files if "editorial" not in x]

print(len(metadata_files))

def update_line(lines, search, dest):
    dt_line = [i for i,line in enumerate(lines) if search in line]
    assert len(dt_line) == 1, f"Found {len(dt_line)} matches"
    lines[dt_line[0]] = dest
    return lines

def update_article(lines, doi="", url=""):
    article_start = [i for i, line in enumerate(lines) if line.startswith("article:")]
    article_end = [i for i, line in enumerate(lines) if line.startswith("journal:")]
    assert len(article_start) == 1
    assert len(article_end) == 1
    article_start = article_start[0]
    article_end = article_end[0] - 2
    doi_line = [i for i, line in enumerate(lines) if (i > article_start and i < article_end and "doi:" in line)]
    assert len(doi_line) == 1
    doi_line = doi_line[0]
    url_line = [i for i, line in enumerate(lines) if (i > article_start and i < article_end and "url:" in line)]
    assert len(url_line) == 1
    url_line = url_line[0]

    lines[doi_line] = f"  - doi: {doi}\n"
    lines[url_line] = f"  - url: {url}\n"
    return lines


issues = []
article_number = {}
metadata_files = list(sorted(metadata_files))
metadata_files.append("editorial/journal/metadata.yaml")

zenodo_server = "production"

# debug
# metadata_files = [metadata_files[0]]

for mfile in metadata_files:
    try:
        paper = mfile.split("/")[0]
        ## load the paper
        lines = []
        with open(mfile) as fp:
            for line in fp:
                lines.append(line)

        ## sequential updates
        if paper != "editorial":
            lines = update_line(lines, "received:", "  - received:  February 4, 2022\n")
            lines = update_line(lines, "accepted:", "  - accepted:  April 11, 2022\n")
        lines = update_line(lines, "published:", "  - published:  May 23, 2022\n")
        # lines = update_line(lines, "- name: Koustuv Sinha", "  - name: Koustuv Sinha,\\\\ Sharath Chandra Raparthy\n")

        article_number[paper] = len(article_number) + 1

        lines =  update_line(lines, "number:", f"  - number: {article_number[paper]}\n")
        lines = update_line(lines, "volume:", "  - volume: 8\n")
        lines = update_line(lines, "issue:", "  - issue: 2\n")

        # Update DOI
        ## fetch from Zenodo

        article_id, article_doi, article_url = reserve_zenodo_info(zenodo_server)
        lines = update_article(lines, doi=article_doi, url=article_url)

        # update file
        with open(mfile, "w") as fp:
            for line in lines:
                fp.write(line)

    except Exception as e:
        issues.append(paper)
        raise(e)

print(f"Found {len(issues)}")
print(issues)

Final inspection [47/47]

ahmed2022re

ankit2022counterfactual

ashok2022re

athanasiadis2022weaklysupervised

bagad2022reproducibility

boer2022reproducibility

brivio2022reproducibility

burger2022reproducibility

buvanesh2022re

dasu2022reproduction

drabent2022replication

dzubur2022re

eaton2022reproduction

eijkelboom2022reproduction

geijn2022reproducibility

hardy2022re

hoppe2022re

jiles2022re

kirca2022reproducibility

kolkman2022strategic

korporaal2022replication

lombardo2022on

luisa2022thompson

mast2022replication

matsumoto2022re

mehta2022re

mikler2022comparing

nalmpantis2022re

neplenbroek2022replication

nilsson2022replicating

panigrahi2022re

petcu2022replication

peters2022reproducing

ranjan2022re

rucks2022re

sen2022reproducibility

shukla2022from

stropnik2022re

tersek2022re

togt2022badder

trojer2022transparent

vleuten2022re

wang2022replication

warmerdam2022re

wilschut2022reproducibility

yilmaz2022re

zrimsek2022learning