Multichem commited on
Commit
c98cb76
·
verified ·
1 Parent(s): 566d17a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -11,11 +11,13 @@ def init_conn():
11
 
12
  uri = st.secrets['mongo_uri']
13
  client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=500000)
14
- db = client["League_of_Legends_Database"]
15
 
16
- return db
 
 
17
 
18
- db = init_conn()
19
 
20
  percentages_format = {'Exposure': '{:.2%}'}
21
  freq_format = {'Exposure': '{:.2%}', 'Proj Own': '{:.2%}', 'Edge': '{:.2%}'}
@@ -27,11 +29,11 @@ fd_columns = ['CPT', 'TOP', 'JNG', 'MID', 'ADC', 'SUP', 'TEAM', 'salary', 'proj'
27
  def init_DK_seed_frames(league):
28
 
29
  if league == 'LCK':
30
- collection = db['LOL_LCK_seed_frame']
31
  elif league =='LEC':
32
- collection = db['LOL_LEC_seed_frame']
33
  elif league =='LTA':
34
- collection = db['LOL_LTA_seed_frame']
35
  cursor = collection.find()
36
 
37
  raw_display = pd.DataFrame(list(cursor))
@@ -43,7 +45,7 @@ def init_DK_seed_frames(league):
43
  @st.cache_data(ttl = 599)
44
  def init_baselines():
45
 
46
- collection = db['Player_Range_Of_Outcomes']
47
  cursor = collection.find()
48
 
49
  raw_display = pd.DataFrame(list(cursor))
 
11
 
12
  uri = st.secrets['mongo_uri']
13
  client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=500000)
14
+ sims_db = client["League_of_Legends"]
15
 
16
+ projections_db = client["League_of_Legends_Database"]
17
+
18
+ return sims_db, projections_db
19
 
20
+ sims_db, projections_db = init_conn()
21
 
22
  percentages_format = {'Exposure': '{:.2%}'}
23
  freq_format = {'Exposure': '{:.2%}', 'Proj Own': '{:.2%}', 'Edge': '{:.2%}'}
 
29
  def init_DK_seed_frames(league):
30
 
31
  if league == 'LCK':
32
+ collection = sims_db['League_of_Legends_DK_seed_frame']
33
  elif league =='LEC':
34
+ collection = sims_db['League_of_Legends_DK_seed_frame']
35
  elif league =='LTA':
36
+ collection = sims_db['League_of_Legends_DK_seed_frame']
37
  cursor = collection.find()
38
 
39
  raw_display = pd.DataFrame(list(cursor))
 
45
  @st.cache_data(ttl = 599)
46
  def init_baselines():
47
 
48
+ collection = projections_db['Player_Range_of_Outcomes']
49
  cursor = collection.find()
50
 
51
  raw_display = pd.DataFrame(list(cursor))