コード例 #1
0
def getNumberOfEvents(dbname, tablename):
    db = utils.MySQLConnect(dbname)
    cur = db.cursor()
    cur.execute("""select COUNT( distinct EventID) from %s""" % tablename)
    for row in cur.fetchall():
        nbEvents = str(row[0])
    #print "number of Events is %s" %nbEvents
    return nbEvents
コード例 #2
0
def getListOfEvents(dbname, tablename):
    listEvents = []
    db = utils.MySQLConnect(dbname)
    cur = db.cursor()
    cur.execute("""select distinct EventID from %s order by EventID""" %
                tablename)
    for row in cur.fetchall():
        listEvents.append(str(row[0]))
    return listEvents
コード例 #3
0
def getlistAEROIDSinMapping(dbname, tablename):
    listAERO_IDs = []
    db = utils.MySQLConnect(dbname)
    cur = db.cursor()
    cur.execute("""SELECT distinct AERO_ID FROM %s order by AERO_ID""" %
                tablename)
    for row in cur.fetchall():
        #AERO_term = URIRef("http://purl.obolibrary.org/obo/"+row[0])
        listAERO_IDs.append(row[0])
    return listAERO_IDs
コード例 #4
0
def getListMappedAEROIDs(dbname, tablename):
    a = {}
    db = utils.MySQLConnect(dbname)
    cur = db.cursor()
    #get all the Meddra IDs in the mapping
    cur.execute("""select distinct AERO_ID, llt1_code from %s""" % tablename)
    for row in cur.fetchall():
        mappedAEROID = str(row[0])
        mappedMedDRATermID = str(row[1])
        a[mappedMedDRATermID] = mappedAEROID
    return a
コード例 #5
0
def getMedDRANamesforeachEventID(dbname, table, EventID):
    listMedDRANames = []
    ###print "event ID is", EventID
    db = utils.MySQLConnect(dbname)
    cur = db.cursor()
    #get the rows from the mysql table
    cur.execute('set profiling = 1')
    try:
        cur.execute("""SELECT EventID, llt1_code, llt1_name, llt2_code, llt2_name, llt3_code, llt3_name, llt4_code, llt4_name, llt5_code, llt5_name FROM %s WHERE EventID=%%s""" % table, (EventID))
    except Exception:
        cur.execute('show profiles')
        for row in cur3:
            print(row)
        
    #browse result
    for row in cur.fetchall():
        listMedDRANames.append(str(row[2]))
        listMedDRANames.append(str(row[4]))
        listMedDRANames.append(str(row[6]))
        listMedDRANames.append(str(row[8]))
        listMedDRANames.append(str(row[10]))
    return listMedDRANames