James McCool
commited on
Commit
·
c811591
1
Parent(s):
ec03891
reverting player and team locks
Browse files- src/streamlit_app.py +21 -177
src/streamlit_app.py
CHANGED
|
@@ -62,55 +62,14 @@ st.markdown("""
|
|
| 62 |
</style>""", unsafe_allow_html=True)
|
| 63 |
|
| 64 |
@st.cache_data(ttl = 600)
|
| 65 |
-
def init_DK_seed_frames(sharp_split
|
| 66 |
|
| 67 |
collection = db['DK_NFL_name_map']
|
| 68 |
cursor = collection.find()
|
| 69 |
raw_data = pd.DataFrame(list(cursor))
|
| 70 |
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 71 |
-
|
| 72 |
collection = db["DK_NFL_seed_frame"]
|
| 73 |
-
|
| 74 |
-
# Build the query
|
| 75 |
-
query = {}
|
| 76 |
-
if player_lock_var1 != [] or team_lock_var1 != []:
|
| 77 |
-
# Build query to check if locked players exist in any position column
|
| 78 |
-
query_conditions = []
|
| 79 |
-
|
| 80 |
-
if player_lock_var1:
|
| 81 |
-
position_columns = ['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST']
|
| 82 |
-
player_conditions = []
|
| 83 |
-
for column in position_columns:
|
| 84 |
-
player_conditions.append({column: {'$in': player_lock_var1}})
|
| 85 |
-
query_conditions.append({'$or': player_conditions})
|
| 86 |
-
|
| 87 |
-
if team_lock_var1:
|
| 88 |
-
query_conditions.append({'Team': {'$in': team_lock_var1}})
|
| 89 |
-
|
| 90 |
-
if len(query_conditions) == 1:
|
| 91 |
-
query = query_conditions[0]
|
| 92 |
-
else:
|
| 93 |
-
query = {'$and': query_conditions}
|
| 94 |
-
|
| 95 |
-
elif player_remove_var1 != [] or team_remove_var1 != []:
|
| 96 |
-
# Build query to exclude lineups containing removed players
|
| 97 |
-
query_conditions = []
|
| 98 |
-
|
| 99 |
-
if player_remove_var1:
|
| 100 |
-
position_columns = ['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST']
|
| 101 |
-
for column in position_columns:
|
| 102 |
-
query_conditions.append({column: {'$nin': player_remove_var1}})
|
| 103 |
-
|
| 104 |
-
if team_remove_var1:
|
| 105 |
-
query_conditions.append({'Team': {'$nin': team_remove_var1}})
|
| 106 |
-
|
| 107 |
-
if len(query_conditions) == 1:
|
| 108 |
-
query = query_conditions[0]
|
| 109 |
-
else:
|
| 110 |
-
query = {'$and': query_conditions}
|
| 111 |
-
|
| 112 |
-
# Execute the query once
|
| 113 |
-
cursor = collection.find(query).limit(sharp_split)
|
| 114 |
|
| 115 |
raw_display = pd.DataFrame(list(cursor))
|
| 116 |
raw_display = raw_display[['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
|
|
@@ -122,52 +81,13 @@ def init_DK_seed_frames(sharp_split, player_lock_var1, team_lock_var1, player_re
|
|
| 122 |
return DK_seed
|
| 123 |
|
| 124 |
@st.cache_data(ttl = 600)
|
| 125 |
-
def init_DK_Secondary_seed_frames(sharp_split
|
| 126 |
|
| 127 |
collection = db['DK_NFL_Secondary_name_map']
|
| 128 |
cursor = collection.find()
|
| 129 |
raw_data = pd.DataFrame(list(cursor))
|
| 130 |
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 131 |
-
|
| 132 |
collection = db["DK_NFL_Secondary_seed_frame"]
|
| 133 |
-
if player_lock_var1 != [] or team_lock_var1 != []:
|
| 134 |
-
# Build query to check if locked players exist in any position column
|
| 135 |
-
player_conditions = []
|
| 136 |
-
if player_lock_var1:
|
| 137 |
-
position_columns = ['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST']
|
| 138 |
-
for column in position_columns:
|
| 139 |
-
player_conditions.append({column: {'$in': player_lock_var1}})
|
| 140 |
-
|
| 141 |
-
query_conditions = []
|
| 142 |
-
if player_conditions:
|
| 143 |
-
query_conditions.append({'$or': player_conditions})
|
| 144 |
-
if team_lock_var1:
|
| 145 |
-
query_conditions.append({'Team': {'$in': team_lock_var1}})
|
| 146 |
-
|
| 147 |
-
if len(query_conditions) == 1:
|
| 148 |
-
collection = collection.find(query_conditions[0])
|
| 149 |
-
else:
|
| 150 |
-
collection = collection.find({'$and': query_conditions})
|
| 151 |
-
elif player_remove_var1 != [] or team_remove_var1 != []:
|
| 152 |
-
# Build query to exclude lineups containing removed players
|
| 153 |
-
exclusion_conditions = []
|
| 154 |
-
if player_remove_var1:
|
| 155 |
-
position_columns = ['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST']
|
| 156 |
-
for column in position_columns:
|
| 157 |
-
exclusion_conditions.append({column: {'$nin': player_remove_var1}})
|
| 158 |
-
|
| 159 |
-
query_conditions = []
|
| 160 |
-
if exclusion_conditions:
|
| 161 |
-
query_conditions.extend(exclusion_conditions)
|
| 162 |
-
if team_remove_var1:
|
| 163 |
-
query_conditions.append({'Team': {'$nin': team_remove_var1}})
|
| 164 |
-
|
| 165 |
-
if len(query_conditions) == 1:
|
| 166 |
-
collection = collection.find(query_conditions[0])
|
| 167 |
-
else:
|
| 168 |
-
collection = collection.find({'$and': query_conditions})
|
| 169 |
-
else:
|
| 170 |
-
collection = collection.find()
|
| 171 |
cursor = collection.find().limit(sharp_split)
|
| 172 |
|
| 173 |
raw_display = pd.DataFrame(list(cursor))
|
|
@@ -180,7 +100,7 @@ def init_DK_Secondary_seed_frames(sharp_split, player_lock_var1, team_lock_var1,
|
|
| 180 |
return DK_seed
|
| 181 |
|
| 182 |
@st.cache_data(ttl = 599)
|
| 183 |
-
def init_FD_seed_frames(sharp_split
|
| 184 |
|
| 185 |
collection = db['FD_NFL_name_map']
|
| 186 |
cursor = collection.find()
|
|
@@ -188,44 +108,6 @@ def init_FD_seed_frames(sharp_split, player_lock_var1, team_lock_var1, player_re
|
|
| 188 |
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 189 |
|
| 190 |
collection = db["FD_NFL_seed_frame"]
|
| 191 |
-
if player_lock_var1 != [] or team_lock_var1 != []:
|
| 192 |
-
# Build query to check if locked players exist in any position column
|
| 193 |
-
player_conditions = []
|
| 194 |
-
if player_lock_var1:
|
| 195 |
-
position_columns = ['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST']
|
| 196 |
-
for column in position_columns:
|
| 197 |
-
player_conditions.append({column: {'$in': player_lock_var1}})
|
| 198 |
-
|
| 199 |
-
query_conditions = []
|
| 200 |
-
if player_conditions:
|
| 201 |
-
query_conditions.append({'$or': player_conditions})
|
| 202 |
-
if team_lock_var1:
|
| 203 |
-
query_conditions.append({'Team': {'$in': team_lock_var1}})
|
| 204 |
-
|
| 205 |
-
if len(query_conditions) == 1:
|
| 206 |
-
collection = collection.find(query_conditions[0])
|
| 207 |
-
else:
|
| 208 |
-
collection = collection.find({'$and': query_conditions})
|
| 209 |
-
elif player_remove_var1 != [] or team_remove_var1 != []:
|
| 210 |
-
# Build query to exclude lineups containing removed players
|
| 211 |
-
exclusion_conditions = []
|
| 212 |
-
if player_remove_var1:
|
| 213 |
-
position_columns = ['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST']
|
| 214 |
-
for column in position_columns:
|
| 215 |
-
exclusion_conditions.append({column: {'$nin': player_remove_var1}})
|
| 216 |
-
|
| 217 |
-
query_conditions = []
|
| 218 |
-
if exclusion_conditions:
|
| 219 |
-
query_conditions.extend(exclusion_conditions)
|
| 220 |
-
if team_remove_var1:
|
| 221 |
-
query_conditions.append({'Team': {'$nin': team_remove_var1}})
|
| 222 |
-
|
| 223 |
-
if len(query_conditions) == 1:
|
| 224 |
-
collection = collection.find(query_conditions[0])
|
| 225 |
-
else:
|
| 226 |
-
collection = collection.find({'$and': query_conditions})
|
| 227 |
-
else:
|
| 228 |
-
collection = collection.find()
|
| 229 |
cursor = collection.find().limit(sharp_split)
|
| 230 |
|
| 231 |
raw_display = pd.DataFrame(list(cursor))
|
|
@@ -238,7 +120,7 @@ def init_FD_seed_frames(sharp_split, player_lock_var1, team_lock_var1, player_re
|
|
| 238 |
return FD_seed
|
| 239 |
|
| 240 |
@st.cache_data(ttl = 599)
|
| 241 |
-
def init_FD_Secondary_seed_frames(sharp_split
|
| 242 |
|
| 243 |
collection = db['FD_NFL_Secondary_name_map']
|
| 244 |
cursor = collection.find()
|
|
@@ -246,44 +128,6 @@ def init_FD_Secondary_seed_frames(sharp_split, player_lock_var1, team_lock_var1,
|
|
| 246 |
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 247 |
|
| 248 |
collection = db["FD_NFL_Secondary_seed_frame"]
|
| 249 |
-
if player_lock_var1 != [] or team_lock_var1 != []:
|
| 250 |
-
# Build query to check if locked players exist in any position column
|
| 251 |
-
player_conditions = []
|
| 252 |
-
if player_lock_var1:
|
| 253 |
-
position_columns = ['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST']
|
| 254 |
-
for column in position_columns:
|
| 255 |
-
player_conditions.append({column: {'$in': player_lock_var1}})
|
| 256 |
-
|
| 257 |
-
query_conditions = []
|
| 258 |
-
if player_conditions:
|
| 259 |
-
query_conditions.append({'$or': player_conditions})
|
| 260 |
-
if team_lock_var1:
|
| 261 |
-
query_conditions.append({'Team': {'$in': team_lock_var1}})
|
| 262 |
-
|
| 263 |
-
if len(query_conditions) == 1:
|
| 264 |
-
collection = collection.find(query_conditions[0])
|
| 265 |
-
else:
|
| 266 |
-
collection = collection.find({'$and': query_conditions})
|
| 267 |
-
elif player_remove_var1 != [] or team_remove_var1 != []:
|
| 268 |
-
# Build query to exclude lineups containing removed players
|
| 269 |
-
exclusion_conditions = []
|
| 270 |
-
if player_remove_var1:
|
| 271 |
-
position_columns = ['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST']
|
| 272 |
-
for column in position_columns:
|
| 273 |
-
exclusion_conditions.append({column: {'$nin': player_remove_var1}})
|
| 274 |
-
|
| 275 |
-
query_conditions = []
|
| 276 |
-
if exclusion_conditions:
|
| 277 |
-
query_conditions.extend(exclusion_conditions)
|
| 278 |
-
if team_remove_var1:
|
| 279 |
-
query_conditions.append({'Team': {'$nin': team_remove_var1}})
|
| 280 |
-
|
| 281 |
-
if len(query_conditions) == 1:
|
| 282 |
-
collection = collection.find(query_conditions[0])
|
| 283 |
-
else:
|
| 284 |
-
collection = collection.find({'$and': query_conditions})
|
| 285 |
-
else:
|
| 286 |
-
collection = collection.find()
|
| 287 |
cursor = collection.find().limit(sharp_split)
|
| 288 |
|
| 289 |
raw_display = pd.DataFrame(list(cursor))
|
|
@@ -373,8 +217,8 @@ if st.button("Load/Reset Data", key='reset2'):
|
|
| 373 |
st.cache_data.clear()
|
| 374 |
for key in st.session_state.keys():
|
| 375 |
del st.session_state[key]
|
| 376 |
-
DK_seed = init_DK_seed_frames(10000
|
| 377 |
-
FD_seed = init_FD_seed_frames(10000
|
| 378 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 379 |
dk_id_dict = dict(zip(dk_raw.Player, dk_raw.player_ID))
|
| 380 |
fd_id_dict = dict(zip(fd_raw.Player, fd_raw.player_ID))
|
|
@@ -431,11 +275,11 @@ if selected_tab == "Contest Sims":
|
|
| 431 |
if 'working_seed' not in st.session_state:
|
| 432 |
if sim_site_var1 == 'Draftkings':
|
| 433 |
if sim_slate_var1 == 'Main Slate':
|
| 434 |
-
st.session_state.working_seed = init_DK_seed_frames(sharp_split
|
| 435 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 436 |
dk_id_dict = dict(zip(dk_raw.Player, dk_raw.player_ID))
|
| 437 |
elif sim_slate_var1 == 'Secondary Slate':
|
| 438 |
-
st.session_state.working_seed = init_DK_Secondary_seed_frames(sharp_split
|
| 439 |
dk_raw, fd_raw = init_baselines('Secondary Slate')
|
| 440 |
dk_id_dict = dict(zip(dk_raw.Player, dk_raw.player_ID))
|
| 441 |
|
|
@@ -443,11 +287,11 @@ if selected_tab == "Contest Sims":
|
|
| 443 |
column_names = dk_columns
|
| 444 |
elif sim_site_var1 == 'Fanduel':
|
| 445 |
if sim_slate_var1 == 'Main Slate':
|
| 446 |
-
st.session_state.working_seed = init_FD_seed_frames(sharp_split
|
| 447 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 448 |
fd_id_dict = dict(zip(fd_raw.Player, fd_raw.player_ID))
|
| 449 |
elif sim_slate_var1 == 'Secondary Slate':
|
| 450 |
-
st.session_state.working_seed = init_FD_Secondary_seed_frames(sharp_split
|
| 451 |
dk_raw, fd_raw = init_baselines('Secondary Slate')
|
| 452 |
fd_id_dict = dict(zip(fd_raw.Player, fd_raw.player_ID))
|
| 453 |
|
|
@@ -873,8 +717,8 @@ if selected_tab == "Data Export":
|
|
| 873 |
st.cache_data.clear()
|
| 874 |
for key in st.session_state.keys():
|
| 875 |
del st.session_state[key]
|
| 876 |
-
DK_seed = init_DK_seed_frames(10000
|
| 877 |
-
FD_seed = init_FD_seed_frames(10000
|
| 878 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 879 |
dk_id_dict = dict(zip(dk_raw.Player, dk_raw.player_ID))
|
| 880 |
fd_id_dict = dict(zip(fd_raw.Player, fd_raw.player_ID))
|
|
@@ -923,10 +767,10 @@ if selected_tab == "Data Export":
|
|
| 923 |
elif 'working_seed' not in st.session_state:
|
| 924 |
if site_var1 == 'Draftkings':
|
| 925 |
if slate_var1 == 'Main Slate':
|
| 926 |
-
st.session_state.working_seed = init_DK_seed_frames(sharp_split_var
|
| 927 |
dk_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 928 |
elif slate_var1 == 'Secondary Slate':
|
| 929 |
-
st.session_state.working_seed = init_DK_Secondary_seed_frames(sharp_split_var
|
| 930 |
dk_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 931 |
|
| 932 |
raw_baselines = dk_raw
|
|
@@ -934,10 +778,10 @@ if selected_tab == "Data Export":
|
|
| 934 |
|
| 935 |
elif site_var1 == 'Fanduel':
|
| 936 |
if slate_var1 == 'Main Slate':
|
| 937 |
-
st.session_state.working_seed = init_FD_seed_frames(sharp_split_var
|
| 938 |
fd_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 939 |
elif slate_var1 == 'Secondary Slate':
|
| 940 |
-
st.session_state.working_seed = init_FD_Secondary_seed_frames(sharp_split_var
|
| 941 |
fd_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 942 |
|
| 943 |
raw_baselines = fd_raw
|
|
@@ -963,12 +807,12 @@ if selected_tab == "Data Export":
|
|
| 963 |
st.session_state.data_export_display = pd.DataFrame(st.session_state.working_seed[0:1000], columns=column_names)
|
| 964 |
elif 'working_seed' not in st.session_state:
|
| 965 |
if slate_var1 == 'Main Slate':
|
| 966 |
-
st.session_state.working_seed = init_DK_seed_frames(sharp_split_var
|
| 967 |
dk_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 968 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 969 |
|
| 970 |
elif slate_var1 == 'Secondary Slate':
|
| 971 |
-
st.session_state.working_seed = init_DK_Secondary_seed_frames(sharp_split_var
|
| 972 |
dk_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 973 |
dk_raw, fd_raw = init_baselines('Secondary Slate')
|
| 974 |
|
|
@@ -986,11 +830,11 @@ if selected_tab == "Data Export":
|
|
| 986 |
st.session_state.data_export_display = pd.DataFrame(st.session_state.working_seed[0:1000], columns=column_names)
|
| 987 |
elif 'working_seed' not in st.session_state:
|
| 988 |
if slate_var1 == 'Main Slate':
|
| 989 |
-
st.session_state.working_seed = init_FD_seed_frames(sharp_split_var
|
| 990 |
fd_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 991 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 992 |
elif slate_var1 == 'Secondary Slate':
|
| 993 |
-
st.session_state.working_seed = init_FD_Secondary_seed_frames(sharp_split_var
|
| 994 |
fd_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 995 |
dk_raw, fd_raw = init_baselines('Secondary Slate')
|
| 996 |
|
|
|
|
| 62 |
</style>""", unsafe_allow_html=True)
|
| 63 |
|
| 64 |
@st.cache_data(ttl = 600)
|
| 65 |
+
def init_DK_seed_frames(sharp_split):
|
| 66 |
|
| 67 |
collection = db['DK_NFL_name_map']
|
| 68 |
cursor = collection.find()
|
| 69 |
raw_data = pd.DataFrame(list(cursor))
|
| 70 |
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
|
|
|
| 71 |
collection = db["DK_NFL_seed_frame"]
|
| 72 |
+
cursor = collection.find().limit(sharp_split)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
raw_display = pd.DataFrame(list(cursor))
|
| 75 |
raw_display = raw_display[['QB', 'RB1', 'RB2', 'WR1', 'WR2', 'WR3', 'TE', 'FLEX', 'DST', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
|
|
|
|
| 81 |
return DK_seed
|
| 82 |
|
| 83 |
@st.cache_data(ttl = 600)
|
| 84 |
+
def init_DK_Secondary_seed_frames(sharp_split):
|
| 85 |
|
| 86 |
collection = db['DK_NFL_Secondary_name_map']
|
| 87 |
cursor = collection.find()
|
| 88 |
raw_data = pd.DataFrame(list(cursor))
|
| 89 |
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
|
|
|
| 90 |
collection = db["DK_NFL_Secondary_seed_frame"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
cursor = collection.find().limit(sharp_split)
|
| 92 |
|
| 93 |
raw_display = pd.DataFrame(list(cursor))
|
|
|
|
| 100 |
return DK_seed
|
| 101 |
|
| 102 |
@st.cache_data(ttl = 599)
|
| 103 |
+
def init_FD_seed_frames(sharp_split):
|
| 104 |
|
| 105 |
collection = db['FD_NFL_name_map']
|
| 106 |
cursor = collection.find()
|
|
|
|
| 108 |
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 109 |
|
| 110 |
collection = db["FD_NFL_seed_frame"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
cursor = collection.find().limit(sharp_split)
|
| 112 |
|
| 113 |
raw_display = pd.DataFrame(list(cursor))
|
|
|
|
| 120 |
return FD_seed
|
| 121 |
|
| 122 |
@st.cache_data(ttl = 599)
|
| 123 |
+
def init_FD_Secondary_seed_frames(sharp_split):
|
| 124 |
|
| 125 |
collection = db['FD_NFL_Secondary_name_map']
|
| 126 |
cursor = collection.find()
|
|
|
|
| 128 |
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 129 |
|
| 130 |
collection = db["FD_NFL_Secondary_seed_frame"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
cursor = collection.find().limit(sharp_split)
|
| 132 |
|
| 133 |
raw_display = pd.DataFrame(list(cursor))
|
|
|
|
| 217 |
st.cache_data.clear()
|
| 218 |
for key in st.session_state.keys():
|
| 219 |
del st.session_state[key]
|
| 220 |
+
DK_seed = init_DK_seed_frames(10000)
|
| 221 |
+
FD_seed = init_FD_seed_frames(10000)
|
| 222 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 223 |
dk_id_dict = dict(zip(dk_raw.Player, dk_raw.player_ID))
|
| 224 |
fd_id_dict = dict(zip(fd_raw.Player, fd_raw.player_ID))
|
|
|
|
| 275 |
if 'working_seed' not in st.session_state:
|
| 276 |
if sim_site_var1 == 'Draftkings':
|
| 277 |
if sim_slate_var1 == 'Main Slate':
|
| 278 |
+
st.session_state.working_seed = init_DK_seed_frames(sharp_split)
|
| 279 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 280 |
dk_id_dict = dict(zip(dk_raw.Player, dk_raw.player_ID))
|
| 281 |
elif sim_slate_var1 == 'Secondary Slate':
|
| 282 |
+
st.session_state.working_seed = init_DK_Secondary_seed_frames(sharp_split)
|
| 283 |
dk_raw, fd_raw = init_baselines('Secondary Slate')
|
| 284 |
dk_id_dict = dict(zip(dk_raw.Player, dk_raw.player_ID))
|
| 285 |
|
|
|
|
| 287 |
column_names = dk_columns
|
| 288 |
elif sim_site_var1 == 'Fanduel':
|
| 289 |
if sim_slate_var1 == 'Main Slate':
|
| 290 |
+
st.session_state.working_seed = init_FD_seed_frames(sharp_split)
|
| 291 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 292 |
fd_id_dict = dict(zip(fd_raw.Player, fd_raw.player_ID))
|
| 293 |
elif sim_slate_var1 == 'Secondary Slate':
|
| 294 |
+
st.session_state.working_seed = init_FD_Secondary_seed_frames(sharp_split)
|
| 295 |
dk_raw, fd_raw = init_baselines('Secondary Slate')
|
| 296 |
fd_id_dict = dict(zip(fd_raw.Player, fd_raw.player_ID))
|
| 297 |
|
|
|
|
| 717 |
st.cache_data.clear()
|
| 718 |
for key in st.session_state.keys():
|
| 719 |
del st.session_state[key]
|
| 720 |
+
DK_seed = init_DK_seed_frames(10000)
|
| 721 |
+
FD_seed = init_FD_seed_frames(10000)
|
| 722 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 723 |
dk_id_dict = dict(zip(dk_raw.Player, dk_raw.player_ID))
|
| 724 |
fd_id_dict = dict(zip(fd_raw.Player, fd_raw.player_ID))
|
|
|
|
| 767 |
elif 'working_seed' not in st.session_state:
|
| 768 |
if site_var1 == 'Draftkings':
|
| 769 |
if slate_var1 == 'Main Slate':
|
| 770 |
+
st.session_state.working_seed = init_DK_seed_frames(sharp_split_var)
|
| 771 |
dk_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 772 |
elif slate_var1 == 'Secondary Slate':
|
| 773 |
+
st.session_state.working_seed = init_DK_Secondary_seed_frames(sharp_split_var)
|
| 774 |
dk_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 775 |
|
| 776 |
raw_baselines = dk_raw
|
|
|
|
| 778 |
|
| 779 |
elif site_var1 == 'Fanduel':
|
| 780 |
if slate_var1 == 'Main Slate':
|
| 781 |
+
st.session_state.working_seed = init_FD_seed_frames(sharp_split_var)
|
| 782 |
fd_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 783 |
elif slate_var1 == 'Secondary Slate':
|
| 784 |
+
st.session_state.working_seed = init_FD_Secondary_seed_frames(sharp_split_var)
|
| 785 |
fd_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 786 |
|
| 787 |
raw_baselines = fd_raw
|
|
|
|
| 807 |
st.session_state.data_export_display = pd.DataFrame(st.session_state.working_seed[0:1000], columns=column_names)
|
| 808 |
elif 'working_seed' not in st.session_state:
|
| 809 |
if slate_var1 == 'Main Slate':
|
| 810 |
+
st.session_state.working_seed = init_DK_seed_frames(sharp_split_var)
|
| 811 |
dk_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 812 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 813 |
|
| 814 |
elif slate_var1 == 'Secondary Slate':
|
| 815 |
+
st.session_state.working_seed = init_DK_Secondary_seed_frames(sharp_split_var)
|
| 816 |
dk_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 817 |
dk_raw, fd_raw = init_baselines('Secondary Slate')
|
| 818 |
|
|
|
|
| 830 |
st.session_state.data_export_display = pd.DataFrame(st.session_state.working_seed[0:1000], columns=column_names)
|
| 831 |
elif 'working_seed' not in st.session_state:
|
| 832 |
if slate_var1 == 'Main Slate':
|
| 833 |
+
st.session_state.working_seed = init_FD_seed_frames(sharp_split_var)
|
| 834 |
fd_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 835 |
dk_raw, fd_raw = init_baselines('Main Slate')
|
| 836 |
elif slate_var1 == 'Secondary Slate':
|
| 837 |
+
st.session_state.working_seed = init_FD_Secondary_seed_frames(sharp_split_var)
|
| 838 |
fd_id_dict = dict(zip(st.session_state.working_seed.Player, st.session_state.working_seed.player_ID))
|
| 839 |
dk_raw, fd_raw = init_baselines('Secondary Slate')
|
| 840 |
|