diff --git a/backend/clr/clr.py b/backend/clr/clr.py deleted file mode 100644 index 4d50a64..0000000 --- a/backend/clr/clr.py +++ /dev/null @@ -1,183 +0,0 @@ -import json -import math -import time -import copy -import random -import numpy as np -import pandas as pd -from pprint import pprint - - - -''' - reads in sample data with number of businesses, round size, and randomization parameters - args: - csv_filename - 'filename.csv' - _seed - int - _num_biz - int - _contribs - int - returns: - list of lists data with parameters - [[grant_id (str), user_id (str), contribution_amount (float)]] -''' -def get_data(csv_filename, _seed=9, _num_biz=8, _contribs=1000): - df = pd.read_csv(csv_filename) - - # generate random business ids - random.seed(_seed) - selected_ids = random.sample(range(100), _num_biz) - - # get relevant columns and restrict round size - rel = ['grant_id', 'contributor_profile_id', 'amount_per_period_usdt'] - f = df[rel] - f = f.iloc[0:_contribs] - - # randomly populate grant ids - # np.random.seed(_seed) - # f['grant_id'] = np.random.choice(selected_ids, size=len(f)) - - # numeric to str - f.loc[:, 'grant_id'] = f.loc[:, 'grant_id'].astype(str) - - # create list of lists from dataframe - ll = f.T.values.T.tolist() - - # mix it up - random.seed(_seed) - mix = random.sample(ll, len(ll)) - - return mix - - - -''' - translates django grant data structure to a list of lists - args: - django grant data structure - { - 'id': (string) , - 'contibutions' : [ - { - contributor_profile (str) : contribution_amount (int) - } - ] - } - returns: - list of lists of grant data - [[grant_id (str), user_id (str), contribution_amount (float)]] -''' -def translate_data(grants_data): - grants_list = [] - for g in grants_data: - grant_id = g.get('id') - for c in g.get('contributions'): - val = [grant_id] + [list(c.keys())[0], list(c.values())[0]] - grants_list.append(val) - - return grants_list - - - -''' - aggregates contributions by contributor - args: - list of lists of grant data - [[grant_id (str), user_id (str), contribution_amount (float)]] - returns: - aggregated contributions by user, organized by grant - {grant_id (str): {user_id (str): aggregated_amount (float)}} -''' -def aggregate_contributions(grant_contributions): - contrib_dict = {} - for proj, user, amount in grant_contributions: - if proj not in contrib_dict: - contrib_dict[proj] = {} - contrib_dict[proj][user] = contrib_dict[proj].get(user, 0) + amount - - return contrib_dict - - - -''' - calculates the clr amount at the given threshold and total pot - args: - aggregated_contributions - {grant_id (str): {user_id (str): aggregated_amount (float)}} - _cap - float - total_pot - float - returns: - total clr award by grant - [{'id': proj, 'clr_amount': clr_amount}] - bigtot - int - saturation point - boolean -''' -def calculate_clr(aggregated_contributions, _cap=8000, total_pot=25000.0): - saturation_point = False - bigtot = 0 - totals = [] - for proj, contribz in aggregated_contributions.items(): - ssq = 0 - tot = 0 - for u1, v1 in contribz.items(): - # sum of square root - ssq += v1 ** 0.5 - # sum of contributions - tot += v1 - # non-clr pairwise formula - clr_amount = (ssq ** 2) - tot - - # implement cap - if clr_amount >= _cap: - clr_amount = _cap - - # results for total - totals.append({'id': proj, 'clr_amount': clr_amount}) - bigtot += clr_amount - - - # warn if sataurated - if bigtot >= total_pot: - saturation_point = True - - return totals, bigtot, saturation_point - - - -if __name__ == '__main__': - data = get_data('testing.csv', _contribs=200) # 142 - data_agg = aggregate_contributions(data) - totals, bigtot, sp = calculate_clr(data_agg) - print(f'past saturation point?: {sp} w/ total pot @ {bigtot}') - pprint(totals) - - - -''' -results for 141 and 142 contributions -past saturation point?: False w/ total pot @ 24844.538740555377 -[{'clr_amount': 3041.183077725673, 'id': '17'}, - {'clr_amount': 5108.96906073675, 'id': '47'}, - {'clr_amount': 6250, 'id': '59'}, - {'clr_amount': 720.6434705877829, 'id': '78'}, - {'clr_amount': 4050.201367913871, 'id': '86'}, - {'clr_amount': 2587.4232337582002, 'id': '23'}, - {'clr_amount': 2358.428233897319, 'id': '34'}, - {'clr_amount': 727.6902959357832, 'id': '0'}] -past saturation point?: True w/ total pot @ 25587.716151776673 -[{'clr_amount': 3041.183077725673, 'id': '17'}, - {'clr_amount': 5852.146471958044, 'id': '47'}, - {'clr_amount': 6250, 'id': '59'}, - {'clr_amount': 720.6434705877829, 'id': '78'}, - {'clr_amount': 2587.4232337582, 'id': '23'}, - {'clr_amount': 4050.201367913871, 'id': '86'}, - {'clr_amount': 2358.428233897319, 'id': '34'}, - {'clr_amount': 727.6902959357832, 'id': '0'}] -''' \ No newline at end of file diff --git a/backend/clr/sample_data.csv b/backend/clr/sample_data.csv deleted file mode 100644 index 92e1a43..0000000 --- a/backend/clr/sample_data.csv +++ /dev/null @@ -1,900 +0,0 @@ -grant_id,grant_type,contributor_profile_id,amount_per_period_usdt -498,health,5552,0.94842448 -545,health,5433,23.75 -547,health,8517,4.75 -558,health,60127,11.72339469 -578,health,47385,0.95 -483,health,2288,50 -558,health,63673,9.5 -494,health,80462,0.95 -545,health,72084,4.75 -694,health,73151,0.95 -558,health,72941,4.75 -566,health,8521,9.9 -547,health,79274,9.5 -545,health,5184,95 -694,health,68437,2.85 -647,health,78798,47.82240074 -503,health,79492,1.407942132 -493,health,72686,1.185066002 -494,health,11269,1.8 -558,health,72463,14.85 -503,health,72460,1.361921755 -656,health,2288,10 -541,health,61895,4.75 -541,health,67007,4.75 -578,health,72844,1.9 -498,health,57580,9.5 -494,health,72460,1.361921755 -558,health,12374,1.045 -652,health,62916,10.5 -523,health,18954,19 -547,health,79776,10 -578,health,78709,7.892941335 -547,health,5019,9.5 -545,health,15172,0.95 -598,health,73749,9.631548732 -501,health,4823,9.5 -541,health,57842,47.5 -498,health,4142,110 -541,health,62087,0.95 -547,health,78764,9.5 -578,health,71131,4.75 -578,health,2956,5 -578,health,75943,19 -498,health,77442,104.5 -547,health,63666,9.5 -493,health,80327,1.019450976 -578,health,4200,0.4199 -578,health,59428,1 -697,health,60103,0.95 -498,health,4823,9.5 -558,health,72434,4.75 -547,health,79755,10 -504,health,2288,50 -547,health,79772,10 -696,health,63505,4.75 -541,health,78278,10.45 -547,health,79550,4.75 -545,health,73504,5.035 -541,health,66530,4.75 -547,health,64356,9.5 -493,health,4142,125 -553,health,77766,2.628649691 -578,health,72986,0.95 -561,health,2288,11 -504,health,78087,1.344837416 -547,health,79594,9.75 -694,health,1594,9.5 -558,health,79828,9.5 -541,health,72045,1.9 -572,health,80327,1.019450976 -545,health,60110,1187.5 -696,health,73084,4.75 -545,health,79900,9.490445559 -558,health,76835,1.9 -558,health,79546,19.8 -547,health,79757,10 -541,health,72054,9.5 -572,health,4142,100 -498,health,7479,0.95 -541,health,145,0.95 -494,health,80238,2.605867283 -534,health,74316,1.995 -545,health,2288,10 -647,health,63329,9.5 -523,health,73125,30.4 -545,health,5256,0.95 -541,health,73055,0.95 -547,health,78542,94.696 -498,health,79854,4.75 -523,health,72773,0.95 -545,health,79231,95 -547,health,79784,10 -707,health,80278,98.84242362 -547,health,79576,10 -494,health,12535,1.584848165 -523,health,67181,0.95 -541,health,80462,1.9 -553,health,78087,1.344837416 -561,health,59542,1.434477174 -578,health,79976,4.75 -694,health,60103,0.95 -494,health,77636,1636.590508 -523,health,77853,9.5 -523,health,61060,0.95 -558,health,65632,0.95 -558,health,70818,0.95 -547,health,79574,10 -523,health,72857,11.4 -541,health,4200,1 -498,health,78288,4.75 -578,health,11269,13.44837416 -493,health,79979,4.6138542 -504,health,79983,3.0759028 -558,health,76571,4.75 -578,health,28630,4.75 -578,health,73413,0.95 -545,health,72853,4.75 -578,health,79770,20.176 -578,health,72460,1.461397521 -696,health,73495,2.85 -523,health,66628,4.75 -541,health,69323,2.054750388 -498,health,79188,14.07942132 -547,health,79548,9.5 -578,health,80305,8.601345477 -558,health,66900,2.276584657 -558,health,8521,3.335821769 -578,health,67297,4.75 -498,health,79775,0.00E+00 -501,health,2857,1.9 -652,health,8521,4.9507703 -483,health,3934,9.5 -558,health,79198,0.95 -561,health,64456,47.4672867 -621,health,73866,1.588834262 -558,health,72635,1.9 -504,health,77622,67.03056712 -523,health,7974,4.75 -656,health,66610,212.9414258 -494,health,80360,1.359267968 -558,health,71995,35 -647,health,63197,19.95 -547,health,78546,123.5 -578,health,79470,4.75 -494,health,47385,0.95 -558,health,80184,14.25 -498,health,71332,0.95 -694,health,29260,0.98 -504,health,77766,1.314324845 -558,health,79836,6.65 -578,health,78313,98.81853225 -578,health,17665,1.9 -504,health,66610,562.994301 -696,health,66539,1.98 -652,health,4673,4.75 -494,health,79491,1.267147919 -498,health,71567,9.5 -498,health,80148,4.75 -494,health,36500,9.493472426 -498,health,2857,4.75 -541,health,78411,47.5 -572,health,79986,1.5379514 -652,health,73715,0.95 -498,health,73508,3.8 -541,health,76583,0.95 -694,health,73508,0.95 -498,health,68527,0.95 -503,health,36500,9.493472426 -696,health,72045,1.9 -578,health,12535,0.0095 -578,health,73507,19 -617,health,66610,212.9414258 -547,health,79950,9.5 -545,health,78448,0.95 -541,health,10633,4.75 -523,health,66431,1.0003 -523,health,72853,23.75 -561,health,15505,0.908233345 -694,health,80186,3.394826183 -694,health,77567,4.75 -523,health,46401,1.8971 -652,health,79825,4.75 -493,health,79986,1.5379514 -549,health,77926,9.5 -523,health,75285,4.75 -656,health,79983,1.5379514 -696,health,79997,9.5 -558,health,73446,8.55 -694,health,79372,9.5 -558,health,66597,1.176202809 -547,health,71052,9.5 -561,health,3477,19 -494,health,71131,4.75 -494,health,80280,4.75 -501,health,2651,19 -647,health,77575,10 -558,health,10583,14.5825 -572,health,697,500 -541,health,64419,9.494775807 -682,health,79921,9260.014925 -547,health,78849,9.5 -547,health,67074,95 -662,health,80327,3.568078416 -523,health,76583,0.95 -558,health,45987,1.045 -518,health,72686,39.12088155 -494,health,1873,2 -523,health,19443,2.0045 -541,health,80443,95 -523,health,10633,4.75 -541,health,79985,27.37553492 -662,health,72248,0.0142 -498,health,77732,462.8819617 -541,health,66431,1.0003 -541,health,72853,23.75 -553,health,72460,1.304180932 -558,health,68527,0.95 -578,health,79703,9.5 -503,health,66610,791.3251914 -558,health,73508,4.75 -694,health,10732,0.95 -545,health,69323,2.054750388 -545,health,72986,0.95 -707,health,2174,9.350596924 -647,health,75062,176.429 -498,health,68792,9.5 -504,health,36500,9.493472426 -545,health,79271,2.97 -697,health,10410,9.5 -494,health,9538,4.75 -578,health,54770,36.67 -494,health,66610,441.2723162 -694,health,78416,16.49071057 -523,health,72184,0.95 -558,health,62630,2 -694,health,6829,0.95 -498,health,6829,0.95 -558,health,46424,0.95 -578,health,23423,19.45 -483,health,6855,47.5 -503,health,72764,0.838551416 -621,health,67778,1.02 -647,health,78723,10 -696,health,62432,0.95 -578,health,78086,1.344837416 -541,health,75285,4.75 -547,health,79294,19 -578,health,59672,0.95 -652,health,62630,0.95 -696,health,7930,4.75 -547,health,79747,10 -494,health,72764,3.525058091 -498,health,64665,9.477787272 -553,health,66425,553.6413569 -558,health,79372,9.5 -621,health,59542,27.26455635 -523,health,75458,2.1375 -545,health,1946,9.5 -682,health,79986,1.07656598 -547,health,79782,10 -494,health,79555,0.700619337 -541,health,79635,4.75 -578,health,2288,1 -523,health,26917,4.75 -494,health,77669,13.61921755 -682,health,79979,4.6138542 -578,health,73554,1.9 -504,health,72844,1.9 -578,health,391,9.5 -494,health,79983,1.5379514 -547,health,78262,0.95 -547,health,78599,217.1 -578,health,62432,33.695214 -696,health,2288,10 -696,health,18954,4.75 -547,health,79171,9.5 -647,health,75244,30 -494,health,59542,1.190075972 -541,health,66628,4.75 -547,health,79577,9.5 -652,health,60103,0.07 -498,health,70818,0.95 -541,health,79100,0.95 -502,health,79986,1.5379514 -621,health,67058,4.75 -498,health,79881,110.6323931 -547,health,78736,28.5 -558,health,60103,4.75 -694,health,77921,0.95 -545,health,62073,4.75 -656,health,28361,94.91059264 -485,health,17721,9.5 -498,health,10795,4.75 -561,health,47385,0.95 -494,health,77766,1.314324845 -578,health,79916,4.742030172 -483,health,79271,0.99 -493,health,79831,0.95 -498,health,66908,0.95 -541,health,65592,5 -547,health,79992,9.5 -558,health,60097,1.9 -503,health,77766,1.314324845 -547,health,79271,2.97 -547,health,80494,61.75 -656,health,36500,9.493472426 -541,health,9538,4.75 -547,health,6158,4.75 -549,health,65645,19 -494,health,77622,117.0927643 -547,health,75943,0.95 -498,health,69781,13.45405074 -498,health,79198,0.95 -498,health,72635,9.5 -498,health,78438,95 -578,health,41145,0.95 -578,health,71111,84.954248 -520,health,79986,1.5379514 -541,health,74855,0.00E+00 -621,health,9538,0.95 -652,health,63379,4.75 -578,health,1386,66.9197744 -493,health,26579,1 -503,health,2288,10 -656,health,72460,1.311547409 -547,health,1826,95 -656,health,80327,1.019450976 -694,health,9377,9.5 -696,health,6829,0.95 -578,health,26551,4.75 -558,health,73413,5.7 -578,health,2413,0.95 -504,health,72338,13.04180932 -541,health,72084,4.75 -558,health,11269,1.8 -547,health,79193,9.5 -534,health,23158,9.5 -523,health,62087,1.9 -494,health,2288,40 -505,health,78285,26.33801434 -523,health,8802,4.75 -523,health,79976,4.75 -558,health,66566,1.9 -685,health,77821,0.95 -694,health,67644,0.95 -696,health,80374,3 -558,health,79837,4.75 -652,health,11269,1.8 -545,health,66453,4.75 -547,health,70915,9.5 -547,health,78739,28.5 -652,health,3617,4.75 -547,health,72807,0.95 -682,health,4142,20 -494,health,60110,1187.5 -483,health,77663,0.99 -652,health,72280,5 -685,health,79528,11.20990939 -558,health,73688,12.87368561 -547,health,65655,10 -558,health,79827,9.5 -578,health,66628,47.5 -656,health,4142,100 -498,health,63448,2 -547,health,79974,2.85 -547,health,78903,9.5 -578,health,79100,1.9 -652,health,4142,20 -694,health,80456,3.406889784 -578,health,2406,9.025 -621,health,62432,10 -682,health,80327,1.019450976 -547,health,343,9.9 -547,health,10078,4.75 -682,health,72460,1.461397521 -685,health,71477,9.5 -566,health,38469,0.95 -503,health,68145,750 -541,health,410,15.21125254 -578,health,70818,4.75 -498,health,78807,9.5 -494,health,3221,5.00E-07 -505,health,78509,461.8026179 -545,health,61895,4.75 -682,health,79492,2.815884264 -541,health,23158,100 -547,health,78801,18.5 -561,health,62392,692.6056022 -578,health,78149,0.95 -545,health,66047,0.95 -547,health,79562,9.5 -498,health,78328,188.7956938 -547,health,79206,9.5 -558,health,73055,0.95 -523,health,66410,0.95 -578,health,66811,6.84 -662,health,79986,1.5379514 -558,health,71828,3.8 -578,health,9538,4.75 -578,health,66908,4.75 -697,health,8521,9.9 -541,health,72642,3.015011754 -694,health,11420,0.95 -498,health,79178,0.95 -558,health,80305,8.601345477 -558,health,66410,2.85 -578,health,63719,13.75546913 -578,health,66900,5.335794226 -523,health,71828,14.25 -694,health,75288,5.428044091 -503,health,78087,1.344837416 -541,health,67181,0.95 -545,health,42931,0.95 -652,health,1594,47.5 -494,health,79818,2.550162798 -541,health,73027,0.95 -558,health,2646,2.375 -547,health,78923,15 -558,health,72045,25.65 -498,health,15172,0.95 -523,health,4599,1 -545,health,68153,47.5 -558,health,66539,1.98 -541,health,41145,1.9 -541,health,79178,0.95 -498,health,79774,19 -523,health,72420,0.99 -547,health,72667,1 -656,health,79492,5.631768528 -541,health,75288,1 -647,health,65658,10.449 -694,health,80329,0.169908496 -523,health,72034,3.325 -541,health,72773,4.75 -578,health,3992,32.3130717 -494,health,80609,174.3332982 -578,health,79170,0.001 -696,health,78416,16.49071057 -523,health,73119,0.95 -541,health,15172,0.95 -553,health,79986,1.5379514 -647,health,65781,57.95 -483,health,4142,50 -494,health,78087,4.034512248 -647,health,63692,46.138542 -696,health,46401,3.330409513 -547,health,79645,9.75 -561,health,72737,10 -578,health,53070,2.85 -694,health,68028,0.95 -547,health,80370,95 -493,health,3221,5.00E-07 -494,health,7918,0.95 -498,health,61946,9.5 -647,health,77458,3.8 -572,health,2288,10 -685,health,79450,2.815884264 -494,health,4671,4.75 -547,health,79798,10 -498,health,78087,1.075869933 -545,health,72280,99 -652,health,73151,0.95 -494,health,41145,0.95 -498,health,69269,47.5 -545,health,43243,100.7 -694,health,7948,4.75 -696,health,71995,2.97 -541,health,2749,47.5 -694,health,73581,2.85 -498,health,79987,10.4186 -541,health,60099,9.5 -685,health,72327,0.9 -696,health,65592,10 -541,health,78087,1.344837416 -541,health,73504,4.75 -545,health,66566,4.75 -494,health,78147,0.135475 -545,health,78321,1 -547,health,79585,9.75 -520,health,80327,1.019450976 -547,health,80286,3 -494,health,8269,0.95 -498,health,80217,9.5 -520,health,72460,1.361921755 -652,health,75433,0.95 -700,health,3636,16.30228484 -541,health,10878,5 -545,health,72363,1.9 -523,health,11288,3.8 -561,health,80462,1.9 -558,health,23007,0.95 -493,health,78087,4.034512248 -541,health,54770,55.005 -545,health,11269,1.8 -561,health,7479,0.95 -694,health,79703,9.5 -558,health,66169,2.375 -662,health,79979,2.92210766 -498,health,80183,0.00E+00 -541,health,80217,9.5 -621,health,67142,9.5 -685,health,66811,4.75 -541,health,60110,1187.5 -558,health,79458,47.5 -617,health,80327,1.019450976 -485,health,60110,1187.5 -523,health,61895,4.75 -523,health,67007,9.5 -617,health,72460,1.338395488 -652,health,9530,7.88 -652,health,42931,0.95 -547,health,74094,9.5 -523,health,62847,41.3554 -547,health,77606,10.3702 -558,health,73495,2.85 -578,health,79658,4.75 -498,health,10782,4.75 -498,health,68899,0.95 -498,health,78393,6.65 -541,health,80567,1.425 -652,health,72867,4.75 -493,health,3843,13.64017409 -504,health,4142,10 -652,health,8959,0.00E+00 -493,health,2288,100 -498,health,79789,8.93 -694,health,75950,4.75 -498,health,75650,0.95 -541,health,80230,19 -547,health,73507,0.95 -621,health,78271,1.90217835 -559,health,63786,1.341157499 -662,health,36500,9.493472426 -621,health,2288,2 -502,health,4142,20 -498,health,79777,0.00E+00 -505,health,78432,47.5 -561,health,32289,0.95 -647,health,2288,5 -504,health,80327,1.019450976 -547,health,78830,9.5 -498,health,2288,10 -498,health,10778,0.95 -504,health,72460,1.361921755 -541,health,73782,0.95 -696,health,65632,0.931 -558,health,73580,43 -558,health,79725,34.0109 -547,health,12535,0.95 -523,health,42931,4.75 -545,health,80462,0.95 -572,health,78087,2.689674832 -617,health,4142,10 -498,health,75669,4.75 -502,health,80327,1.019450976 -494,health,69213,0.95 -534,health,3221,0.95 -566,health,7921,0.95 -694,health,35031,22.8 -502,health,72460,1.361921755 -558,health,61895,4.75 -547,health,79989,9.5 -558,health,72318,5.942036951 -561,health,4823,9.5 -541,health,12374,1.045 -647,health,75130,100 -578,health,61447,23.75 -547,health,79762,10 -498,health,12535,1.584848165 -523,health,2749,19 -578,health,13713,1.9 -545,health,79864,9.5 -523,health,73581,2.85 -541,health,11288,28.5 -558,health,73544,65 -652,health,4900,0.95 -505,health,14141,9.5 -545,health,10869,95 -498,health,63102,1.9 -547,health,78725,38 -696,health,73691,2.85 -578,health,45987,4.75 -547,health,79988,9.5 -578,health,79566,0.95 -494,health,21752,0.95 -558,health,68028,0.95 -578,health,78009,4.75 -696,health,80025,52.93518092 -547,health,78541,92.112 -547,health,78623,179 -694,health,61895,4.75 -503,health,80327,1.019450976 -578,health,37341,2.85 -621,health,71724,4 -652,health,2288,5 -694,health,59336,1.411407268 -547,health,79984,9.5 -558,health,18954,4.75 -547,health,77613,11 -697,health,26917,2.85 -558,health,73726,9.5 -494,health,80327,1.019450976 -494,health,71506,3.400217063 -498,health,79788,19 -503,health,4142,20 -523,health,12374,1.045 -545,health,63190,0.95 -547,health,79605,9.75 -541,health,2197,13.26116591 -558,health,60035,4.75 -662,health,66610,212.9414258 -494,health,4142,100 -523,health,73782,0.95 -545,health,7918,1.9 -541,health,42931,4.75 -558,health,77727,9.5 -682,health,2288,10 -578,health,80535,4.75 -494,health,71724,1 -520,health,78087,1.344837416 -558,health,73283,4.75 -547,health,79786,10 -578,health,64958,23.70906004 -498,health,72667,1 -523,health,3616,4.75 -545,health,3636,5.382829901 -696,health,79372,9.5 -498,health,78579,65.57737047 -523,health,79864,9.5 -694,health,79997,9.5 -498,health,72860,9.628828392 -505,health,4142,5 -547,health,5628,0.0313 -578,health,78268,9.5 -621,health,66566,4.75 -697,health,79901,8.399 -493,health,72460,1.361921755 -652,health,62432,2 -547,health,78536,83.6 -493,health,72667,2 -541,health,72419,19.2594 -558,health,7930,16.95 -694,health,13573,1.9 -558,health,68233,11.4 -502,health,2288,30 -558,health,62432,2 -652,health,15172,0.95 -523,health,72199,47.5 -541,health,10078,2.85 -547,health,78886,5 -578,health,19830,4.997816768 -498,health,66539,1.98 -541,health,66410,0.95 -662,health,79983,2.15313196 -694,health,66539,1.98 -572,health,72460,1.394460262 -547,health,78539,107.35 -652,health,75288,1 -547,health,78540,91.86 -558,health,67181,0.95 -652,health,73125,10.2125 -502,health,78087,1.344837416 -647,health,77635,9.67 -652,health,39733,8.530609533 -694,health,2646,1.9 -696,health,73508,1.9 -498,health,2646,0.95 -561,health,78165,0.95 -541,health,72420,0.99 -523,health,33225,47.5 -696,health,45987,1.9 -493,health,79492,1.407942132 -578,health,78442,2.375 -493,health,77663,2.415 -498,health,17665,1.9 -541,health,72034,3.325 -545,health,12374,1.045 -578,health,75501,1.8525 -647,health,76533,35.8835 -498,health,72054,4.75 -694,health,73055,0.95 -498,health,73629,18.91454967 -696,health,77567,4.75 -494,health,79986,1.5379514 -541,health,72477,9.328281924 -561,health,66366,10.185 -578,health,8802,4.75 -694,health,75943,4.75 -494,health,69152,9.5 -541,health,62878,105.5435019 -578,health,4142,100 -694,health,28361,474.2030172 -541,health,60103,4.75 -696,health,73340,33.9816992 -503,health,79986,1.5379514 -572,health,36500,9.493472426 -493,health,69323,1.832416822 -561,health,73301,9.7042 -694,health,71131,1.007 -498,health,78810,1 -578,health,72419,19 -547,health,74639,20.9 -498,health,69323,1.832416822 -498,health,72986,0.95 -547,health,66908,4.75 -694,health,69323,2.459886376 -520,health,77766,1.314324845 -523,health,73764,30 -578,health,4823,9.5 -561,health,66597,1.997043669 -547,health,8583,1.425 -558,health,7982,4.75 -652,health,61060,0.95 -493,health,3552,7.125 -545,health,73301,0.95 -547,health,78538,85.5 -545,health,657,35.9678718 -547,health,73878,9.5 -578,health,66410,0.95 -662,health,2288,10 -545,health,50904,0.95 -493,health,79491,1.267147919 -493,health,36500,9.493472426 -682,health,66610,762.5603647 -558,health,11214,2 -545,health,66366,10.08 -494,health,41843,4.5125 -652,health,9538,0.95 -697,health,80103,1.805 -502,health,77766,1.314324845 -523,health,78284,23.75 -578,health,38034,17.43332982 -558,health,65592,10 -578,health,15344,3.14 -578,health,7479,0.95 -523,health,66900,3 -549,health,54746,4.953753038 -578,health,77944,10.45 -518,health,72084,4.75 -558,health,80235,4.75 -494,health,2857,1.9 -647,health,75501,104.49 -547,health,78872,190.95 -578,health,77115,0.00E+00 -498,health,64967,19 -545,health,78322,1 -493,health,62073,4.7509 -523,health,79379,1.9 -541,health,349,4.75 -547,health,78726,9.5 -502,health,66610,441.2723162 -541,health,72037,4.75 -652,health,46401,6.65 -502,health,9538,4.75 -498,health,47385,0.95 -558,health,66721,4.75 -498,health,10846,0.95 -523,health,77792,0.95 -498,health,78697,9.5 -541,health,45987,9.5 -547,health,67983,9.5 -547,health,78879,9.5 -545,health,73764,10 -498,health,62073,10.45 -652,health,69031,1.9 -523,health,6829,0.95 -501,health,2956,10 -694,health,1898,10 -520,health,66610,212.9414258 -541,health,65645,20.32125 -547,health,73042,62.3925 -541,health,66448,1.9 -547,health,78772,614 -578,health,68053,1.9 -498,health,39244,1.9 -498,health,67162,24.11397521 -566,health,2184,1.9 -558,health,78528,2.85 -561,health,19668,71.25 -578,health,66779,0.95 -518,health,78087,1.344837416 -578,health,71724,1 -523,health,66597,2 -547,health,79648,4.75 -494,health,79979,4.6138542 -694,health,63505,4.75 -502,health,72764,2.180233682 -561,health,17721,9.5 -493,health,72844,1.9 -682,health,79983,2.3069271 -545,health,8521,42.93960855 -561,health,66882,103.0151307 -493,health,66431,1.0003 -493,health,77766,1.314324845 -523,health,349,4.75 -545,health,60103,4.75 -541,health,66604,6.724187079 -558,health,65441,4.75 -566,health,72908,1.9 -578,health,7948,4.75 -561,health,72364,95 -662,health,72460,1.461397521 -558,health,72184,0.95 -494,health,79831,4.75 -578,health,78712,0.02 -545,health,72477,5.596969155 -578,health,67142,9.5 -572,health,1776,0.95 -578,health,78165,0.95 -541,health,79379,1.9 -694,health,77592,0.031701428 -621,health,66913,0.95 -553,health,80327,1.019450976 -561,health,68399,9.9 -578,health,3221,1.9 -502,health,36500,9.493472426 -498,health,72903,0.95 -523,health,45987,4.75 -652,health,76583,0.95 -652,health,47385,0.95 -541,health,75073,14.44615929 -547,health,79760,10 -694,health,46401,6.304427029 -697,health,79968,20.0555 -578,health,80217,9.5 -498,health,10777,0.95 -547,health,79750,10 -541,health,66366,10.185 -541,health,73301,1.9 -493,health,79983,3.0759028 -572,health,77766,1.314324845 -656,health,79986,1.5379514 -498,health,59542,3.0759028 -523,health,65645,0.95 -498,health,78528,0.95 -578,health,35031,0.948647811 -547,health,8043,192.5 -694,health,69031,0.95 -498,health,66798,0.95 -541,health,61191,4.75 -523,health,23657,1 -523,health,50662,0.95 -561,health,78792,4.75 -498,health,79794,9.5 -541,health,66597,1.176202809 -520,health,36500,9.493472426 -662,health,79492,2.815884264 -558,health,79271,0.99 -652,health,69323,2.459886376 -558,health,73191,14.66882171 -545,health,2857,1.9 -547,health,78900,9.5 -685,health,79670,14.34477174 -694,health,79960,1.485509238 -523,health,72477,4.95 -578,health,78881,1 -493,health,72764,1.9 -652,health,79271,0.99 -697,health,80097,285 -549,health,55372,38.99189051 -617,health,79986,1.5379514 -694,health,63735,4.75 -558,health,73575,82.65 -541,health,73764,30 -598,health,80555,39.62120413 -494,health,66366,10.185 -498,health,78678,9.5 -545,health,41843,4.75 -572,health,66610,662.965106 -494,health,73301,0.95 -498,health,1626,1.9 -494,health,72603,0.065 -694,health,1626,19 -493,health,79555,0.856497156 -494,health,657,21.7178718 -694,health,66628,4.75 -504,health,79986,1.5379514 -534,health,8521,19 -694,health,79100,0.95 -498,health,79100,0.95 -541,health,17721,10 -694,health,80235,2.85 -617,health,41843,1.1875 -523,health,127,9.5 -547,health,78844,9.5 -541,health,71995,5 -621,health,72635,4.75 -498,health,7974,1.9 -682,health,79491,1.267147919 -697,health,79942,19 -545,health,50662,0.95 -694,health,78611,9.983415583 -498,health,78683,0.00E+00 -493,health,66610,441.2723162 -578,health,66782,0.95 -647,health,74445,20 -493,health,9538,0.95 -498,health,69213,0.95 -541,health,79864,9.5 \ No newline at end of file diff --git a/backend/clr/testing.csv b/backend/clr/testing.csv deleted file mode 100644 index 28cb5c8..0000000 --- a/backend/clr/testing.csv +++ /dev/null @@ -1,26 +0,0 @@ -grant_id,grant_type,contributor_profile_id,amount_per_period_usdt -1,health,1,16 -1,health,2,16 -1,health,3,16 -1,health,4,16 -1,health,5,16 -1,health,6,16 -1,health,7,16 -1,health,8,16 -1,health,9,16 -1,health,10,16 -1,health,11,16 -1,health,12,16 -1,health,13,16 -1,health,14,16 -1,health,15,16 -1,health,16,16 -1,health,17,16 -1,health,18,16 -1,health,19,16 -1,health,20,16 -1,health,21,16 -1,health,22,16 -1,health,23,16 -1,health,24,16 -1,health,25,16 diff --git a/backend/downtownapi/main/clr.py b/backend/downtownapi/main/clr.py index 110875f..3a22509 100644 --- a/backend/downtownapi/main/clr.py +++ b/backend/downtownapi/main/clr.py @@ -75,7 +75,7 @@ def aggregate_contributions(grant_contributions): ''' -def calculate_clr(aggregated_contributions, _cap=6250, total_pot=25000.0): +def calculate_clr(aggregated_contributions, _cap=8000, total_pot=25000.0): saturation_point = False bigtot = 0 totals = [] @@ -116,7 +116,7 @@ def calculate_clr(aggregated_contributions, _cap=6250, total_pot=25000.0): return totals, bigtot_normalized_cap, saturation_point -def calculate_live_clr(aggregated_contributions, business_id, _cap=6250, total_pot=25000.0): +def calculate_live_clr(aggregated_contributions, business_id, _cap=8000, total_pot=25000.0): ''' Calculates the CLR match for user before donation