Skip to content

Commit ff7c754

Browse files
committed
FRC5800 scouting
scouting 2018nyny teams with tbapy
1 parent c96f5e5 commit ff7c754

File tree

6 files changed

+312
-0
lines changed

6 files changed

+312
-0
lines changed

Examples/csv_writer.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import csv
2+
3+
with open('persons.csv', 'wb') as csvfile:
4+
filewriter = csv.writer(csvfile, delimiter=',',quotechar='|', quoting=csv.QUOTE_MINIMAL)
5+
filewriter.writerow(['Name', 'Profession'])
6+
filewriter.writerow(['Derek', 'Software Developer'])
7+
filewriter.writerow(['Steve', 'Software Developer'])
8+
filewriter.writerow(['Paul', 'Manager'])

Examples/xlsxwriter_example.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import xlsxwriter
2+
3+
# Create a workbook and add a worksheet.
4+
workbook = xlsxwriter.Workbook('Expenses01.xlsx')
5+
worksheet = workbook.add_worksheet()
6+
7+
# Some data we want to write to the worksheet.
8+
expenses = (
9+
['Rent', 1000],
10+
['Gas', 100],
11+
['Food', 300],
12+
['Gym', 50],
13+
)
14+
15+
# Start from the first cell. Rows and columns are zero indexed.
16+
row = 0
17+
col = 0
18+
19+
# Iterate over the data and write it out row by row.
20+
for item, cost in (expenses):
21+
worksheet.write(row, col, item)
22+
worksheet.write(row, col + 1, cost)
23+
row += 1
24+
25+
# Write a total using a formula.
26+
worksheet.write(row, 0, 'Total')
27+
worksheet.write(row, 1, '=SUM(B1:B4)')
28+
29+
workbook.close()

Scouting/2018nyny.xlsx

10.3 KB
Binary file not shown.

Scouting/NY-regional.py

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import tbapy
2+
import json
3+
import xlsxwriter
4+
5+
#events = list()
6+
#events_json = str()
7+
teams = list()
8+
9+
tba = tbapy.TBA('hjzCpHdD7EYfs0SBAdidF6yq0jpdJf3tqQplhQhgVPkSCMFQC2hDp57YVko9V8BG')
10+
data = tba.event_teams("2018nyny")
11+
12+
"""for event in data:
13+
events.append(event.json)
14+
15+
events_json = ''.join(str(events))
16+
events_json = events_json.replace("'","\"")"""
17+
18+
with open('data.json', 'w') as outfile:
19+
json.dump(data, outfile)
20+
21+
fh = open('data.json').read()
22+
info = json.loads(fh)
23+
24+
count, row, col, award_count = 0,1,0,0
25+
26+
workbook = xlsxwriter.Workbook('2018nyny.xlsx')
27+
worksheet = workbook.add_worksheet()
28+
worksheet.write(0,col,"Team")
29+
worksheet.write(0,col+1,"FRC")
30+
worksheet.write(0,col+1,"Awards")
31+
url_format = workbook.add_format({
32+
'font_color': 'blue',
33+
'underline': 1
34+
})
35+
36+
for item in info:
37+
print("Team:",item['key'])
38+
try:
39+
worksheet.write_url(row, col, item['website'],url_format, item['nickname'])
40+
except:
41+
worksheet.write(row,col,item['nickname'])
42+
worksheet.write(row, col + 1, int(item['key'].replace("frc","")))
43+
team_awards = tba.team_awards(item['key'])
44+
for award in team_awards:
45+
if (award['award_type'] == 1 or award['award_type'] == 2):
46+
award_count += 1
47+
worksheet.write(row, col + 2, award_count)
48+
count += 1
49+
row += 1
50+
award_count = 0
51+
52+
print("Teams Registered:",count)
53+
54+
workbook.close()

Scouting/data.json

+1
Large diffs are not rendered by default.

Scouting/frc5800_events.json

