mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-27 01:59:08 +00:00
WORKING
This commit is contained in:
parent
1eb568c807
commit
10f8839bbd
Binary file not shown.
@ -1,3 +1,6 @@
|
||||
35,63,62,18,56,65,42,77,82,63,76,50,47,69,57,65,85,70,38,67,89,74,71,67,70,71,95,77,45
|
||||
46,24,12,23,66,48,43,35,32,42,78,56,70,53,56,43,16,85,46,76,86,77,71,77,76,70,73
|
||||
29,63,35,37,26,51,35,58,30,61,45
|
||||
26,62,45,37,42,29,59,44,40
|
||||
35,63,62,18,56,65,42,77,82,63,76,50,47,69,57,65,85,70,38,67,89,74,71,67,70,71,95,77,45
|
||||
46,45,71,85,54,57,52,66,47,77,68,75,45,51
|
||||
26,15,31,54,37,48,19,69,56
|
||||
|
|
@ -1,3 +1,6 @@
|
||||
16
|
||||
2016
|
||||
2022
|
||||
2451
|
||||
16
|
||||
3695
|
||||
5148
|
|
@ -1,97 +0,0 @@
|
||||
import firebase_admin
|
||||
from firebase_admin import credentials
|
||||
from firebase_admin import firestore
|
||||
import csv
|
||||
import numpy as np
|
||||
|
||||
# Use a service account
|
||||
cred = credentials.Certificate('keys/keytemp.json')
|
||||
#add your own key as this is public. email me for details
|
||||
firebase_admin.initialize_app(cred)
|
||||
|
||||
db = firestore.client()
|
||||
|
||||
teams=db.collection('data').document('team-2022').collection("Central 2019").get()
|
||||
full=[]
|
||||
tms=[]
|
||||
for team in teams:
|
||||
|
||||
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=[]
|
||||
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 = ["2022", "16", "2451"]
|
||||
|
||||
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 j in range(len(i)):
|
||||
big_out.append([])
|
||||
for t in range(len(list_teams)):
|
||||
big_out[j].append([])
|
||||
|
||||
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)):
|
||||
|
||||
big_out[j][team_index].append(i[j])
|
||||
|
||||
for i in range(len(big_out)):
|
||||
|
||||
with open('data/' + j_list[i] + '.csv', "w+", newline = '') as file:
|
||||
|
||||
writer = csv.writer(file, delimiter = ',')
|
||||
writer.writerows(big_out[i])
|
||||
|
Loading…
Reference in New Issue
Block a user