neurocheck / frontend /index.html
ZeroNinerOne's picture
Upload 3 files
546015a verified
Raw History Blame Contribute Delete
21.3 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AxonIQ — MS Symptom Checker</title>
<link href="https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=DM+Sans:wght@300;400;500;600&display=swap" rel="stylesheet">
<style>
:root {
--navy: #0B1F3A;
--teal: #0A7B74;
--teal-lt: #E6F5F4;
--amber: #C97B2A;
--red: #B53535;
--purple: #5C3A8C;
--green: #1B6E44;
--sand: #F5F1EB;
--warm-white: #FDFAF6;
--border: #DDD8CF;
--text: #1A1510;
--muted: #6B6056;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'DM Sans', sans-serif;
background: var(--warm-white);
color: var(--text);
min-height: 100vh;
display: flex;
flex-direction: column;
}
header {
background: var(--navy);
padding: 28px 40px 24px;
display: flex;
align-items: flex-end;
gap: 20px;
border-bottom: 3px solid var(--teal);
}
.logo-mark {
width: 48px; height: 48px;
background: var(--teal);
border-radius: 12px;
display: flex; align-items: center; justify-content: center;
font-family: 'Libre Baskerville', serif;
font-size: 22px; font-weight: 700;
color: #fff; flex-shrink: 0;
letter-spacing: -1px;
}
.header-text h1 {
font-family: 'Libre Baskerville', serif;
font-size: 24px; font-weight: 700;
color: #fff; line-height: 1.1;
}
.header-text p { font-size: 13px; color: #8FA8BF; margin-top: 3px; font-weight: 300; }
.header-badge {
margin-left: auto;
background: rgba(10,123,116,0.25);
border: 1px solid rgba(10,123,116,0.5);
color: #5ECFC8;
font-size: 11px; font-weight: 500;
padding: 5px 12px; border-radius: 20px;
letter-spacing: 0.5px; text-transform: uppercase;
white-space: nowrap;
}
main {
flex: 1;
display: grid;
grid-template-columns: 1fr 1fr;
max-width: 1280px;
margin: 0 auto;
width: 100%;
}
/* LEFT */
.left-panel {
padding: 48px 40px;
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
gap: 28px;
}
.section-label {
font-size: 11px; font-weight: 600;
text-transform: uppercase; letter-spacing: 1.5px;
color: var(--muted); margin-bottom: 8px;
}
.symptom-textarea {
width: 100%; min-height: 260px;
padding: 18px 20px;
border: 1.5px solid var(--border); border-radius: 12px;
font-family: 'DM Sans', sans-serif; font-size: 15px; line-height: 1.7;
color: var(--text); background: #fff; resize: vertical; outline: none;
transition: border-color 0.2s, box-shadow 0.2s;
caret-color: var(--teal);
}
.symptom-textarea::placeholder { color: #B0A898; }
.symptom-textarea:focus {
border-color: var(--teal);
box-shadow: 0 0 0 3px rgba(10,123,116,0.1);
}
.char-count { margin-top: 6px; font-size: 12px; color: var(--muted); text-align: right; }
.example-prompts { display: flex; flex-direction: column; gap: 8px; }
.example-btn {
background: var(--sand); border: 1px solid var(--border); border-radius: 8px;
padding: 10px 14px; font-family: 'DM Sans', sans-serif;
font-size: 13px; color: var(--muted); cursor: pointer;
text-align: left; transition: background 0.15s, border-color 0.15s, color 0.15s;
line-height: 1.4;
}
.example-btn:hover { background: var(--teal-lt); border-color: var(--teal); color: var(--navy); }
.example-btn strong {
color: var(--navy); display: block; margin-bottom: 2px;
font-size: 12px; font-weight: 600;
text-transform: uppercase; letter-spacing: 0.5px;
}
.analyse-btn {
width: 100%; padding: 16px 24px;
background: var(--navy); color: #fff;
border: none; border-radius: 12px;
font-family: 'DM Sans', sans-serif;
font-size: 16px; font-weight: 600;
cursor: pointer;
display: flex; align-items: center; justify-content: center; gap: 10px;
transition: background 0.2s, transform 0.1s;
}
.analyse-btn:hover:not(:disabled) { background: #162F52; }
.analyse-btn:active:not(:disabled) { transform: scale(0.99); }
.analyse-btn:disabled { background: #8FA8BF; cursor: not-allowed; }
.spinner {
width: 18px; height: 18px;
border: 2px solid rgba(255,255,255,0.3);
border-top-color: #fff; border-radius: 50%;
animation: spin 0.7s linear infinite; display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading .spinner { display: block; }
.loading .btn-label { opacity: 0.6; }
.error-banner {
background: #FEF2F2; border: 1px solid #FCA5A5; border-radius: 8px;
padding: 12px 16px; font-size: 13px; color: var(--red);
display: none; line-height: 1.5;
}
.error-banner.visible { display: block; }
.disclaimer {
font-size: 11.5px; color: var(--muted); line-height: 1.6;
padding: 14px 16px; background: var(--sand); border-radius: 8px;
border-left: 3px solid var(--amber);
}
/* RIGHT */
.right-panel {
padding: 48px 40px;
display: flex; flex-direction: column;
}
.idle-state {
flex: 1; display: flex; flex-direction: column;
align-items: center; justify-content: center;
text-align: center; gap: 16px; opacity: 0.45;
}
.idle-icon {
width: 64px; height: 64px; background: var(--sand); border-radius: 50%;
display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.idle-state h3 { font-family: 'Libre Baskerville', serif; font-size: 18px; color: var(--navy); }
.idle-state p { font-size: 14px; color: var(--muted); max-width: 260px; line-height: 1.6; }
.result-card {
display: none; flex-direction: column; gap: 24px;
animation: fadeUp 0.4s ease;
}
@keyframes fadeUp {
from { opacity: 0; transform: translateY(12px); }
to { opacity: 1; transform: translateY(0); }
}
.result-card.visible { display: flex; }
.classification-banner {
border-radius: 14px; padding: 24px;
display: flex; align-items: center; gap: 16px;
position: relative; overflow: hidden;
}
.classification-banner::before {
content: ''; position: absolute; inset: 0; opacity: 0.07;
background-image: repeating-linear-gradient(45deg, currentColor 0, currentColor 1px, transparent 0, transparent 50%);
background-size: 8px 8px;
}
.tier-icon {
width: 52px; height: 52px; border-radius: 50%;
display: flex; align-items: center; justify-content: center;
font-size: 22px; flex-shrink: 0;
background: rgba(255,255,255,0.25);
}
.tier-info { flex: 1; }
.tier-name { font-family: 'Libre Baskerville', serif; font-size: 22px; font-weight: 700; line-height: 1.2; }
.tier-subtitle { font-size: 13px; margin-top: 4px; opacity: 0.85; }
.banner-emergency { background: #FEF2F2; color: var(--red); }
.banner-high { background: #FFF7ED; color: #92400E; }
.banner-moderate { background: #EFF6FF; color: #1E40AF; }
.banner-watch { background: #F5F3FF; color: var(--purple); }
.banner-low { background: #F0FDF4; color: var(--green); }
.action-section { background: var(--navy); border-radius: 14px; padding: 22px 24px; color: #fff; }
.action-section h3 {
font-size: 11px; font-weight: 600; text-transform: uppercase;
letter-spacing: 1.5px; color: #8FA8BF; margin-bottom: 10px;
}
.action-text { font-size: 15px; line-height: 1.65; color: #E8F0F8; }
.workup-section { background: var(--sand); border-radius: 14px; padding: 22px 24px; }
.workup-section h3 {
font-size: 11px; font-weight: 600; text-transform: uppercase;
letter-spacing: 1.5px; color: var(--muted); margin-bottom: 14px;
}
.workup-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.workup-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.5; }
.workup-check {
width: 18px; height: 18px; border-radius: 4px; background: var(--teal);
flex-shrink: 0; margin-top: 1px;
display: flex; align-items: center; justify-content: center;
}
.workup-check svg { width: 11px; height: 11px; }
.features-section { display: flex; flex-direction: column; gap: 10px; }
.features-section h3 {
font-size: 11px; font-weight: 600; text-transform: uppercase;
letter-spacing: 1.5px; color: var(--muted); margin-bottom: 2px;
}
.feature-tag {
display: inline-flex; align-items: center; gap: 7px;
background: var(--teal-lt); border: 1px solid rgba(10,123,116,0.2);
color: #065F5A; font-size: 13px; font-weight: 500;
padding: 7px 12px; border-radius: 20px; margin: 3px 4px 3px 0;
}
.feature-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); flex-shrink: 0; }
.lp-feature-tag {
display: inline-flex; align-items: center; gap: 7px;
background: #F5F3FF; border: 1px solid rgba(92,58,140,0.2);
color: #5B21B6; font-size: 13px; font-weight: 500;
padding: 7px 12px; border-radius: 20px; margin: 3px 4px 3px 0;
}
.lp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--purple); flex-shrink: 0; }
.lp-pill {
background: var(--purple); color: #fff;
font-size: 10px; font-weight: 600;
padding: 2px 8px; border-radius: 10px;
text-transform: uppercase; letter-spacing: 0.5px;
}
.temporal-note {
background: #FFFBEB; border: 1px solid #FCD34D; border-radius: 8px;
padding: 10px 14px; font-size: 13px; color: #78350F; line-height: 1.5;
}
.reset-btn {
align-self: flex-end; background: none;
border: 1.5px solid var(--border); border-radius: 8px;
padding: 8px 16px; font-family: 'DM Sans', sans-serif;
font-size: 13px; color: var(--muted);
cursor: pointer; transition: border-color 0.15s, color 0.15s;
margin-top: auto;
}
.reset-btn:hover { border-color: var(--navy); color: var(--navy); }
footer {
background: var(--navy); padding: 16px 40px;
display: flex; align-items: center; justify-content: space-between;
border-top: 1px solid rgba(255,255,255,0.08);
}
footer p { font-size: 12px; color: #5A7A99; }
.footer-credits { font-size: 12px; color: #5A7A99; text-align: right; line-height: 1.5; }
@media (max-width: 768px) {
main { grid-template-columns: 1fr; }
.left-panel { border-right: none; border-bottom: 1px solid var(--border); padding: 32px 24px; }
.right-panel { padding: 32px 24px; }
header { padding: 20px 24px; }
.header-badge { display: none; }
footer { flex-direction: column; gap: 6px; text-align: center; }
}
</style>
</head>
<body>
<header>
<div class="logo-mark">AQ</div>
<div class="header-text">
<h1>AxonIQ</h1>
<p>MS Symptom Analysis · Ocular Domain · v8.0 · Python Backend</p>
</div>
<div class="header-badge">Clinical Decision Support</div>
</header>
<main>
<div class="left-panel">
<div>
<div class="section-label">Describe your symptoms</div>
<textarea
class="symptom-textarea" id="symptomInput"
placeholder="Describe your symptoms in plain language. For example:
'My left eye has been blurry for the past 3 days. Colors look washed out — reds especially. It hurts when I move my eye. I also feel like the room is spinning when I try to focus.'"
oninput="updateChar()" maxlength="3000"
></textarea>
<div class="char-count"><span id="charCount">0</span> / 3000</div>
</div>
<div class="example-prompts">
<div class="section-label">Try an example</div>
<button class="example-btn" onclick="loadExample(0)">
<strong>Optic Neuritis</strong>
Left eye dimming, pain behind the eye worse when looking side-to-side. Colors washed out.
</button>
<button class="example-btn" onclick="loadExample(1)">
<strong>Brainstem / Double Vision</strong>
Woke up seeing double. Eyes feel jiggly. Poor balance — feels like being on a boat.
</button>
<button class="example-btn" onclick="loadExample(2)">
<strong>Lhermitte's Sign</strong>
Sharp electric shock runs down my spine whenever I bend my neck forward to look at my phone.
</button>
<button class="example-btn" onclick="loadExample(3)">
<strong>Low-Priority Signals</strong>
Sleeping poorly, restless legs every night. Feel much worse in hot weather. Constant ringing in both ears.
</button>
</div>
<div class="error-banner" id="errorBanner"></div>
<button class="analyse-btn" id="analyseBtn" onclick="runAnalysis()">
<div class="spinner" id="spinner"></div>
<span class="btn-label" id="btnLabel">Analyse Symptoms</span>
</button>
<div class="disclaimer">
<strong>⚠️ Clinical Decision Support Only</strong> — This tool is not a diagnosis.
All outputs must be reviewed by a qualified clinician.
MS workup includes MRI (orbits/brain/spine), LP for oligoclonal bands, and serum NMO/MOGAD assays.
</div>
</div>
<div class="right-panel">
<div class="idle-state" id="idleState">
<div class="idle-icon">🔬</div>
<h3>Ready to analyse</h3>
<p>Enter your symptoms on the left and click Analyse Symptoms.</p>
<p style="font-size:12px;color:#999;margin-top:4px;">Powered by Python NLP backend with NegEx negation detection</p>
</div>
<div class="result-card" id="resultCard">
<div class="classification-banner" id="classificationBanner">
<div class="tier-icon" id="tierIcon"></div>
<div class="tier-info">
<div class="tier-name" id="tierName"></div>
<div class="tier-subtitle" id="tierSubtitle"></div>
</div>
</div>
<!-- RECOMMENDED ACTION SECTION (commented out — content moved to Symptoms Identified)
<div class="action-section">
<h3>Recommended Action</h3>
<div class="action-text" id="actionText"></div>
</div>
-->
<div class="workup-section" id="workupSection" style="display:none">
<h3>Suggested Clinical Workup</h3>
<ul class="workup-list" id="workupList"></ul>
</div>
<div class="features-section" id="featuresSection" style="display:none">
<h3>Symptoms Identified</h3>
<div id="actionText" style="font-size:14px;line-height:1.65;color:var(--muted);margin-bottom:12px;padding:12px 14px;background:var(--teal-lt);border-radius:8px;border-left:3px solid var(--teal);"></div>
<div id="featureTags"></div>
<div id="lpSection" style="display:none;margin-top:10px;">
<div style="display:flex;align-items:center;gap:8px;margin-bottom:8px;">
<span style="font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:1.5px;color:var(--muted);">Additional signals</span>
<span class="lp-pill">low priority</span>
</div>
<div id="lpTags"></div>
</div>
</div>
<div id="temporalNotes"></div>
<button class="reset-btn" onclick="resetInterface()">← New Assessment</button>
</div>
</div>
</main>
<footer>
<p>AxonIQ v9.0 · FastAPI · spaCy + NegEx · LangGraph Agentic AI</p>
<div class="footer-credits">
Domain Expert: Dr. Avasarala, MD PhD, UKY, Lexington KY USA &nbsp;·&nbsp;
Lead AI Architect: Raghu Gangolu, NITW, Telangana India &nbsp;·&nbsp;
Principal Investigator: Dr. Kadambari, PhD, NITW, Telangana India
</div>
</footer>
<script>
// API base URL — change this to your deployed server URL
const API_BASE = window.location.origin;
const EXAMPLES = [
"My left eye has been dimming for 3 days. It feels like I am looking through dirty water. The colors look washed out, especially reds. There is an ache behind my eye that gets worse when I move my eye side to side.",
"I woke up this morning and I am seeing double. My eyes feel jiggly and crooked. I feel like I am on a boat — poor balance when walking. The room seems to be wobbling when I try to focus.",
"Every time I bend my neck forward to look at my phone, a sharp electric shock runs down my spine and into both my legs. It has been happening for 2 weeks.",
"I have been sleeping really poorly for months — restless legs every night. I feel significantly worse in hot weather. I also have a constant ringing in both ears.",
];
const TIER_ICONS = {
CRITICAL_EMERGENCY: "🚨",
HIGH: "⚠",
MODERATE: "●",
WATCH: "◐",
LOW: "○",
};
const TIER_BANNER_CLASS = {
CRITICAL_EMERGENCY: "banner-emergency",
HIGH: "banner-high",
MODERATE: "banner-moderate",
WATCH: "banner-watch",
LOW: "banner-low",
};
function loadExample(idx) {
document.getElementById("symptomInput").value = EXAMPLES[idx];
updateChar();
}
function updateChar() {
document.getElementById("charCount").textContent =
document.getElementById("symptomInput").value.length;
}
function showError(msg) {
const el = document.getElementById("errorBanner");
el.textContent = msg;
el.classList.add("visible");
}
function hideError() {
document.getElementById("errorBanner").classList.remove("visible");
}
function resetInterface() {
document.getElementById("idleState").style.display = "";
document.getElementById("resultCard").classList.remove("visible");
document.getElementById("symptomInput").value = "";
updateChar();
hideError();
}
async function runAnalysis() {
const text = document.getElementById("symptomInput").value.trim();
if (!text || text.length < 5) {
document.getElementById("symptomInput").focus();
return;
}
hideError();
const btn = document.getElementById("analyseBtn");
btn.classList.add("loading");
btn.disabled = true;
document.getElementById("btnLabel").textContent = "Analysing…";
try {
const res = await fetch(`${API_BASE}/classify`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text }),
});
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err.detail || `Server error ${res.status}`);
}
const data = await res.json();
renderResult(data);
} catch (e) {
showError(
`Could not reach the analysis server: ${e.message}. ` +
`Make sure the Python backend is running on ${API_BASE}`
);
} finally {
btn.classList.remove("loading");
btn.disabled = false;
document.getElementById("btnLabel").textContent = "Analyse Symptoms";
}
}
function renderResult(data) {
const banner = document.getElementById("classificationBanner");
banner.className = "classification-banner " + (TIER_BANNER_CLASS[data.tier] || "banner-low");
document.getElementById("tierIcon").textContent = TIER_ICONS[data.tier] || "○";
document.getElementById("tierName").textContent = data.tier_label;
document.getElementById("tierSubtitle").textContent = data.tier_subtitle;
document.getElementById("actionText").textContent = data.action;
// Workup
<!-- const workupSection = document.getElementById("workupSection");-->
<!-- if (data.workup && data.workup.length > 0 && data.tier !== "LOW") {-->
<!-- workupSection.style.display = "";-->
<!-- document.getElementById("workupList").innerHTML = data.workup-->
<!-- .map(item => `-->
<!-- <li>-->
<!-- <div class="workup-check">-->
<!-- <svg viewBox="0 0 11 11" fill="none">-->
<!-- <path d="M2 5.5L4.5 8L9 3" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>-->
<!-- </svg>-->
<!-- </div>-->
<!-- <span>${item}</span>-->
<!-- </li>-->
<!-- `).join("");-->
<!-- } else {-->
<!-- workupSection.style.display = "none";-->
<!-- }-->sy
// Features
const std = (data.features || []).filter(f => f.priority === "standard");
const lp = (data.features || []).filter(f => f.priority === "low");
const featuresSection = document.getElementById("featuresSection");
if (data.action || std.length > 0 || lp.length > 0) {
featuresSection.style.display = "";
document.getElementById("featureTags").innerHTML = std
.map(f => `<span class="feature-tag"><span class="feature-dot"></span>${f.label}</span>`)
.join("");
const lpSection = document.getElementById("lpSection");
if (lp.length > 0) {
lpSection.style.display = "";
document.getElementById("lpTags").innerHTML = lp
.map(f => `<span class="lp-feature-tag"><span class="lp-dot"></span>${f.label}</span>`)
.join("");
} else {
lpSection.style.display = "none";
}
} else {
featuresSection.style.display = "none";
}
// Temporal
const temporalDiv = document.getElementById("temporalNotes");
temporalDiv.innerHTML = (data.temporal_notes || [])
.map(n => `<div class="temporal-note">⚠️ ${n}</div>`)
.join("");
document.getElementById("idleState").style.display = "none";
const card = document.getElementById("resultCard");
card.classList.add("visible");
card.scrollIntoView({ behavior: "smooth", block: "start" });
}
document.addEventListener("DOMContentLoaded", () => {
document.getElementById("symptomInput").addEventListener("keydown", e => {
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) runAnalysis();
});
});
</script>
</body>
</html>