mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-27 01:59:08 +00:00
wtf
This commit is contained in:
parent
a1d0cd37b7
commit
82754ede58
@ -202,6 +202,7 @@ def titanservice():
|
|||||||
#db.collection(u'stats').document(u'stats-noNN').set(score_out)
|
#db.collection(u'stats').document(u'stats-noNN').set(score_out)
|
||||||
|
|
||||||
def pulldata():
|
def pulldata():
|
||||||
|
|
||||||
teams = analysis.load_csv('data/teams.csv')
|
teams = analysis.load_csv('data/teams.csv')
|
||||||
scores = []
|
scores = []
|
||||||
for i in range(len(teams)):
|
for i in range(len(teams)):
|
||||||
@ -218,7 +219,87 @@ def pulldata():
|
|||||||
|
|
||||||
with open("data/scores.csv", "w+", newline = '') as file:
|
with open("data/scores.csv", "w+", newline = '') as file:
|
||||||
writer = csv.writer(file, delimiter = ',')
|
writer = csv.writer(file, delimiter = ',')
|
||||||
writer.writerows(scores)
|
writer.writerows(scores)
|
||||||
|
|
||||||
|
teams = db.collection('data').document('team-2022').collection("Central 2019").get()
|
||||||
|
full=[]
|
||||||
|
tms=[]
|
||||||
|
for team in teams:
|
||||||
|
data=[]
|
||||||
|
tms.append(team.id)
|
||||||
|
reports=db.collection('data').document('team-2022').collection("Central 2019").document(team.id).collection("matches").get()
|
||||||
|
for report in reports:
|
||||||
|
data.append(db.collection('data').document('team-2022').collection("Central 2019").document(team.id).collection("matches").document(report.id).get().to_dict())
|
||||||
|
full.append(data)
|
||||||
|
|
||||||
|
quant_keys = []
|
||||||
|
|
||||||
|
list_teams = analysis.load_csv('data/teams.csv')
|
||||||
|
|
||||||
|
out = []
|
||||||
|
var = {}
|
||||||
|
|
||||||
|
for i in range(len(full)):
|
||||||
|
for j in range(len(full[i])):
|
||||||
|
for key in list(full[i][j].keys()):
|
||||||
|
|
||||||
|
if "Quantitative" in key:
|
||||||
|
|
||||||
|
quant_keys.append(key)
|
||||||
|
|
||||||
|
if full[i][j].get(key).get('teamDBRef')[5:] in list_teams:
|
||||||
|
|
||||||
|
var = {}
|
||||||
|
measured_vars = []
|
||||||
|
|
||||||
|
for k in range(len(list(full[i][j].get(key).keys()))):
|
||||||
|
|
||||||
|
individual_keys = list(full[i][j].get(key).keys())
|
||||||
|
|
||||||
|
var[individual_keys[k]] = full[i][j].get(key).get(individual_keys[k])
|
||||||
|
|
||||||
|
out.append(var)
|
||||||
|
|
||||||
|
sorted_out = []
|
||||||
|
|
||||||
|
for i in out:
|
||||||
|
|
||||||
|
j_list = []
|
||||||
|
|
||||||
|
key_list = []
|
||||||
|
|
||||||
|
sorted_keys = sorted(i.keys())
|
||||||
|
|
||||||
|
for j in sorted_keys:
|
||||||
|
|
||||||
|
key_list.append(i[j])
|
||||||
|
|
||||||
|
j_list.append(j)
|
||||||
|
|
||||||
|
sorted_out.append(key_list)
|
||||||
|
|
||||||
|
var_index = 0
|
||||||
|
team_index = 0
|
||||||
|
|
||||||
|
big_out = []
|
||||||
|
|
||||||
|
for i in sorted_out:
|
||||||
|
|
||||||
|
team_index = list_teams.index(sorted_out[sorted_out.index(i)][j_list.index('teamDBRef')][5:])
|
||||||
|
|
||||||
|
for j in range(len(i)):
|
||||||
|
|
||||||
|
print(j)
|
||||||
|
print(team_index)
|
||||||
|
print(i[j])
|
||||||
|
|
||||||
|
print(i)
|
||||||
|
|
||||||
|
print(big_out)
|
||||||
|
|
||||||
|
big_out[j][team_index].append(i[j])
|
||||||
|
|
||||||
|
print(big_out)
|
||||||
|
|
||||||
def service():
|
def service():
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ for team in teams:
|
|||||||
data.append(db.collection('data').document('team-2022').collection("Central 2019").document(team.id).collection("matches").document(report.id).get().to_dict())
|
data.append(db.collection('data').document('team-2022').collection("Central 2019").document(team.id).collection("matches").document(report.id).get().to_dict())
|
||||||
full.append(data)
|
full.append(data)
|
||||||
|
|
||||||
|
print(len(full))
|
||||||
|
|
||||||
#print(full)
|
#print(full)
|
||||||
|
|
||||||
quant_keys = []
|
quant_keys = []
|
||||||
@ -29,9 +31,7 @@ quant_keys = []
|
|||||||
list_teams = ["2022", "16", "2451"]
|
list_teams = ["2022", "16", "2451"]
|
||||||
|
|
||||||
out = []
|
out = []
|
||||||
#temp = []
|
|
||||||
var = {}
|
var = {}
|
||||||
#measured_vars_total = []
|
|
||||||
|
|
||||||
for i in range(len(full)):
|
for i in range(len(full)):
|
||||||
for j in range(len(full[i])):
|
for j in range(len(full[i])):
|
||||||
@ -49,19 +49,14 @@ for i in range(len(full)):
|
|||||||
for k in range(len(list(full[i][j].get(key).keys()))):
|
for k in range(len(list(full[i][j].get(key).keys()))):
|
||||||
|
|
||||||
individual_keys = list(full[i][j].get(key).keys())
|
individual_keys = list(full[i][j].get(key).keys())
|
||||||
#print(individual_keys)
|
|
||||||
#measured_vars.append(individual_keys[k])
|
|
||||||
var[individual_keys[k]] = full[i][j].get(key).get(individual_keys[k])
|
var[individual_keys[k]] = full[i][j].get(key).get(individual_keys[k])
|
||||||
#var.append(full[i][j].get(key).get(individual_keys[k]))
|
|
||||||
|
|
||||||
#measured_vars_total.append(measured_vars)
|
|
||||||
|
|
||||||
#temp.append(var)
|
|
||||||
|
|
||||||
out.append(var)
|
out.append(var)
|
||||||
|
|
||||||
|
print(len(out))
|
||||||
|
|
||||||
sorted_out = []
|
sorted_out = []
|
||||||
#j_list = []
|
|
||||||
|
|
||||||
for i in out:
|
for i in out:
|
||||||
|
|
||||||
@ -78,50 +73,24 @@ for i in out:
|
|||||||
j_list.append(j)
|
j_list.append(j)
|
||||||
|
|
||||||
sorted_out.append(key_list)
|
sorted_out.append(key_list)
|
||||||
|
|
||||||
#print(quant_keys)
|
|
||||||
#print(measured_vars_total)
|
|
||||||
print(sorted_out)
|
|
||||||
print(j_list)
|
|
||||||
|
|
||||||
var_index = 0
|
var_index = 0
|
||||||
team_index = 0
|
team_index = 0
|
||||||
|
|
||||||
big_out = []
|
big_out = []
|
||||||
|
|
||||||
|
for j in range(len(i)):
|
||||||
|
big_out.append([])
|
||||||
|
for t in range(len(list_teams)):
|
||||||
|
big_out[j].append([])
|
||||||
|
|
||||||
for i in sorted_out:
|
for i in sorted_out:
|
||||||
|
|
||||||
team_index = list_teams.index(sorted_out[sorted_out.index(i)][j_list.index('teamDBRef')][5:])
|
team_index = list_teams.index(sorted_out[sorted_out.index(i)][j_list.index('teamDBRef')][5:])
|
||||||
|
|
||||||
#print(team_index)
|
|
||||||
|
|
||||||
for j in range(len(i)):
|
for j in range(len(i)):
|
||||||
|
|
||||||
print(j)
|
|
||||||
print(team_index)
|
|
||||||
print(i[j])
|
|
||||||
|
|
||||||
print(i)
|
|
||||||
|
|
||||||
print(big_out)
|
|
||||||
|
|
||||||
big_out[j][team_index].append(i[j])
|
big_out[j][team_index].append(i[j])
|
||||||
|
|
||||||
print(big_out)
|
print(big_out)
|
||||||
|
|
||||||
#for i in range(len(measured_vars)):
|
|
||||||
#for j in range(len)
|
|
||||||
|
|
||||||
|
|
||||||
#for k in range(len(list(full[i][j].get(key).keys()))):
|
|
||||||
# ind_keys = list(full[i][j].get(key).keys())
|
|
||||||
# print(ind_keys)
|
|
||||||
# print(k)
|
|
||||||
# print(ind_keys[k])
|
|
||||||
# print(full[i][j].get(key).get('teamDBRef')[5:])
|
|
||||||
# print(list_teams.index(full[i][j].get(key).get('teamDBRef')[5:]))
|
|
||||||
# print(full[i][j].get(key))
|
|
||||||
# var[list_teams.index(full[i][j].get(key).get('teamDBRef')[5:])].append( full[i][j].get(key).get(ind_keys[k]) )
|
|
||||||
#print(var)
|
|
||||||
|
|
||||||
#print(quant_keys)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user