Spaces:
Running
Running
James McCool
commited on
Commit
·
f8456c7
1
Parent(s):
4886b47
Fixed database calls for new seed frame format
Browse files
app.py
CHANGED
|
@@ -55,16 +55,31 @@ st.markdown("""
|
|
| 55 |
def init_DK_seed_frames(sharp_split, slate_var):
|
| 56 |
|
| 57 |
if slate_var == 'Main Slate':
|
| 58 |
-
collection = db['
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
elif slate_var == 'Secondary Slate':
|
| 60 |
-
collection = db['
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
elif slate_var == 'Auxiliary Slate':
|
| 62 |
-
collection = db['
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
cursor = collection.find().limit(sharp_split)
|
| 65 |
|
| 66 |
raw_display = pd.DataFrame(list(cursor))
|
| 67 |
raw_display = raw_display[['C1', 'C2', 'W1', 'W2', 'W3', 'D1', 'D2', 'G', 'FLEX', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
|
|
|
|
|
|
|
|
|
|
| 68 |
DK_seed = raw_display.to_numpy()
|
| 69 |
|
| 70 |
return DK_seed
|
|
@@ -73,16 +88,34 @@ def init_DK_seed_frames(sharp_split, slate_var):
|
|
| 73 |
def init_FD_seed_frames(sharp_split, slate_var):
|
| 74 |
|
| 75 |
if slate_var == 'Main Slate':
|
| 76 |
-
collection = db['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
elif slate_var == 'Secondary Slate':
|
| 78 |
-
collection = db['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
elif slate_var == 'Auxiliary Slate':
|
| 80 |
-
collection = db['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
cursor = collection.find().limit(sharp_split)
|
| 83 |
|
| 84 |
raw_display = pd.DataFrame(list(cursor))
|
| 85 |
raw_display = raw_display[['C1', 'C2', 'W1', 'W2', 'D1', 'D2', 'FLEX1', 'FLEX2', 'G', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
|
|
|
|
|
|
|
|
|
|
| 86 |
FD_seed = raw_display.to_numpy()
|
| 87 |
|
| 88 |
return FD_seed
|
|
|
|
| 55 |
def init_DK_seed_frames(sharp_split, slate_var):
|
| 56 |
|
| 57 |
if slate_var == 'Main Slate':
|
| 58 |
+
collection = db['DK_NHL_name_map']
|
| 59 |
+
cursor = collection.find()
|
| 60 |
+
raw_data = pd.DataFrame(list(cursor))
|
| 61 |
+
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 62 |
+
collection = db[f"DK_NHL_seed_frame_Main Slate"]
|
| 63 |
elif slate_var == 'Secondary Slate':
|
| 64 |
+
collection = db['DK_NHL_Secondary_name_map']
|
| 65 |
+
cursor = collection.find()
|
| 66 |
+
raw_data = pd.DataFrame(list(cursor))
|
| 67 |
+
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 68 |
+
collection = db[f"DK_NHL_seed_frame_Secondary Slate"]
|
| 69 |
elif slate_var == 'Auxiliary Slate':
|
| 70 |
+
collection = db['DK_NHL_Late_name_map']
|
| 71 |
+
cursor = collection.find()
|
| 72 |
+
raw_data = pd.DataFrame(list(cursor))
|
| 73 |
+
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 74 |
+
collection = db[f"DK_NHL_seed_frame_Late Slate"]
|
| 75 |
|
| 76 |
cursor = collection.find().limit(sharp_split)
|
| 77 |
|
| 78 |
raw_display = pd.DataFrame(list(cursor))
|
| 79 |
raw_display = raw_display[['C1', 'C2', 'W1', 'W2', 'W3', 'D1', 'D2', 'G', 'FLEX', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
|
| 80 |
+
dict_columns = ['C1', 'C2', 'W1', 'W2', 'W3', 'D1', 'D2', 'G', 'FLEX']
|
| 81 |
+
for col in dict_columns:
|
| 82 |
+
raw_display[col] = raw_display[col].map(names_dict)
|
| 83 |
DK_seed = raw_display.to_numpy()
|
| 84 |
|
| 85 |
return DK_seed
|
|
|
|
| 88 |
def init_FD_seed_frames(sharp_split, slate_var):
|
| 89 |
|
| 90 |
if slate_var == 'Main Slate':
|
| 91 |
+
collection = db['FD_NHL_name_map']
|
| 92 |
+
cursor = collection.find()
|
| 93 |
+
raw_data = pd.DataFrame(list(cursor))
|
| 94 |
+
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 95 |
+
collection = db[f"FD_NHL_seed_frame_Main Slate"]
|
| 96 |
+
cursor = collection.find().limit(sharp_split)
|
| 97 |
elif slate_var == 'Secondary Slate':
|
| 98 |
+
collection = db['FD_NHL_Secondary_name_map']
|
| 99 |
+
cursor = collection.find()
|
| 100 |
+
raw_data = pd.DataFrame(list(cursor))
|
| 101 |
+
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 102 |
+
collection = db[f"FD_NHL_seed_frame_Secondary Slate"]
|
| 103 |
+
cursor = collection.find().limit(sharp_split)
|
| 104 |
elif slate_var == 'Auxiliary Slate':
|
| 105 |
+
collection = db['FD_NHL_Late_name_map']
|
| 106 |
+
cursor = collection.find()
|
| 107 |
+
raw_data = pd.DataFrame(list(cursor))
|
| 108 |
+
names_dict = dict(zip(raw_data['key'], raw_data['value']))
|
| 109 |
+
collection = db[f"FD_NHL_seed_frame_Late Slate"]
|
| 110 |
+
cursor = collection.find().limit(sharp_split)
|
| 111 |
|
| 112 |
cursor = collection.find().limit(sharp_split)
|
| 113 |
|
| 114 |
raw_display = pd.DataFrame(list(cursor))
|
| 115 |
raw_display = raw_display[['C1', 'C2', 'W1', 'W2', 'D1', 'D2', 'FLEX1', 'FLEX2', 'G', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
|
| 116 |
+
dict_columns = ['C1', 'C2', 'W1', 'W2', 'D1', 'D2', 'FLEX1', 'FLEX2', 'G']
|
| 117 |
+
for col in dict_columns:
|
| 118 |
+
raw_display[col] = raw_display[col].map(names_dict)
|
| 119 |
FD_seed = raw_display.to_numpy()
|
| 120 |
|
| 121 |
return FD_seed
|