diff --git a/data analysis/__pycache__/data.cpython-37.pyc b/data analysis/__pycache__/data.cpython-37.pyc index 26adb70c..fb5f86d2 100644 Binary files a/data analysis/__pycache__/data.cpython-37.pyc and b/data analysis/__pycache__/data.cpython-37.pyc differ 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