import streamlit as st import datetime import time import openai # Set up OpenAI API key openai.api_key = st.secrets["OPENAI_API_KEY"] # Task Management tasks = [] def add_task(task, due_date): tasks.append({"task": task, "due_date": due_date, "completed": False}) def complete_task(index): tasks[index]["completed"] = True def task_management(): st.markdown( f"""

Task Management

Create, organize, and prioritize tasks and to-do lists.

Tasks:

""", unsafe_allow_html=True, ) if st.button("Add Task"): task = st.text_input("Task") due_date = st.date_input("Due Date") if task and due_date: add_task(task, due_date) def generate_task_list(): task_list = "" for index, task in enumerate(tasks): task_list += f'
  • {task["task"]} - Due: {task["due_date"]}
  • ' return task_list # Time Management def pomodoro_timer(duration): start_time = time.time() end_time = start_time + duration * 60 while time.time() < end_time: remaining_time = end_time - time.time() minutes, seconds = divmod(remaining_time, 60) timer_text = f"{int(minutes):02d}:{int(seconds):02d}" st.markdown( f"""
    {timer_text}
    """, unsafe_allow_html=True, ) time.sleep(1) st.markdown( f"""
    Time's up!
    """, unsafe_allow_html=True, ) def time_management(): st.markdown( f"""

    Time Management

    Utilize timers, time-blocking, and scheduling tools to manage your time effectively.

    Pomodoro Timer

    Time Blocking

    """, unsafe_allow_html=True, ) duration = st.number_input("Select duration (in minutes)", min_value=1, max_value=60, value=25, step=1) if st.button("Start Timer"): pomodoro_timer(duration) # Habit Tracking habits = [] def add_habit(habit): habits.append({"habit": habit, "streak": 0}) def increment_streak(index): habits[index]["streak"] += 1 def habit_tracking(): st.markdown( f"""

    Habit Tracking

    Set and track habits related to productivity, self-care, and well-being.

    Habits:

    """, unsafe_allow_html=True, ) if st.button("Add Habit"): habit = st.text_input("Habit") if habit: add_habit(habit) def generate_habit_list(): habit_list = "" for index, habit in enumerate(habits): habit_list += f'
  • {habit["habit"]} - Streak: {habit["streak"]}
  • ' return habit_list # Workplace Strategies def workplace_strategies(): st.markdown( f"""

    Workplace Strategies

    Discover strategies for managing ADHD in the workplace.

    """, unsafe_allow_html=True, ) # Resources def resources(): st.markdown( f"""

    Resources

    Explore a collection of helpful resources related to ADHD.

    """, unsafe_allow_html=True, ) # AI-based Personalization def get_chatgpt_response(prompt): response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "system", "content": "You are a helpful assistant providing personalized recommendations for managing ADHD."}, {"role": "user", "content": prompt} ] ) return response['choices'][0]['message']['content'].strip() def personalization(): st.markdown( f"""

    Personalization

    Get personalized recommendations for managing ADHD based on your responses.

    """, unsafe_allow_html=True, ) age = st.number_input("What is your age?", min_value=1, max_value=100, value=25, step=1) occupation = st.text_input("What is your occupation?") challenges = st.text_area("What are the main challenges you face with ADHD?") if st.button("Get Personalized Recommendations"): prompt = f"I am {age} years old, working as a {occupation}. The main challenges I face with ADHD are: {challenges}. Can you provide personalized recommendations for managing ADHD in my daily life and work?" recommendations = get_chatgpt_response(prompt) st.markdown( f"""

    Personalized Recommendations:

    {recommendations}

    """, unsafe_allow_html=True, ) def main(): st.set_page_config(page_title="ADHD Toolkit", layout="wide") # Define color scheme primary_color = "#1E88E5" secondary_color = "#90CAF9" text_color = "#FFFFFF" # Set up sidebar st.markdown( f""" """, unsafe_allow_html=True, ) menu = ["Home", "Task Management", "Time Management", "Habit Tracking", "Workplace Strategies", "Resources", "Personalization"] choice = st.sidebar.selectbox("Select a section", menu) # Set up main content area st.markdown( f""" """, unsafe_allow_html=True, ) if choice == "Home": st.markdown( f"""

    Welcome to the ADHD Toolkit!

    This app provides tools and resources to help manage ADHD.

    """, unsafe_allow_html=True, ) elif choice == "Task Management": task_management() elif choice == "Time Management": time_management() elif choice == "Habit Tracking": habit_tracking() elif choice == "Workplace Strategies": workplace_strategies() elif choice == "Resources": resources() elif choice == "Personalization": personalization() if __name__ == "__main__": main()