import streamlit as st from streamlit_option_menu import option_menu from pymongo import MongoClient import os import pandas as pd import numpy as np # Connecting to MongoDB uri = os.environ["MONGO_CONNECTION_STRING"] client = MongoClient(uri, tlsCertificateKeyFile="database/cert.pem") db = client["myapp"] col = db["reminders"] def Create_Reminder(): st.title("Create Reminder") message = st.text_input("What are you planning to do?") time = str(st.time_input("Time")) date = str(st.date_input("Date")) if st.button("Create Reminder"): col.insert_one({"message": message, "time": time, "date": date, "status": False}) st.success("Reminder Created Successfully!") def View_Reminders(): allrem = list(col.find()) df = pd.DataFrame(allrem) df = df.drop(columns=["_id"]) # Reorder the columns df = df.reset_index(drop=True) df.index += 1 ff = pd.DataFrame( np.random.randn(20, 3), columns=['a', 'b', 'c']) df = st.data_editor( df, column_config={ "Status": st.column_config.CheckboxColumn( "Status", help="Check to mark as done" ), "Chart": st.column_config.LineChartColumn(ff), }, ) def Reports(): st.title("Reports") df = pd.DataFrame( np.random.randn(20, 3), columns=['a', 'b', 'c']) st.line_chart(df) def dashboard(): st.title("Welcome to the Dashboard") with st.sidebar: selected = option_menu(None, ["Create Reminder", "View Reminders", "Reports"], icons=["plus", "eye", "sun"]) if selected == "Create Reminder": Create_Reminder() elif selected == "View Reminders": st.subheader("View Reminders") View_Reminders() elif selected == "Reports": st.subheader("Reports") Reports() dashboard()