James McCool
Add database connection module and refactor Streamlit app to utilize it, improving code organization and data handling for simulations.
f70d907
import streamlit as st | |
import pymongo | |
import os | |
def init_conn(): | |
uri = os.getenv('MONGO_URI') | |
if not uri: | |
uri = st.secrets['mongo_uri'] | |
client = pymongo.MongoClient(uri, retryWrites=True, serverSelectionTimeoutMS=500000) | |
db = client["NFL_Database"] | |
return db | |
# Initialize the database connection | |
db = init_conn() |