def grandco_auction():
    """
    Loads auction result data for grand county
    :param parceltable:
    :param lienauction:
    :return:
    """
    from db import LienAuction, Parcel
    try:
        LienAuction.create_table()
    except:
        pass

    dataframe = pd.read_csv('data/GrandCo/All_Results.csv')
    count = 0
    for p in dataframe.iterrows():
        data = p[1]
        try:
            prop = Parcel.get(Parcel.Parcel_ID == data.Parcel_ID and Parcel.County == 'Grand')
        except Exception as e:
            if 'Instance matching query does not exist' in str(e):
                prop = Parcel.create(Parcel_ID=data.Parcel_ID)
            else:
                print('The problem is {}'.format(data.Parcel_ID))
                print(e)

        LienAuction.create(Parcel_ID=prop,
                           Bidder_ID=data.Bidder_ID,
                           Face_Value=data.Face_Value,
                           Name=data.Name,
                           Tax_Year=data.Tax_Year,
                           Winning_Bid=data.Winning_Bid)
        count += 1
    print('Imported {} auction results'.format(count))
Example #2
0
def grandco_auction():
    """
    Loads auction result data for grand county
    :param parceltable:
    :param lienauction:
    :return:
    """
    from db import LienAuction, Parcel
    try:
        LienAuction.create_table()
    except:
        pass

    dataframe = pd.read_csv('data/GrandCo/All_Results.csv')
    count = 0
    for p in dataframe.iterrows():
        data = p[1]
        try:
            prop = Parcel.get(Parcel.Parcel_ID == data.Parcel_ID
                              and Parcel.County == 'Grand')
        except Exception as e:
            if 'Instance matching query does not exist' in str(e):
                prop = Parcel.create(Parcel_ID=data.Parcel_ID)
            else:
                print('The problem is {}'.format(data.Parcel_ID))
                print(e)

        LienAuction.create(Parcel_ID=prop,
                           Bidder_ID=data.Bidder_ID,
                           Face_Value=data.Face_Value,
                           Name=data.Name,
                           Tax_Year=data.Tax_Year,
                           Winning_Bid=data.Winning_Bid)
        count += 1
    print('Imported {} auction results'.format(count))
def search():
    search_query = request.args.get('q')
    if search_query:
        entries = LienAuction.select().where(LienAuction.Tax_Year == search_query)
        #Parcel.get(Parcel.id == e.Parcel_ID).Parcel_ID
    else:
        entries = LienAuction.select().where(LienAuction.Tax_Year == 2013)

    #sample = [(s.Winning_Bid, s.Face_Value) for s in LienAuction.select().where(LienAuction.Tax_Year == 2014)]
    # entries = LienAuction.select().where(LienAuction.Tax_Year == 2013)
    # entries = [1,2,3,4,5]
    return render_template('accounts.html', entries=entries, Parcel=Parcel)
Example #4
0
def search():
    search_query = request.args.get('q')
    if search_query:
        entries = LienAuction.select().where(
            LienAuction.Tax_Year == search_query)
        #Parcel.get(Parcel.id == e.Parcel_ID).Parcel_ID
    else:
        entries = LienAuction.select().where(LienAuction.Tax_Year == 2013)

    #sample = [(s.Winning_Bid, s.Face_Value) for s in LienAuction.select().where(LienAuction.Tax_Year == 2014)]
    # entries = LienAuction.select().where(LienAuction.Tax_Year == 2013)
    # entries = [1,2,3,4,5]
    return render_template('accounts.html', entries=entries, Parcel=Parcel)