def check_record(record):
    first_author = True
    doc_ids = get_doc_ids(record['recid'])
    for doc_id in doc_ids:
        latest_file = get_latest_file(doc_id)
        try:
            xml = parse(latest_file)
        except Exception:
            #TODO: Warn
            continue
        authors = record['authors']
        authors_d = get_authors(xml)
        for author, author_d in zip(authors, authors_d):

            # clear author
            while author:
                author.popitem()

            # full_name
            author_name = (author_d['surname'], author_d.get(
                'given_name') or author_d.get('initials'))
            author_name = ('a', '%s, %s' % author_name)
            author['full_name'] = author_name

            # orcid, affiliation, email
            for key in ('orcid', 'affiliation', 'email'):
                try:
                    author[key] = author_d[key]
                except KeyError:
                    pass

            add_nations_field(subfields)  # TODO
def check_record(record):
    first_author = True
    doc_ids = get_doc_ids(record['recid'])
    for doc_id in doc_ids:
        latest_file = get_latest_file(doc_id)
        try:
            xml = parse(latest_file)
        except Exception:
            #TODO: Warn
            continue
        authors = record['authors']
        authors_d = get_authors(xml)
        for author, author_d in zip(authors, authors_d):

            # clear author
            while author:
                author.popitem()

            # full_name
            author_name = (author_d['surname'], author_d.get('given_name')
                           or author_d.get('initials'))
            author_name = ('a', '%s, %s' % author_name)
            author['full_name'] = author_name

            # orcid, affiliation, email
            for key in ('orcid', 'affiliation', 'email'):
                try:
                    author[key] = author_d[key]
                except KeyError:
                    pass

            add_nations_field(subfields)  # TODO
예제 #3
0
def check_record(record):
    doc_ids = get_doc_ids(record['recid'])
    for doc_id in doc_ids:
        latest_file = get_latest_file(doc_id)
        try:
            xml_doc = parse(latest_file)
        except (IOError, ExpatError):
            # TODO Log warning
            pass
        orcids = _get_orcids(xml_doc)
        for orcid, author_dict in zip(orcids, record['authors']):
            _set_orcid(author_dict, orcid)