Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update app.py
#7
by
						
MalikShehram
	
							
						- opened
							
					
    	
        app.py
    CHANGED
    
    | @@ -78,41 +78,64 @@ init_db() | |
| 78 | 
             
            st.markdown(
         | 
| 79 | 
             
                """
         | 
| 80 | 
             
            <style>
         | 
|  | |
| 81 | 
             
            :root{
         | 
| 82 | 
            -
              -- | 
| 83 | 
            -
              --muted:#6b7280;
         | 
| 84 | 
             
              --card:#ffffff;
         | 
| 85 | 
            -
              -- | 
|  | |
|  | |
|  | |
|  | |
| 86 | 
             
            }
         | 
|  | |
|  | |
| 87 | 
             
            body { background: var(--bg); }
         | 
| 88 |  | 
| 89 | 
            -
            /*  | 
| 90 | 
            -
            .card {background:var(--card);border-radius: | 
| 91 | 
            -
             | 
| 92 | 
            -
             | 
| 93 | 
            -
             | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
            .hero- | 
| 98 | 
            -
            .hero- | 
| 99 | 
            -
            .hero- | 
| 100 | 
            -
             | 
| 101 | 
            -
             | 
| 102 | 
            -
             | 
| 103 | 
            -
            . | 
| 104 | 
            -
            . | 
| 105 | 
            -
            . | 
| 106 | 
            -
             | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 109 | 
            -
            . | 
| 110 | 
            -
            . | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 111 |  | 
| 112 | 
             
            /* responsive */
         | 
| 113 | 
            -
            @media (max-width: | 
| 114 | 
            -
              .hero- | 
| 115 | 
            -
              . | 
|  | |
| 116 | 
             
            }
         | 
| 117 | 
             
            </style>
         | 
| 118 | 
             
            """,
         | 
| @@ -120,85 +143,91 @@ body { background: var(--bg); } | |
| 120 | 
             
            )
         | 
| 121 |  | 
| 122 | 
             
            # ----------------------
         | 
| 123 | 
            -
            #  | 
| 124 | 
             
            # ----------------------
         | 
| 125 | 
             
            if page == "Home":
         | 
| 126 | 
             
                st.markdown(
         | 
| 127 | 
             
                    """
         | 
| 128 | 
            -
                    <div class=" | 
| 129 | 
            -
             | 
| 130 | 
            -
             | 
| 131 | 
            -
             | 
| 132 | 
            -
             | 
| 133 | 
            -
             | 
| 134 | 
            -
             | 
| 135 | 
            -
             | 
| 136 | 
            -
             | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 139 | 
             
                            </div>
         | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 142 | 
            -
             | 
| 143 | 
            -
             | 
| 144 | 
            -
             | 
| 145 | 
            -
             | 
| 146 | 
            -
             | 
| 147 | 
            -
             | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 150 | 
            -
             | 
| 151 | 
            -
             | 
| 152 | 
            -
             | 
| 153 | 
            -
             | 
| 154 | 
            -
             | 
| 155 | 
            -
             | 
| 156 | 
            -
             | 
| 157 | 
            -
             | 
| 158 | 
            -
             | 
| 159 | 
            -
             | 
| 160 | 
            -
             | 
| 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 | 
            -
                 | 
| 176 | 
            -
                st.markdown(" | 
| 177 | 
            -
                st. | 
| 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
         |