Files changed (1) hide show
  1. app.py +124 -95
app.py CHANGED
@@ -78,41 +78,64 @@ init_db()
78
  st.markdown(
79
  """
80
  <style>
 
81
  :root{
82
- --accent:#4C6EF5;
83
- --muted:#6b7280;
84
  --card:#ffffff;
85
- --bg:#f7f9fc;
 
 
 
 
86
  }
 
 
87
  body { background: var(--bg); }
88
 
89
- /* Card base */
90
- .card {background:var(--card);border-radius:14px;padding:18px;box-shadow:0 8px 30px rgba(20,25,40,0.06);margin-bottom:16px;}
91
- .metric{font-size:22px;font-weight:800}
92
- .section-title{font-size:26px;font-weight:800;margin-bottom:8px}
93
-
94
- /* Hero */
95
- .hero {background: linear-gradient(135deg, rgba(76,110,245,0.12), rgba(94,234,212,0.06)); border-radius:16px; padding:36px; margin-bottom:18px;}
96
- .hero-grid{display:flex;gap:20px;align-items:center;}
97
- .hero-left{flex:1}
98
- .hero-title{font-size:38px;font-weight:900;margin:0 0 8px 0;color:#0f172a}
99
- .hero-sub{font-size:18px;color:var(--muted);margin:0 0 16px 0}
100
- .pill {display:inline-block;padding:8px 12px;border-radius:999px;background:rgba(76,110,245,0.12);color:var(--accent);font-weight:700;margin-right:8px}
101
-
102
- /* Feature cards */
103
- .features{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:12px}
104
- .feature {padding:14px;border-radius:12px;background:linear-gradient(180deg,#fff,#fbfdff);border:1px solid rgba(10,10,10,0.02);}
105
- .feature h4{margin:0 0 6px 0}
106
- .feature p{margin:0;color:var(--muted);font-size:14px}
107
-
108
- /* Footer small */
109
- .small-note{font-size:13px;color:var(--muted);margin-top:8px}
110
- .badge {display:inline-block;padding:6px 10px;border-radius:10px;background:#eef2ff;color:var(--accent);font-weight:700}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
  /* responsive */
113
- @media (max-width:900px){
114
- .hero-grid{flex-direction:column}
115
- .features{grid-template-columns:1fr}
 
116
  }
117
  </style>
118
  """,
@@ -120,85 +143,91 @@ body { background: var(--bg); }
120
  )
121
 
122
  # ----------------------
123
- # Landing Page (professional & attractive)
124
  # ----------------------
125
  if page == "Home":
126
  st.markdown(
127
  """
128
- <div class="hero card">
129
- <div class="hero-grid">
130
- <div class="hero-left">
131
- <div class="pill">Clinical-grade · Explainable</div>
132
- <h1 class="hero-title">NeuraVia</h1>
133
- <p class="hero-sub">Symptom Tracker & Risk Dashboard — Capture structured vitals and symptoms, generate explainable risk flags, and visualize trends over time for personalized monitoring.</p>
134
- <div style="display:flex;gap:12px;align-items:center">
135
- <div style="padding:10px 14px;border-radius:10px;background:linear-gradient(90deg, #4C6EF5, #7C3AED);color:white;font-weight:700;">Get Started → Use Sidebar</div>
136
- <div style="padding:10px 14px;border-radius:10px;border:1px solid rgba(15,23,42,0.06);">Demo: Toggle <b>Use Demo Data</b></div>
137
- </div>
138
- <p class="small-note">Designed for rapid prototyping & hackathon submission. Not a replacement for professional medical diagnosis.</p>
 
 
 
 
 
 
 
 
 
 
 
 
139
  </div>
140
- <div style="flex:0.9;">
141
- <!-- Info summary -->
142
- <div class="card" style="padding:16px;">
143
- <div style="display:flex;justify-content:space-between;align-items:center">
144
- <div>
145
- <div style="font-weight:800;font-size:18px">Snapshot</div>
146
- <div style="color:var(--muted);margin-top:6px">Explainable rules + optional AI zero-shot scoring · Local persistence · CSV export</div>
147
- </div>
148
- <div style="text-align:right">
149
- <div style="font-weight:900;font-size:18px">6</div>
150
- <div style="color:var(--muted);font-size:13px">Key Condition Flags</div>
151
- </div>
152
- </div>
153
- <div class="features" style="margin-top:12px">
154
- <div class="feature">
155
- <h4>Interpretable Risk</h4>
156
- <p>Rule-based scoring with human-readable explanations so clinicians & users can trace why a flag was raised.</p>
157
- </div>
158
- <div class="feature">
159
- <h4>Longitudinal Trends</h4>
160
- <p>Visualize vitals and risk metrics over time to spot deterioration or improvement patterns.</p>
161
- </div>
162
- <div class="feature">
163
- <h4>Secure Local Storage</h4>
164
- <p>Entries are stored locally (SQLite). Export CSV for sharing with clinicians or research.</p>
165
- </div>
166
- </div>
167
- </div>
168
  </div>
 
 
 
 
 
 
 
 
 
169
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  </div>
171
  """,
172
  unsafe_allow_html=True,
173
  )
