def dereference_institution(input_record, institutions):
    'Tool for replacing placeholders for institutions with the actual\n    institution data. Note that the replacement is done inplace\n\n    Parameters\n    ----------\n    input_record : dict\n        The record to dereference\n    institutions : iterable of dicts\n        The institutions\n    '
    inst = (input_record.get('institution') or input_record.get('organization'))
    if (not inst):
        error = (input_record.get('position') or input_record.get('degree'))
        print('WARNING: no institution or organization but found {}'.format(error))
    db_inst = fuzzy_retrieval(institutions, ['name', '_id', 'aka'], inst)
    if db_inst:
        input_record['institution'] = db_inst['name']
        input_record['organization'] = db_inst['name']
        if (db_inst.get('country') == 'USA'):
            state_country = db_inst.get('state')
        else:
            state_country = db_inst.get('country')
        input_record['location'] = '{}, {}'.format(db_inst['city'], state_country)
        if (not db_inst.get('departments')):
            print('WARNING: no departments in {}. {} sought'.format(db_inst.get('_id'), inst))
        if (('department' in input_record) and db_inst.get('departments')):
            input_record['department'] = fuzzy_retrieval([db_inst['departments']], ['name', 'aka'], input_record['department'])
        else:
            input_record['department'] = inst
Tool for replacing placeholders for institutions with the actual
institution data. Note that the replacement is done inplace

Parameters
----------
input_record : dict
    The record to dereference
institutions : iterable of dicts
    The institutions
def dereference_institution(input_record, institutions):
    'Tool for replacing placeholders for institutions with the actual\n    institution data. Note that the replacement is done inplace\n\n    Parameters\n    ----------\n    input_record : dict\n        The record to dereference\n    institutions : iterable of dicts\n        The institutions\n    '
    inst = (input_record.get('institution') or input_record.get('organization'))
    if (not inst):
        error = (input_record.get('position') or input_record.get('degree'))
        print('WARNING: no institution or organization but found {}'.format(error))
    db_inst = fuzzy_retrieval(institutions, ['name', '_id', 'aka'], inst)
    if db_inst:
        input_record['institution'] = db_inst['name']
        input_record['organization'] = db_inst['name']
        if (db_inst.get('country') == 'USA'):
            state_country = db_inst.get('state')
        else:
            state_country = db_inst.get('country')
        input_record['location'] = '{}, {}'.format(db_inst['city'], state_country)
        if (not db_inst.get('departments')):
            print('WARNING: no departments in {}. {} sought'.format(db_inst.get('_id'), inst))
        if (('department' in input_record) and db_inst.get('departments')):
            input_record['department'] = fuzzy_retrieval([db_inst['departments']], ['name', 'aka'], input_record['department'])
        else:
            input_record['department'] = inst