superscript.py v 0.0.1.000

This commit is contained in:
art 2020-03-03 19:39:58 -06:00
parent f45773d470
commit 8265242e89
3 changed files with 27 additions and 3 deletions

View File

@ -53,3 +53,9 @@ def get_data_formatted(apikey, competition):
except: except:
pass pass
return out 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)

View File

@ -3,10 +3,12 @@
# Notes: # Notes:
# setup: # setup:
__version__ = "0.0.0.009" __version__ = "0.0.1.000"
# changelog should be viewed using print(analysis.__changelog__) # changelog should be viewed using print(analysis.__changelog__)
__changelog__ = """changelog: __changelog__ = """changelog:
0.0.1.000:
- tested working, can push to database
0.0.0.009: 0.0.0.009:
- tested working - tested working
- prints out stats for the time being, will push to database later - prints out stats for the time being, will push to database later
@ -63,11 +65,21 @@ except:
def main(): def main():
while(True): while(True):
print("loading config")
competition, config = load_config("config.csv") competition, config = load_config("config.csv")
print("config loaded")
print("loading database keys")
apikey = an.load_csv("keys.txt")[0][0] apikey = an.load_csv("keys.txt")[0][0]
print("loaded keys")
print("loading data")
data = d.get_data_formatted(apikey, competition) data = d.get_data_formatted(apikey, competition)
print("loaded data")
print("running tests")
results = simpleloop(data, config) 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): def load_config(file):
config_vector = {} config_vector = {}
@ -117,6 +129,12 @@ def simplestats(data, test):
if(test == "regression_sigmoidal"): if(test == "regression_sigmoidal"):
return an.regression('cpu', list(range(len(data))), data, ['sig']) 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 def metricsloop(group_data, observations, database, tests): # listener based metrics update
pass pass