174
 
175
- st.markdown("<div class='card'>", unsafe_allow_html=True)
176
- st.markdown("### Professional overview")
177
- st.write(
178
- "- **Purpose:** Rapid, explainable symptom capture for population screening and personal monitoring.\n"
179
- "- **Method:** Rule-driven assessments augmented with optional HuggingFace zero-shot classification for broader symptom interpretation.\n"
180
- "- **Outputs:** Interpretable risk scores, trend charts, and CSV export for downstream analysis."
181
- )
182
- st.markdown("</div>", unsafe_allow_html=True)
183
-
184
- c1, c2, c3 = st.columns([1,1,1])
185
- with c1:
186
- st.markdown("<div class='card'>", unsafe_allow_html=True)
187
- st.markdown("**Who should use this?**")
188
- st.write("Healthcare researchers, students, and developers building interpretable screening tools.")
189
- st.markdown("</div>", unsafe_allow_html=True)
190
- with c2:
191
- st.markdown("<div class='card'>", unsafe_allow_html=True)
192
- st.markdown("**Key strengths**")
193
- st.write("- Explainability\n- Quick demo-ready\n- Exportable data")
194
- st.markdown("</div>", unsafe_allow_html=True)
195
- with c3:
196
- st.markdown("<div class='card'>", unsafe_allow_html=True)
197
- st.markdown("**How to submit**")
198
- st.write("1. Open **Input**, fill the form (or toggle Demo).\n2. Submit to compute risks.\n3. View trends in **Dashboard** and export in **History**.")
199
- st.markdown("</div>", unsafe_allow_html=True)
200
-
201
- st.info("Tip: Use the **Use Demo Data** toggle in the sidebar to prefill a demo patient and speed up your demo.", icon="💡")
202
 
203
  # ----------------------
204
  # Start Page
 
78
  st.markdown(
79
  """
80
  <style>
81
+ /* --- Base tokens --- */
82
  :root{
83
+ --bg:#f6f8fb;
 
84
  --card:#ffffff;
85
+ --muted:#6b7280;
86
+ --accent:#2b6ef6;
87
+ --accent-2:#7c3aed;
88
+ --glass: rgba(255,255,255,0.85);
89
+ --shadow: 0 8px 28px rgba(15,23,42,0.07);
90
  }
91
+
92
+ /* page background */
93
  body { background: var(--bg); }
94
 
95
+ /* card */
96
+ .card { background: var(--card); border-radius:12px; padding:20px; box-shadow: var(--shadow); }
97
+
98
+ /* typography */
99
+ .h1 { font-size:36px; font-weight:800; margin: 0 0 6px 0; color:#071030; }
100
+ .h2 { font-size:18px; font-weight:600; margin: 0 0 12px 0; color:var(--muted); }
101
+
102
+ /* hero layout */
103
+ .hero-wrap { display:flex; gap:28px; align-items:flex-start; margin-bottom:18px; }
104
+ .hero-left { flex: 1.05; }
105
+ .hero-right { flex: 0.9; }
106
+
107
+ /* hero left */
108
+ .badge { display:inline-block; padding:8px 12px; border-radius:999px; background: linear-gradient(90deg, rgba(43,110,246,0.12), rgba(124,58,237,0.06)); color:var(--accent); font-weight:700; margin-bottom:14px; }
109
+ .cta-row { display:flex; gap:12px; margin-top:14px; align-items:center; }
110
+ .cta-primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color:white; padding:10px 16px; border-radius:10px; font-weight:700; }
111
+ .cta-ghost { background:transparent; border:1px solid rgba(7,16,48,0.06); padding:10px 14px; border-radius:10px; color:var(--muted); }
112
+
113
+ /* hero right - vertical features */
114
+ .feature-list { display:flex; flex-direction:column; gap:12px; }
115
+ .feature { background: linear-gradient(180deg,#ffffff,#fbfdff); border-radius:10px; padding:14px; border:1px solid rgba(10,10,10,0.02); box-shadow: 0 6px 18px rgba(11,21,57,0.03); }
116
+ .feature h4 { margin:0; font-size:16px; font-weight:700; color:#071030; }
117
+ .feature p { margin:6px 0 0 0; color:var(--muted); font-size:13px; line-height:1.45; }
118
+
119
+ /* three quick stats row */
120
+ .quicks { display:flex; gap:12px; margin-top:14px; }
121
+ .stat { background:transparent; padding:10px 12px; border-radius:10px; border:1px solid rgba(11,21,57,0.04); min-width:120px; text-align:center; }
122
+ .stat .num { font-size:18px; font-weight:900; color:#071030; }
123
+ .stat .lbl { font-size:12px; color:var(--muted); margin-top:6px; }
124
+
125
+ /* info grid below hero */
126
+ .info-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-top:14px; }
127
+ .info { background:var(--card); border-radius:10px; padding:12px; border:1px solid rgba(11,21,57,0.03); }
128
+ .info h5 { margin:0; font-size:14px; font-weight:800; }
129
+ .info p { margin:8px 0 0 0; color:var(--muted); font-size:13px; line-height:1.45; }
130
+
131
+ /* small caption */
132
+ .small-note{font-size:13px;color:var(--muted);margin-top:10px}
133
 
134
  /* responsive */
135
+ @media (max-width:1000px){
136
+ .hero-wrap{flex-direction:column}
137
+ .hero-right{order:2}
138
+ .info-grid{grid-template-columns:1fr}
139
  }
140
  </style>
141
  """,
 
143
  )
