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