Update app.py
Browse files
app.py
CHANGED
|
@@ -67,7 +67,25 @@ def verify_password(stored_password, provided_password):
|
|
| 67 |
|
| 68 |
def auth():
|
| 69 |
if st.session_state.user is None:
|
| 70 |
-
st.subheader("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
tabs = st.tabs(["Login", "Register"])
|
| 72 |
|
| 73 |
with tabs[0]:
|
|
@@ -117,8 +135,8 @@ def auth():
|
|
| 117 |
st.rerun()
|
| 118 |
|
| 119 |
def main():
|
| 120 |
-
st.set_page_config(page_title="
|
| 121 |
-
st.title("
|
| 122 |
|
| 123 |
auth()
|
| 124 |
|
|
@@ -147,7 +165,24 @@ def doctor_interface():
|
|
| 147 |
display_dashboard(is_doctor=True)
|
| 148 |
|
| 149 |
def add_entry():
|
| 150 |
-
st.header("Add New
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
with st.form("migraine_entry"):
|
| 152 |
date = st.date_input("Date")
|
| 153 |
pain_level = st.slider("Pain Level", 1, 10)
|
|
@@ -206,6 +241,31 @@ def add_entry():
|
|
| 206 |
|
| 207 |
def view_entries(is_doctor):
|
| 208 |
st.header("Migraine Entries")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
if is_doctor:
|
| 210 |
user_entries = load_data()
|
| 211 |
st.subheader("All Patient Entries")
|
|
@@ -231,7 +291,37 @@ def view_entries(is_doctor):
|
|
| 231 |
st.info("No entries found.")
|
| 232 |
|
| 233 |
def display_dashboard(is_doctor):
|
| 234 |
-
st.header("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
|
| 236 |
if is_doctor:
|
| 237 |
st.subheader("Select Patient")
|
|
|
|
| 67 |
|
| 68 |
def auth():
|
| 69 |
if st.session_state.user is None:
|
| 70 |
+
st.subheader("Welcome to the Headache Diary App")
|
| 71 |
+
|
| 72 |
+
# Instructions
|
| 73 |
+
with st.expander("How to Use This App", expanded=True):
|
| 74 |
+
st.markdown("""
|
| 75 |
+
**For Patients:**
|
| 76 |
+
1. Register for an account or log in if you already have one.
|
| 77 |
+
2. Once logged in, you can:
|
| 78 |
+
- Add new migraine entries
|
| 79 |
+
- View your past entries
|
| 80 |
+
- See a dashboard with visualizations of your migraine patterns
|
| 81 |
+
3. Regularly log your migraines for the most accurate insights.
|
| 82 |
+
|
| 83 |
+
**Tips for Effective Use:**
|
| 84 |
+
- Be consistent in logging migraines
|
| 85 |
+
- Include as much detail as possible in each entry
|
| 86 |
+
- Regularly review the dashboard to identify patterns
|
| 87 |
+
- Discuss app insights with your healthcare provider
|
| 88 |
+
""")
|
| 89 |
tabs = st.tabs(["Login", "Register"])
|
| 90 |
|
| 91 |
with tabs[0]:
|
|
|
|
| 135 |
st.rerun()
|
| 136 |
|
| 137 |
def main():
|
| 138 |
+
st.set_page_config(page_title="Headache Diary App", page_icon="🧠", layout="wide")
|
| 139 |
+
st.title("Headache Diary App")
|
| 140 |
|
| 141 |
auth()
|
| 142 |
|
|
|
|
| 165 |
display_dashboard(is_doctor=True)
|
| 166 |
|
| 167 |
def add_entry():
|
| 168 |
+
st.header("Add New Headache Entry")
|
| 169 |
+
with st.sidebar:
|
| 170 |
+
st.subheader("How to Add an Entry")
|
| 171 |
+
st.markdown("""
|
| 172 |
+
1. **Date**: Select the date of your migraine.
|
| 173 |
+
2. **Pain Level**: Rate your pain from 1 (mild) to 10 (severe).
|
| 174 |
+
3. **Duration**: Choose how long your migraine lasted.
|
| 175 |
+
4. **Triggers**: Select all factors that may have triggered your migraine.
|
| 176 |
+
5. **Symptoms**: Check all symptoms you experienced.
|
| 177 |
+
6. **Medications**: List any medications you took.
|
| 178 |
+
7. **Notes**: Add any additional observations or comments.
|
| 179 |
+
8. **Submit**: Click 'Submit Entry' when you're done.
|
| 180 |
+
|
| 181 |
+
Tips:
|
| 182 |
+
- Be as accurate and detailed as possible.
|
| 183 |
+
- If you're unsure about a trigger or symptom, it's okay to leave it unchecked.
|
| 184 |
+
- Use the notes section to mention any unusual circumstances or effects.
|
| 185 |
+
""")
|
| 186 |
with st.form("migraine_entry"):
|
| 187 |
date = st.date_input("Date")
|
| 188 |
pain_level = st.slider("Pain Level", 1, 10)
|
|
|
|
| 241 |
|
| 242 |
def view_entries(is_doctor):
|
| 243 |
st.header("Migraine Entries")
|
| 244 |
+
with st.sidebar:
|
| 245 |
+
st.subheader("How to Use Entries View")
|
| 246 |
+
if is_doctor:
|
| 247 |
+
st.markdown("""
|
| 248 |
+
1. **Browse Entries**: Scroll through all patient entries.
|
| 249 |
+
2. **Expand Details**: Click on an entry to see full details.
|
| 250 |
+
3. **Analysis**: Read the doctor's analysis for each entry.
|
| 251 |
+
4. **Patient History**: Use this view to track patient progress over time.
|
| 252 |
+
|
| 253 |
+
Tips:
|
| 254 |
+
- Look for patterns in triggers and symptoms across patients.
|
| 255 |
+
- Use this information to inform treatment plans and discussions.
|
| 256 |
+
""")
|
| 257 |
+
else:
|
| 258 |
+
st.markdown("""
|
| 259 |
+
1. **Your History**: Browse through your past migraine entries.
|
| 260 |
+
2. **Expand Details**: Click on an entry to see full details.
|
| 261 |
+
3. **Advice**: Read the personalized advice for each entry.
|
| 262 |
+
4. **Track Progress**: Use this view to see how your migraines change over time.
|
| 263 |
+
|
| 264 |
+
Tips:
|
| 265 |
+
- Look for patterns in your triggers and symptoms.
|
| 266 |
+
- Discuss recurring patterns with your doctor.
|
| 267 |
+
- Use the advice to make lifestyle adjustments.
|
| 268 |
+
""")
|
| 269 |
if is_doctor:
|
| 270 |
user_entries = load_data()
|
| 271 |
st.subheader("All Patient Entries")
|
|
|
|
| 291 |
st.info("No entries found.")
|
| 292 |
|
| 293 |
def display_dashboard(is_doctor):
|
| 294 |
+
st.header("Headache Dashboard")
|
| 295 |
+
with st.sidebar:
|
| 296 |
+
st.subheader("How to Use the Dashboard")
|
| 297 |
+
if is_doctor:
|
| 298 |
+
st.markdown("""
|
| 299 |
+
1. **Select Patient**: Choose a patient from the dropdown to view their data.
|
| 300 |
+
2. **Pain Level Trend**: Observe how pain levels change over time.
|
| 301 |
+
3. **Common Triggers**: Identify the most frequent migraine triggers.
|
| 302 |
+
4. **Common Symptoms**: See the most reported symptoms.
|
| 303 |
+
5. **Statistics**: Review key metrics at a glance.
|
| 304 |
+
6. **Recent Entries**: Check the latest migraine reports.
|
| 305 |
+
|
| 306 |
+
Tips:
|
| 307 |
+
- Use these insights to tailor treatment plans.
|
| 308 |
+
- Discuss observed patterns with your patients.
|
| 309 |
+
- Look for correlations between triggers, symptoms, and pain levels.
|
| 310 |
+
""")
|
| 311 |
+
else:
|
| 312 |
+
st.markdown("""
|
| 313 |
+
1. **Pain Level Trend**: See how your pain levels have changed over time.
|
| 314 |
+
2. **Common Triggers**: Identify your most frequent migraine triggers.
|
| 315 |
+
3. **Common Symptoms**: Review your most reported symptoms.
|
| 316 |
+
4. **Statistics**: Get a quick overview of your migraine patterns.
|
| 317 |
+
5. **Recent Entries**: Review your latest migraine reports.
|
| 318 |
+
|
| 319 |
+
Tips:
|
| 320 |
+
- Use the pain level trend to track the effectiveness of treatments.
|
| 321 |
+
- Pay attention to your common triggers and try to avoid them.
|
| 322 |
+
- Discuss any patterns you notice with your doctor.
|
| 323 |
+
- Use insights from the dashboard to make informed lifestyle choices.
|
| 324 |
+
""")
|
| 325 |
|
| 326 |
if is_doctor:
|
| 327 |
st.subheader("Select Patient")
|