<commit_before>from flask import Flask, render_template
import yaml

import orcid

app = Flask(__name__)


@app.route('/')
def index():
    with open("config.yml", 'r') as ymlfile:
        cfg = yaml.load(ymlfile)

    name = cfg['user']['name']
    affiliation = cfg['user']['affiliation']
    gravatarhash = cfg['user']['gravatarhash']
    articles = cfg['articles']
    for article in articles:
        articles[article]['doiurl'] = "http://dx.doi.org/" + \
            articles[article]['doi']
    return render_template('sample.html',
                           profile_data={
                           "user": cfg['user'],
                           "name": name,
                           "affiliation": affiliation,
                           "gravatarhash": gravatarhash},
                           articles=articles)

@app.route('/<orcid_id>')
def storify(orcid_id):
    orcid_json = orcid.get_json(orcid_id)
    return render_template('sample.html',
                           profile_data=orcid_json,
                           articles={})

if __name__ == '__main__':
    app.run(debug=True)<commit_msg>Handle missing dois<commit_after>from flask import Flask, render_template
import yaml

import orcid

app = Flask(__name__)


@app.route('/')
def index():
    with open("config.yml", 'r') as ymlfile:
        cfg = yaml.load(ymlfile)

    name = cfg['user']['name']
    affiliation = cfg['user']['affiliation']
    gravatarhash = cfg['user']['gravatarhash']
    articles = cfg['articles']
    for article in articles:
        if 'doi' in articles[article].keys():
            articles[article]['doiurl'] = "http://dx.doi.org/" + \
                articles[article]['doi']
        else:
            articles[article]['doiurl'] = None
    return render_template('sample.html',
                           profile_data={
                           "user": cfg['user'],
                           "name": name,
                           "affiliation": affiliation,
                           "gravatarhash": gravatarhash},
                           articles=articles)

@app.route('/<orcid_id>')
def storify(orcid_id):
    orcid_json = orcid.get_json(orcid_id)
    return render_template('sample.html',
                           profile_data=orcid_json,
                           articles={})

if __name__ == '__main__':
    app.run(debug=True)
{'fraction_non_alphanumeric': 0.13565069944891903, 'fraction_numerical': 0.0, 'mean_word_length': 1.935323383084577, 'pattern_counts': {'":': 8, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4397321', 'n_tokens_mistral': 685, 'n_tokens_neox': 658, 'n_words': 130}