Example #1
0
def get_processed_external_recids(pid):
    '''
    Returns processed external recids
    @param pid: pid
    @return: [str]
    '''
    db_data = dbinter.get_person_data(pid, "processed_external_recids")
    recid_list_str = ''

    if db_data and db_data[0] and db_data[0][1]:
        recid_list_str = db_data[0][1]

    return recid_list_str
def get_processed_external_recids(pid):
    '''
    Returns processed external recids
    @param pid: pid
    @return: [str]
    '''
    db_data = dbinter.get_person_data(pid, "processed_external_recids")
    recid_list_str = ''

    if db_data and db_data[0] and db_data[0][1]:
        recid_list_str = db_data[0][1]

    return recid_list_str
def assign_uid_to_person(uid, pid, create_new_pid=False, force=False):
    '''
    Assigns a userid to a person, counterchecknig with get_personid_from_uid.
    If uid has already other person returns other person.
    If create_new_pid and the pid is -1 creates a new person.
    If force, deletes any reference to that uid from the tables and assigns to pid, if pid wrong
    (less then zero) returns -1.
    @param uid: user id, int
    @param pid: person id, int
    @param create_new_pid: bool
    @param force, bool
    '''

    if force and pid >= 0:
        dbinter.del_person_data(tag='uid', value=str(uid))
        dbinter.set_person_data(pid, 'uid', str(uid))
        return pid
    elif force and pid < 0:
        return -1

    current = dbinter.get_personid_from_uid(((uid,),))

    if current[1]:
        return current[0][0]
    else:
        if pid >= 0:
            cuid = dbinter.get_person_data(pid, 'uid')
            if len(cuid) > 0:
                if str(cuid[0][1]) == str(uid):
                    return pid
                else:
                    if create_new_pid:
                        dbinter.create_new_person_from_uid(uid)
                    else:
                        return -1
            else:
                dbinter.set_person_data(pid, 'uid', str(uid))
                return pid
        else:
            if create_new_pid:
                dbinter.create_new_person_from_uid(uid)
            else:
                return -1
def assign_person_to_uid(uid, pid):
    '''
    Assigns a person to a userid. If person already assigned to someone else, create new person.
    Returns the peron id assigned.
    @param uid: user id, int
    @param pid: person id, int, if -1 creates new person.
    @return: pid int
    '''
    if pid == -1:
        pid = dbinter.create_new_person_from_uid(uid)
        return pid
    else:
        current_uid = dbinter.get_person_data(pid, 'uid')
        if len(current_uid) == 0:
            dbinter.set_person_data(pid, 'uid', str(uid))
            return pid
        else:
            pid = dbinter.create_new_person_from_uid(uid)
            return pid
Example #5
0
def assign_uid_to_person(uid, pid, create_new_pid=False, force=False):
    '''
    Assigns a userid to a person, counterchecknig with get_personid_from_uid.
    If uid has already other person returns other person.
    If create_new_pid and the pid is -1 creates a new person.
    If force, deletes any reference to that uid from the tables and assigns to pid, if pid wrong
    (less then zero) returns -1.
    @param uid: user id, int
    @param pid: person id, int
    @param create_new_pid: bool
    @param force, bool
    '''

    if force and pid >= 0:
        dbinter.del_person_data(tag='uid', value=str(uid))
        dbinter.set_person_data(pid, 'uid', str(uid))
        return pid
    elif force and pid < 0:
        return -1

    current = dbinter.get_personid_from_uid(((uid, ), ))

    if current[1]:
        return current[0][0]
    else:
        if pid >= 0:
            cuid = dbinter.get_person_data(pid, 'uid')
            if len(cuid) > 0:
                if str(cuid[0][1]) == str(uid):
                    return pid
                else:
                    if create_new_pid:
                        dbinter.create_new_person_from_uid(uid)
                    else:
                        return -1
            else:
                dbinter.set_person_data(pid, 'uid', str(uid))
                return pid
        else:
            if create_new_pid:
                dbinter.create_new_person_from_uid(uid)
            else:
                return -1
Example #6
0
def assign_person_to_uid(uid, pid):
    '''
    Assigns a person to a userid. If person already assigned to someone else, create new person.
    Returns the peron id assigned.
    @param uid: user id, int
    @param pid: person id, int, if -1 creates new person.
    @return: pid int
    '''
    if pid == -1:
        pid = dbinter.create_new_person_from_uid(uid)
        return pid
    else:
        current_uid = dbinter.get_person_data(pid, 'uid')
        if len(current_uid) == 0:
            dbinter.set_person_data(pid, 'uid', str(uid))
            return pid
        else:
            pid = dbinter.create_new_person_from_uid(uid)
            return pid
def get_person_papers_to_be_manually_reviewed(pid):
    '''
    Returns the set of papers awaiting for manual review for a person for bibref assignment
    @param pid: the personid, int
    '''
    return dbinter.get_person_data(pid, 'paper_needs_bibref_manual_confirm')
Example #8
0
def get_person_papers_to_be_manually_reviewed(pid):
    '''
    Returns the set of papers awaiting for manual review for a person for bibref assignment
    @param pid: the personid, int
    '''
    return dbinter.get_person_data(pid, 'paper_needs_bibref_manual_confirm')