+220
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
[
2+
{
3+
"gmaps_place_id": "ChIJ5yKvQGbEyIARRrDnL_5KOqk",
4+
"name": "Las Vegas Regional",
5+
"gmaps_url": "https://maps.google.com/?cid=12194141396644900934",
6+
"first_event_id": "17359",
7+
"json": {
8+
"gmaps_place_id": "ChIJ5yKvQGbEyIARRrDnL_5KOqk",
9+
"name": "Las Vegas Regional",
10+
"gmaps_url": "https://maps.google.com/?cid=12194141396644900934",
11+
"first_event_id": "17359",
12+
"country": "USA",
13+
"webcasts": [
14+
{
15+
"type": "youtube",
16+
"channel": "GCRmRWbGuyQ"
17+
}
18+
],
19+
"parent_event_key": null,
20+
"timezone": "America/Los_Angeles",
21+
"week": 5,
22+
"year": 2016,
23+
"state_prov": "NV",
24+
"event_code": "nvlv",
25+
"lng": -115.151705,
26+
"district": null,
27+
"key": "2016nvlv",
28+
"website": "http://www.firstnevada.org",
29+
"city": "Las Vegas",
30+
"event_type": 0,
31+
"event_type_string": "Regional",
32+
"address": "3150 Paradise Rd, Las Vegas, NV 89109, USA",
33+
"start_date": "2016-03-30",
34+
"lat": 36.131998,
35+
"playoff_type": null,
36+
"division_keys": [],
37+
"short_name": "Las Vegas",
38+
"end_date": "2016-04-02",
39+
"postal_code": "89109",
40+
"playoff_type_string": null,
41+
"location_name": "Las Vegas Convention Center"
42+
},
43+
"country": "USA",
44+
"webcasts": [
45+
{
46+
"type": "youtube",
47+
"channel": "GCRmRWbGuyQ"
48+
}
49+
],
50+
"parent_event_key": null,
51+
"start_date": "2016-03-30",
52+
"year": 2016,
53+
"state_prov": "NV",
54+
"event_code": "nvlv",
55+
"lng": -115.151705,
56+
"district": null,
57+
"key": "2016nvlv",
58+
"website": "http://www.firstnevada.org",
59+
"city": "Las Vegas",
60+
"event_type": 0,
61+
"playoff_type_string": null,
62+
"address": "3150 Paradise Rd, Las Vegas, NV 89109, USA",
63+
"timezone": "America/Los_Angeles",
64+
"lat": 36.131998,
65+
"playoff_type": null,
66+
"division_keys": [],
67+
"short_name": "Las Vegas",
68+
"end_date": "2016-04-02",
69+
"week": 5,
70+
"event_type_string": "Regional",
71+
"location_name": "Las Vegas Convention Center",
72+
"postal_code": "89109"
73+
},
74+
{
75+
"gmaps_place_id": "ChIJ3_gwt1po54gRoA1jiTOccCw",
76+
"name": "Orlando Regional",
77+
"gmaps_url": "https://maps.google.com/?cid=3202231080222657952",
78+
"first_event_id": "22483",
79+
"json": {
80+
"gmaps_place_id": "ChIJ3_gwt1po54gRoA1jiTOccCw",
81+
"name": "Orlando Regional",
82+
"gmaps_url": "https://maps.google.com/?cid=3202231080222657952",
83+
"first_event_id": "22483",
84+
"country": "USA",
85+
"webcasts": [
86+
{
87+
"type": "youtube",
88+
"date": "2017-03-10",
89+
"channel": "ViJ8YZN1-bE"
90+
},
91+
{
92+
"type": "youtube",
93+
"date": "2017-03-11",
94+
"channel": "E97bTsHXnb4"
95+
}
96+
],
97+
"parent_event_key": null,
98+
"timezone": "America/New_York",
99+
"week": 1,
100+
"year": 2017,
101+
"state_prov": "FL",
102+
"event_code": "flor",
103+
"lng": -81.19736689999999,
104+
"district": null,
105+
"key": "2017flor",
106+
"website": "http://orlandofrc.org",
107+
"city": "Orlando",
108+
"event_type": 0,
109+
"event_type_string": "Regional",
110+
"address": "12777 Gemini Blvd N, Orlando, FL 32816, USA",
111+
"start_date": "2017-03-08",
112+
"lat": 28.607225,
113+
"playoff_type": null,
114+
"division_keys": [],
115+
"short_name": "Orlando",
116+
"end_date": "2017-03-11",
117+
"postal_code": "32816",
118+
"playoff_type_string": null,
119+
"location_name": "CFE Arena"
120+
},
121+
"country": "USA",
122+
"webcasts": [
123+
{
124+
"type": "youtube",
125+
"date": "2017-03-10",
126+
"channel": "ViJ8YZN1-bE"
127+
},
128+
{
129+
"type": "youtube",
130+
"date": "2017-03-11",
131+
"channel": "E97bTsHXnb4"
132+
}
133+
],
134+
"parent_event_key": null,
135+
"start_date": "2017-03-08",
136+
"year": 2017,
137+
"state_prov": "FL",
138+
"event_code": "flor",
139+
"lng": -81.19736689999999,
140+
"district": null,
141+
"key": "2017flor",
142+
"website": "http://orlandofrc.org",
143+
"city": "Orlando",
144+
"event_type": 0,
145+
"playoff_type_string": null,
146+
"address": "12777 Gemini Blvd N, Orlando, FL 32816, USA",
147+
"timezone": "America/New_York",
148+
"lat": 28.607225,
149+
"playoff_type": null,
150+
"division_keys": [],
151+
"short_name": "Orlando",
152+
"end_date": "2017-03-11",
153+
"week": 1,
154+
"event_type_string": "Regional",
155+
"location_name": "CFE Arena",
156+
"postal_code": "32816"
157+
},
158+
{
159+
"gmaps_place_id": "ChIJi3eY95v2wokR4cL4GcqwiWM",
160+
"name": "New York City Regional",
161+
"gmaps_url": "https://maps.google.com/?cid=7172458263629841121",
162+
"first_event_id": "27887",
163+
"json": {
164+
"gmaps_place_id": "ChIJi3eY95v2wokR4cL4GcqwiWM",
165+
"name": "New York City Regional",
166+
"gmaps_url": "https://maps.google.com/?cid=7172458263629841121",
167+
"first_event_id": "27887",
168+
"country": "USA",
169+
"webcasts": [],
170+
"parent_event_key": null,
171+
"timezone": "America/New_York",
172+
"week": 5,
173+
"year": 2018,
174+
"state_prov": "NY",
175+
"event_code": "nyny",
176+
"lng": -73.941251,
177+
"district": null,
178+
"key": "2018nyny",
179+
"website": "http://www.nycfirst.org",
180+
"city": "New York",
181+
"event_type": 0,
182+
"event_type_string": "Regional",
183+
"address": "The Armory, 216 Fort Washington Ave, New York, NY 10032, USA",
184+
"start_date": "2018-04-05",
185+
"lat": 40.8421049,
186+
"playoff_type": null,
187+
"division_keys": [],
188+
"short_name": "New York City",
189+
"end_date": "2018-04-08",
190+
"postal_code": "10032",
191+
"playoff_type_string": null,
192+
"location_name": "Armory Track"
193+
},
194+
"country": "USA",
195+
"webcasts": [],
196+
"parent_event_key": null,
197+
"start_date": "2018-04-05",
198+
"year": 2018,
199+
"state_prov": "NY",
200+
"event_code": "nyny",
201+
"lng": -73.941251,
202+
"district": null,
203+
"key": "2018nyny",
204+
"website": "http://www.nycfirst.org",
205+
"city": "New York",
206+
"event_type": 0,
207+
"playoff_type_string": null,
208+
"address": "The Armory, 216 Fort Washington Ave, New York, NY 10032, USA",
209+
"timezone": "America/New_York",
210+
"lat": 40.8421049,
211+
"playoff_type": null,
212+
"division_keys": [],
213+
"short_name": "New York City",
214+
"end_date": "2018-04-08",
215+
"week": 5,
216+
"event_type_string": "Regional",
217+
"location_name": "Armory Track",
218+
"postal_code": "10032"
219+
}
220+
]

0 commit comments

Comments
 (0)