144
 
145
  # ----------------------
146
+ # Clean, professional Landing Page
147
  # ----------------------
148
  if page == "Home":
149
  st.markdown(
150
  """
151
+ <div class="card">
152
+ <div style="display:flex; justify-content:space-between; align-items:center; gap:12px;">
153
+ <div style="display:flex; align-items:center; gap:12px;">
154
+ <div style="width:56px;height:56px;border-radius:12px;background:linear-gradient(135deg,#eef6ff,#f6ecff);display:flex;align-items:center;justify-content:center;font-size:22px">🧠</div>
155
+ <div>
156
+ <div class="h1">NeuraVia</div>
157
+ <div class="h2">Symptom Tracker & Risk Dashboard — clean, explainable clinical screening for rapid prototyping.</div>
158
+ </div>
159
+ </div>
160
+ <div style="text-align:right">
161
+ <div style="font-size:13px;color:var(--muted);">NeuraViaHacks Built with Streamlit</div>
162
+ </div>
163
+ </div>
164
+
165
+ <div style="height:18px"></div>
166
+
167
+ <div class="hero-wrap">
168
+ <div class="hero-left">
169
+ <div class="badge">Clinical-grade · Explainable</div>
170
+ <div style="margin-top:6px;">
171
+ <div style="font-size:20px;font-weight:700;color:#071030">Capture structured vitals, generate explainable risk flags, and visualize trends.</div>
172
+ <div style="margin-top:10px;color:var(--muted);font-size:14px;line-height:1.5">
173
+ NeuraVia combines deterministic, rule-based assessments with optional AI-powered symptom interpretation to give interpretable, actionable outputs — ideal for demos, research prototypes, and clinician-facing dashboards.
174
  </div>
175
+ </div>
176
+
177
+ <div class="cta-row">
178
+ <div class="cta-primary">Get Started</div>
179
+ <div class="cta-ghost">Use Demo Data (toggle)</div>
180
+ </div>
181
+
182
+ <div class="quicks">
183
+ <div class="stat"><div class="num">6</div><div class="lbl">Key Flags</div></div>
184
+ <div class="stat"><div class="num">CSV</div><div class="lbl">Exportable</div></div>
185
+ <div class="stat"><div class="num">Local</div><div class="lbl">SQLite</div></div>
186
+ </div>
187
+
188
+ <div class="small-note">Note: Educational use only. Not a medical device. Consult a clinician for clinical decisions.</div>
189
+ </div>
190
+
191
+ <div class="hero-right">
192
+ <div class="feature-list">
193
+ <div class="feature">
194
+ <h4>Interpretable Risk</h4>
195
+ <p>Rule-driven scoring with clear human-readable explanations so users and clinicians can trace why a risk flag was raised.</p>
 
 
 
 
 
 
 
196
  </div>
197
+ <div class="feature">
198
+ <h4>Longitudinal Trends</h4>
199
+ <p>Visualize vital signs and risk scores over time to identify meaningful change and clinical deterioration or improvement.</p>
200
+ </div>
201
+ <div class="feature">
202
+ <h4>Secure Local Storage</h4>
203
+ <p>Data persisted locally (SQLite). Export CSV for sharing with investigators or clinicians.</p>
204
+ </div>
205
+ </div>
206
  </div>
207
+ </div>
208
+
209
+ <div class="info-grid" style="margin-top:18px;">
210
+ <div class="info">
211
+ <h5>Purpose</h5>
212
+ <p>Rapid, explainable symptom capture for screening and personal monitoring. Emphasis on clarity and reproducibility.</p>
213
+ </div>
214
+ <div class="info">
215
+ <h5>Method</h5>
216
+ <p>Combines deterministic rules with optional HuggingFace zero-shot classification to augment symptom interpretation.</p>
217
+ </div>
218
+ <div class="info">
219
+ <h5>Outputs</h5>
220
+ <p>Interpretable risk scores, trend charts, and CSV export for downstream analysis or clinical review.</p>
221
+ </div>
222
+ </div>
223
  </div>
224
  """,
225
  unsafe_allow_html=True,
226
  )
227
 
228
+ # small help box below the hero
229
+ st.markdown("<div style='margin-top:12px'/>", unsafe_allow_html=True)
230
+ st.info("Use the sidebar to navigate: Start → Input → Dashboard → History. Toggle 'Use Demo Data' to prefill a demo patient and speed your demo.", icon="💡")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
 
232
  # ----------------------
233
  # Start Page