Multichem commited on
Commit
99381b9
·
verified ·
1 Parent(s): 9fdbdb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -23,14 +23,13 @@ def init_conn():
23
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gspread-connection%40model-sheets-connect.iam.gserviceaccount.com"
24
  }
25
  uri = "mongodb+srv://multichem:[email protected]/?retryWrites=true&w=majority&appName=TestCluster"
26
- client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=100000)
27
- db = client["testing_db"]
28
 
29
  MLB_Data = 'https://docs.google.com/spreadsheets/d/1f42Ergav8K1VsOLOK9MUn7DM_MLMvv4GR2Fy7EfnZTc/edit#gid=340831852'
30
 
31
  gc_con = gspread.service_account_from_dict(credentials, scope)
32
 
33
- return gc_con, db, MLB_Data
34
 
35
  gcservice_account, db, MLB_Data = init_conn()
36
 
@@ -40,15 +39,18 @@ dk_columns = ['SP1', 'SP2', 'C', '1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 's
40
  fd_columns = ['P', 'C_1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'UTIL', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']
41
 
42
  @st.cache_data(ttl = 599)
43
- def init_seed_frames(_database):
44
- collection = _database["DK_MLB_seed_frame"]
 
 
 
45
  cursor = collection.find()
46
 
47
  raw_display = pd.DataFrame(list(cursor))
48
  raw_display = raw_display[['SP1', 'SP2', 'C', '1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']]
49
  DK_seed = raw_display.to_numpy()
50
 
51
- collection = _database["FD_MLB_seed_frame"]
52
  cursor = collection.find()
53
 
54
  raw_display = pd.DataFrame(list(cursor))
 
23
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gspread-connection%40model-sheets-connect.iam.gserviceaccount.com"
24
  }
25
  uri = "mongodb+srv://multichem:[email protected]/?retryWrites=true&w=majority&appName=TestCluster"
26
+
 
27
 
28
  MLB_Data = 'https://docs.google.com/spreadsheets/d/1f42Ergav8K1VsOLOK9MUn7DM_MLMvv4GR2Fy7EfnZTc/edit#gid=340831852'
29
 
30
  gc_con = gspread.service_account_from_dict(credentials, scope)
31
 
32
+ return gc_con, uri, MLB_Data
33
 
34
  gcservice_account, db, MLB_Data = init_conn()
35
 
 
39
  fd_columns = ['P', 'C_1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'UTIL', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']
40
 
41
  @st.cache_data(ttl = 599)
42
+ def init_seed_frames(uri):
43
+ client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=100000)
44
+ db = client["testing_db"]
45
+
46
+ collection = db["DK_MLB_seed_frame"]
47
  cursor = collection.find()
48
 
49
  raw_display = pd.DataFrame(list(cursor))
50
  raw_display = raw_display[['SP1', 'SP2', 'C', '1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count']]
51
  DK_seed = raw_display.to_numpy()
52
 
53
+ collection = db["FD_MLB_seed_frame"]
54
  cursor = collection.find()
55
 
56
  raw_display = pd.DataFrame(list(cursor))