Spaces:
Running
Running
James McCool
commited on
Commit
·
4b7b477
1
Parent(s):
ea5480e
Refactor output methods in app.py to use Streamlit's st.write for better integration with the UI, replacing print statements and enhancing user feedback during data processing.
Browse files
app.py
CHANGED
|
@@ -129,7 +129,7 @@ def grab_sr_ids(headers: dict) -> pd.DataFrame:
|
|
| 129 |
|
| 130 |
team_name = data['alias']
|
| 131 |
|
| 132 |
-
|
| 133 |
try:
|
| 134 |
for player in data['players']:
|
| 135 |
player_fa_ids.append(999999)
|
|
@@ -145,7 +145,7 @@ def grab_sr_ids(headers: dict) -> pd.DataFrame:
|
|
| 145 |
999999, player['id'], player['first_name'], '-', player['last_name'], '-', player['position'], team_name
|
| 146 |
])
|
| 147 |
except:
|
| 148 |
-
|
| 149 |
continue
|
| 150 |
|
| 151 |
return pd.DataFrame(row_data, columns=['FA_ID', 'SR_ID', 'First_Name', 'Prefer_First_Name', 'Last_Name', 'Name_Suffix', 'Position', 'Team'])
|
|
@@ -222,19 +222,18 @@ with tab2:
|
|
| 222 |
|
| 223 |
with tab3:
|
| 224 |
with st.container():
|
| 225 |
-
col1, col2
|
| 226 |
|
| 227 |
with col1:
|
| 228 |
st.info("Update SR IDs")
|
| 229 |
if st.button("Update SR IDs", key='sr_ids'):
|
| 230 |
fa_df = grab_sr_fa(sr_headers)
|
|
|
|
| 231 |
player_df = grab_sr_ids(sr_headers)
|
| 232 |
-
|
| 233 |
-
st.table(fa_df.head(10))
|
| 234 |
-
|
| 235 |
-
st.table(player_df.head(10))
|
| 236 |
|
| 237 |
concat_df = pd.concat([fa_df, player_df])
|
|
|
|
| 238 |
|
| 239 |
sh = gc.open_by_url('https://docs.google.com/spreadsheets/d/1GorpLF-VuArINnxHtMjgD5shTX4CoaSwvwyX953TsmY/edit?gid=0#gid=0')
|
| 240 |
worksheet = sh.worksheet('NFL_SR_IDs')
|
|
|
|
| 129 |
|
| 130 |
team_name = data['alias']
|
| 131 |
|
| 132 |
+
st.write(team_name + ' - ' + team_id)
|
| 133 |
try:
|
| 134 |
for player in data['players']:
|
| 135 |
player_fa_ids.append(999999)
|
|
|
|
| 145 |
999999, player['id'], player['first_name'], '-', player['last_name'], '-', player['position'], team_name
|
| 146 |
])
|
| 147 |
except:
|
| 148 |
+
st.write(f"Error processing team: {team_name} - {team_id}")
|
| 149 |
continue
|
| 150 |
|
| 151 |
return pd.DataFrame(row_data, columns=['FA_ID', 'SR_ID', 'First_Name', 'Prefer_First_Name', 'Last_Name', 'Name_Suffix', 'Position', 'Team'])
|
|
|
|
| 222 |
|
| 223 |
with tab3:
|
| 224 |
with st.container():
|
| 225 |
+
col1, col2 = st.columns([3, 3])
|
| 226 |
|
| 227 |
with col1:
|
| 228 |
st.info("Update SR IDs")
|
| 229 |
if st.button("Update SR IDs", key='sr_ids'):
|
| 230 |
fa_df = grab_sr_fa(sr_headers)
|
| 231 |
+
st.write("FA SR IDs collected")
|
| 232 |
player_df = grab_sr_ids(sr_headers)
|
| 233 |
+
st.write("Player SR IDs collected")
|
|
|
|
|
|
|
|
|
|
| 234 |
|
| 235 |
concat_df = pd.concat([fa_df, player_df])
|
| 236 |
+
st.write('ID sets merged, sending to workbooks')
|
| 237 |
|
| 238 |
sh = gc.open_by_url('https://docs.google.com/spreadsheets/d/1GorpLF-VuArINnxHtMjgD5shTX4CoaSwvwyX953TsmY/edit?gid=0#gid=0')
|
| 239 |
worksheet = sh.worksheet('NFL_SR_IDs')
|