# app.py import streamlit as st import chromadb from chromadb import Client from chromadb.config import Settings # Initialize ChromaDB client client = Client(Settings(chroma_db_impl="duckdb+parquet", persist_directory="chroma_db")) # Create collections for patient reports and daily habits reports_collection = client.create_collection("patient_reports") habits_collection = client.create_collection("daily_habits") # Streamlit app layout st.title("Patient Report and Daily Habits Tracker") # Input form for patient reports with st.form("patient_report_form"): patient_name = st.text_input("Patient Name") report_date = st.date_input("Report Date") report_text = st.text_area("Report Text") submitted = st.form_submit_button("Submit Report") if submitted: reports_collection.add( documents=[report_text], metadatas=[{"patient_name": patient_name, "report_date": str(report_date)}], ids=[f"report_{len(reports_collection.documents) + 1}"] ) st.success("Report submitted successfully!") # Input form for daily habits with st.form("daily_habit_form"): patient_name_habit = st.text_input("Patient Name for Habit") date_habit = st.date_input("Date for Habit") habit = st.text_input("Habit Description") submitted_habit = st.form_submit_button("Submit Habit") if submitted_habit: habits_collection.add( documents=[habit], metadatas=[{"patient_name": patient_name_habit, "date": str(date_habit)}], ids=[f"habit_{len(habits_collection.documents) + 1}"] ) st.success("Habit submitted successfully!") # Function to display reports if st.button("View Reports"): reports = reports_collection.get() st.write(reports) # Function to display habits if st.button("View Habits"): habits = habits_collection.get() st.write(habits)