From 8265242e89485c5275995d47738f815531c4f983 Mon Sep 17 00:00:00 2001 From: art Date: Tue, 3 Mar 2020 19:39:58 -0600 Subject: [PATCH] superscript.py v 0.0.1.000 --- data analysis/__pycache__/data.cpython-37.pyc | Bin 2395 -> 2703 bytes data analysis/data.py | 8 ++++++- data analysis/superscript.py | 22 ++++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/data analysis/__pycache__/data.cpython-37.pyc b/data analysis/__pycache__/data.cpython-37.pyc index 26adb70c8eb795e7b37db5d9c15504b9f8ab095e..fb5f86d2bd71756539e47ba71cd851ca7e340c99 100644 GIT binary patch delta 720 zcmZ9K%Wl*#6o&0Mx5;Rx^fDJ(E>qf}3X4jxsMIY}RvtaQiF3kYq}uYAKgZGU<8$(R<+9U$-fBez#tV|Z{~FHQeR??G zdDUu*rB5V@1bsu|J3l^LI?L9bsA*w+UY1!QVrEUBjp&+r$NtccIdG5YHs~^y9dMIf zL=Vvi#DTnvdL6L=NP;rgf@?1CVdy^M0U!>ghr0H7h-!e?L_9)lnQvj=eDWrVA=1M2wQC^62 zT4Zt;J+^C)ywKL<;l_HM)&Msa8Li?gruFjTDaf%4z!AU-VU1v^1Ar#iv?4cj=2q^+ znR%5rVKcw-uic7Pj-XdgMYUHsA8C&Wr$;baF~P1};odMx1c6?7uVbgKj&(6->+rMK zwJgnr>|DSh@)-gPe;E6VYbIST^~t$RvF2$hr{heiyf{uGbV+rlv`U&XD^K}2!|Pk7 zw1l?Z>PFqs0Uog^0A5rggv9&Wc6qK&z!H4%w0(#v+#ocfK1{g>I&Mk^k2*u^m%I>M n{r?Rb7+ynQ@#PRv_X4Xc_snMFad!n|NbBi_LD+!V3|s#Ir$>}9 delta 416 zcmZ9HKTg9i6vk`v$8M^ICT*Zl3Z)gGP*n^puu{fs-8>W-oJv77O`Qyk8~~|`ym0|G zBrd=PhbRYN;tu$w5<~r@pFTf7eed(a`*!WCYSk*K^Y%L)U*p_vq98vB3^XeF_WRRf z!=d_pI*XSkOOi0=zD8w78zNV7?FZFmpifX&>Eu?_m5XQqJiwNMkHt3VCSXT_;v~vA z%b3`ORtvDF;1gkhEdRN0UxKf1t%o65$fgfbno%-|VtzA=L(vD1Zs8Hd8I^O=Y8R>20y!}E xpX!60Ukp||GQv1=el)^Vez?gSO36HLmgDt{{3PO|_2 diff --git a/data analysis/data.py b/data analysis/data.py index 6649a292..6632d660 100644 --- a/data analysis/data.py +++ b/data analysis/data.py @@ -52,4 +52,10 @@ def get_data_formatted(apikey, competition): out[int(i)] = unkeyify_2l(get_team_match_data(apikey, competition, int(i)).transpose().to_dict()) except: pass - return out \ No newline at end of file + return out + +def push_team_data(apikey, competition, team_num, data): + client = pymongo.MongoClient(apikey) + db = client.arthur_data_processing + mdata = db.team_tests + mdata.replace_one({"competition" : competition, "team": team_num}, {"_id": competition+str(team_num)+"am", "competition" : competition, "team" : team_num, "data" : data}, True) \ No newline at end of file diff --git a/data analysis/superscript.py b/data analysis/superscript.py index a983323c..820d9fc4 100644 --- a/data analysis/superscript.py +++ b/data analysis/superscript.py @@ -3,10 +3,12 @@ # Notes: # setup: -__version__ = "0.0.0.009" +__version__ = "0.0.1.000" # changelog should be viewed using print(analysis.__changelog__) __changelog__ = """changelog: + 0.0.1.000: + - tested working, can push to database 0.0.0.009: - tested working - prints out stats for the time being, will push to database later @@ -63,11 +65,21 @@ except: def main(): while(True): + print("loading config") competition, config = load_config("config.csv") + print("config loaded") + print("loading database keys") apikey = an.load_csv("keys.txt")[0][0] + print("loaded keys") + print("loading data") data = d.get_data_formatted(apikey, competition) + print("loaded data") + print("running tests") results = simpleloop(data, config) - print(results) + print("finished tests") + print("pushing to database") + push_to_database(apikey, competition, results) + print("pushed to database") def load_config(file): config_vector = {} @@ -117,6 +129,12 @@ def simplestats(data, test): if(test == "regression_sigmoidal"): return an.regression('cpu', list(range(len(data))), data, ['sig']) +def push_to_database(apikey, competition, results): + + for team in results: + + d.push_team_data(apikey, competition, team, results[team]) + def metricsloop(group_data, observations, database, tests): # listener based metrics update pass