Пример #1
0
def get_papers_by_person_id(person_id= -1, rec_status= -2, ext_out=False):
    '''
    Returns all the papers written by the person

    @param person_id: identifier of the person to retrieve papers from
    @type person_id: int
    @param rec_status: minimal flag status a record must have to be displayed
    @type rec_status: int
    @param ext_out: Extended output (w/ author aff and date)
    @type ext_out: boolean

    @return: list of record ids
    @rtype: list of int
    '''
    if not isinstance(person_id, (int, long)):
        try:
            person_id = int(person_id)
        except (ValueError, TypeError):
            return []

    if person_id < 0:
        return []

    if not isinstance(rec_status, int):
        return []

    records = []
    db_data = dbapi.get_person_papers(person_id,
                                      rec_status,
                                      show_author_name=True,
                                      show_title=False,
                                      show_rt_status=True,
                                      show_affiliations=ext_out,
                                      show_date=ext_out,
                                      show_experiment=ext_out)
    if not ext_out:
        records = [[row["data"].split(",")[1], row["data"], row["flag"],
                    row["authorname"]] for row in db_data]
    else:
        for row in db_data:
            recid = row["data"].split(",")[1]
            bibref = row["data"]
            flag = row["flag"]
            authorname = row["authorname"]
            rt_status = row['rt_status']
            authoraff = ", ".join(row['affiliation'])

            try:
                date = sorted(row['date'], key=len)[0]
            except IndexError:
                date = "Not available"

            exp = ", ".join(row['experiment'])
            #date = ""
            records.append([recid, bibref, flag, authorname,
                            authoraff, date, rt_status, exp])


    return records
Пример #2
0
def get_papers_by_person_id(person_id= -1, rec_status= -2, ext_out=False):
    '''
    Returns all the papers written by the person

    @param person_id: identifier of the person to retrieve papers from
    @type person_id: int
    @param rec_status: minimal flag status a record must have to be displayed
    @type rec_status: int
    @param ext_out: Extended output (w/ author aff and date)
    @type ext_out: boolean

    @return: list of record ids
    @rtype: list of int
    '''
    if not isinstance(person_id, (int, long)):
        try:
            person_id = int(person_id)
        except (ValueError, TypeError):
            return []

    if person_id < 0:
        return []

    if not isinstance(rec_status, int):
        return []

    records = []
    db_data = dbapi.get_person_papers(person_id,
                                      rec_status,
                                      show_author_name=True,
                                      show_title=False,
                                      show_rt_status=True,
                                      show_affiliations=ext_out,
                                      show_date=ext_out,
                                      show_experiment=ext_out)
    if not ext_out:
        records = [[row["data"].split(",")[1], row["data"], row["flag"],
                    row["authorname"]] for row in db_data]
    else:
        for row in db_data:
            recid = row["data"].split(",")[1]
            bibref = row["data"]
            flag = row["flag"]
            authorname = row["authorname"]
            rt_status = row['rt_status']
            authoraff = ", ".join(row['affiliation'])

            try:
                date = sorted(row['date'], key=len)[0]
            except IndexError:
                date = "Not available"

            exp = ", ".join(row['experiment'])
            #date = ""
            records.append([recid, bibref, flag, authorname,
                            authoraff, date, rt_status, exp])


    return records
Пример #3
0
def get_papers_by_person_id(person_id= -1, rec_status= -2, ext_out=False):
    '''
    Returns all the papers written by the person

    @param person_id: identifier of the person to retrieve papers from
    @type person_id: int
    @param rec_status: minimal flag status a record must have to be displayed
    @type rec_status: int
    @param ext_out: Extended output (w/ author aff and date)
    @type ext_out: boolean

    @return: list of record ids
    @rtype: list of int
    '''
    if not isinstance(person_id, int):
        try:
            person_id = int(person_id)
        except (ValueError, TypeError):
            return []

    if person_id < 0:
        return []

    if not isinstance(rec_status, int):
        return []

    records = []
    db_data = dbapi.get_person_papers((person_id,),
                                   rec_status,
                                   show_author_name=True,
                                   show_title=False,
                                   show_rt_status=True)
    if not ext_out:
        records = [[row["data"].split(",")[1], row["data"], row["flag"],
                    row["authorname"]] for row in db_data]
    else:
        for row in db_data:
            recid = row["data"].split(",")[1]
            bibref = row["data"]
            flag = row["flag"]
            authorname = row["authorname"]
            rt_status = row['rt_status']
            gfoc = get_field_values_on_condition
            authoraff = ", ".join(gfoc(recid, ["100", "700"], "u", "a",
                                       authorname, source="API"))

            #Date retrival disabled to increase UI speed.
            try:
                date = list(gfoc(recid, "269", "c"))[0]
            except (IndexError):
                date = "Not available"

            try:
                exp = list(gfoc(recid, "693", "e"))[0]
            except (IndexError):
                exp = "None"
            #date = ""
            records.append([recid, bibref, flag, authorname,
                            authoraff, date, rt_status, exp])


    return records
Пример #4
0
def get_papers_by_person_id(person_id=-1, rec_status=-2, ext_out=False):
    '''
    Returns all the papers written by the person

    @param person_id: identifier of the person to retrieve papers from
    @type person_id: int
    @param rec_status: minimal flag status a record must have to be displayed
    @type rec_status: int
    @param ext_out: Extended output (w/ author aff and date)
    @type ext_out: boolean

    @return: list of record ids
    @rtype: list of int
    '''
    if not isinstance(person_id, int):
        try:
            person_id = int(person_id)
        except (ValueError, TypeError):
            return []

    if person_id < 0:
        return []

    if not isinstance(rec_status, int):
        return []

    records = []
    db_data = dbapi.get_person_papers((person_id, ),
                                      rec_status,
                                      show_author_name=True,
                                      show_title=False,
                                      show_rt_status=True)
    if not ext_out:
        records = [[
            row["data"].split(",")[1], row["data"], row["flag"],
            row["authorname"]
        ] for row in db_data]
    else:
        for row in db_data:
            recid = row["data"].split(",")[1]
            bibref = row["data"]
            flag = row["flag"]
            authorname = row["authorname"]
            rt_status = row['rt_status']
            gfoc = get_field_values_on_condition
            authoraff = ", ".join(
                gfoc(recid, ["100", "700"], "u", "a", authorname,
                     source="API"))

            #Date retrival disabled to increase UI speed.
            try:
                date = list(gfoc(recid, "269", "c"))[0]
            except (IndexError):
                date = "Not available"

            try:
                exp = list(gfoc(recid, "693", "e"))[0]
            except (IndexError):
                exp = "None"
            #date = ""
            records.append([
                recid, bibref, flag, authorname, authoraff, date, rt_status,
                exp
            ])

    return records