fixed bugs in data.py to work with database,

fixed object field in module.py: Metric,
fixed timestamp input in superscripy.py
This commit is contained in:
Arthur Lu 2022-02-04 03:06:09 +00:00
parent aed03369c9
commit 1e18cddc47
3 changed files with 9 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import pandas as pd
def pull_new_tba_matches(apikey, competition, cutoff):
api_key= apikey
x=requests.get("https://www.thebluealliance.com/api/v3/event/"+competition+"/matches/simple", headers={"X-TBA-Auth_Key":api_key}, verify=False)
x=requests.get("https://www.thebluealliance.com/api/v3/event/"+competition+"/matches/simple", headers={"X-TBA-Auth-Key":api_key}, verify=False)
out = []
for i in x.json():
if i["actual_time"] != None and i["actual_time"]-cutoff >= 0 and i["comp_level"] == "qm":
@ -52,8 +52,9 @@ def get_metrics_data_formatted(client, competition):
def get_pit_data_formatted(client, competition):
db = client.data_scouting
mdata = db.teamlist
x=mdata.find_one({"competition":competition})
mdata = db.teamlist.competition
x=mdata.find_one({"competition":competition}) # x should be a list of teams given the soecified competition
print(x)
out = {}
for i in x:
try:
@ -155,7 +156,7 @@ def load_metric(client, competition, match, group_name, metrics):
elo = {"score": metrics["elo"]["score"]}
gl2 = {"score": metrics["gl2"]["score"], "rd": metrics["gl2"]["rd"], "vol": metrics["gl2"]["vol"]}
ts = {"mu": metrics["ts"]["mu"], "sigm+a": metrics["ts"]["sigma"]}
ts = {"mu": metrics["ts"]["mu"], "sigma": metrics["ts"]["sigma"]}
group[team] = {"elo": elo, "gl2": gl2, "ts": ts}

View File

@ -263,7 +263,7 @@ class Metric (Module):
temp_vector.update(red)
temp_vector.update(blu)
d.push_metric(self.client, self.competition, temp_vector)
d.push_metric(self.apikey, self.competition, temp_vector)
def _push_results(self):
pass

View File

@ -210,7 +210,8 @@ def main(send, verbose = False, profile = False, debug = False):
client = pymongo.MongoClient(apikey)
send(stdout, INF, "established connection to database")
send(stdout, INF, "analysis backtimed to: " + str(get_previous_time(client)))
previous_time = get_previous_time(client)
send(stdout, INF, "analysis backtimed to: " + str(previous_time))
config = resolve_config_conflicts(send, client, config, preference, sync)
@ -222,7 +223,7 @@ def main(send, verbose = False, profile = False, debug = False):
for m in config_modules:
if m in modules:
start = time.time()
current_module = modules[m](config_modules[m], client, tbakey, loop_start, competition)
current_module = modules[m](config_modules[m], client, tbakey, previous_time, competition)
valid = current_module.validate_config()
if not valid:
continue