Multichem commited on
Commit
e0beaab
·
verified ·
1 Parent(s): 304646c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -31,11 +31,14 @@ def init_conn():
31
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gspread-connection%40model-sheets-connect.iam.gserviceaccount.com"
32
  }
33
 
 
 
 
34
  gc_con = gspread.service_account_from_dict(credentials, scope)
35
 
36
- return gc_con
37
 
38
- gcservice_account = init_conn()
39
 
40
  NBA_Data = 'https://docs.google.com/spreadsheets/d/1Yq0vGriWK-bS79e-bD6_u9pqrYE6Yrlbb_wEkmH-ot0/edit#gid=1808117109'
41
 
@@ -44,10 +47,7 @@ percentages_format = {'PG': '{:.2%}', 'SG': '{:.2%}', 'SF': '{:.2%}', 'PF': '{:.
44
  @st.cache_resource(ttl = 600)
45
  def init_baselines():
46
  sh = gcservice_account.open_by_url(NBA_Data)
47
- client = pymongo.MongoClient("mongodb+srv://multichem:[email protected]/testing_db")
48
- db = client["testing_db"]
49
  collection = db["gamelog"]
50
-
51
  cursor = collection.find() # Finds all documents in the collection
52
 
53
  raw_display = pd.DataFrame(list(cursor))
@@ -91,9 +91,7 @@ def init_baselines():
91
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy', 'FPPM',
92
  'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch', 'team_score', 'opp_score', 'spread'], axis=1)
93
 
94
- db = client["testing_db"]
95
  collection = db["rotations"]
96
-
97
  cursor = collection.find() # Finds all documents in the collection
98
 
99
  raw_display = pd.DataFrame(list(cursor))
 
31
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gspread-connection%40model-sheets-connect.iam.gserviceaccount.com"
32
  }
33
 
34
+ client = pymongo.MongoClient("mongodb+srv://multichem:[email protected]/testing_db")
35
+ db = client["testing_db"]
36
+
37
  gc_con = gspread.service_account_from_dict(credentials, scope)
38
 
39
+ return gc_con, client, db
40
 
41
+ gcservice_accoun, client, db = init_conn()
42
 
43
  NBA_Data = 'https://docs.google.com/spreadsheets/d/1Yq0vGriWK-bS79e-bD6_u9pqrYE6Yrlbb_wEkmH-ot0/edit#gid=1808117109'
44
 
 
47
  @st.cache_resource(ttl = 600)
48
  def init_baselines():
49
  sh = gcservice_account.open_by_url(NBA_Data)
 
 
50
  collection = db["gamelog"]
 
51
  cursor = collection.find() # Finds all documents in the collection
52
 
53
  raw_display = pd.DataFrame(list(cursor))
 
91
  'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy', 'FPPM',
92
  'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch', 'team_score', 'opp_score', 'spread'], axis=1)
93
 
 
94
  collection = db["rotations"]
 
95
  cursor = collection.find() # Finds all documents in the collection
96
 
97
  raw_display = pd.DataFrame(list(cursor))