feat: ajout viewer Flask CIM-10 avec config Ollama centralisée et chronométrage
Ajoute une interface web Flask pour visualiser les dossiers médicaux CIM-10, avec temps de traitement par PDF, sélecteur de modèle Ollama, et centralisation de la config Ollama dans src/config.py. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
258
src/viewer/templates/base.html
Normal file
258
src/viewer/templates/base.html
Normal file
@@ -0,0 +1,258 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}Viewer CIM-10{% endblock %} — T2A</title>
|
||||
<style>
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
background: #f1f5f9;
|
||||
color: #1e293b;
|
||||
display: flex;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* Sidebar */
|
||||
.sidebar {
|
||||
width: 280px;
|
||||
min-width: 280px;
|
||||
background: #0f172a;
|
||||
color: #cbd5e1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.sidebar-header {
|
||||
padding: 1.25rem 1rem;
|
||||
border-bottom: 1px solid #1e293b;
|
||||
}
|
||||
.sidebar-header h1 {
|
||||
font-size: 1.1rem;
|
||||
color: #e2e8f0;
|
||||
font-weight: 700;
|
||||
}
|
||||
.sidebar-header p {
|
||||
font-size: 0.75rem;
|
||||
color: #64748b;
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
.sidebar-nav {
|
||||
flex: 1;
|
||||
padding: 0.75rem 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.sidebar-nav .group-title {
|
||||
padding: 0.5rem 1rem 0.25rem;
|
||||
font-size: 0.65rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
color: #475569;
|
||||
font-weight: 700;
|
||||
}
|
||||
.sidebar-nav a {
|
||||
display: block;
|
||||
padding: 0.4rem 1rem;
|
||||
color: #94a3b8;
|
||||
text-decoration: none;
|
||||
font-size: 0.8rem;
|
||||
border-left: 3px solid transparent;
|
||||
transition: all 0.15s;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.sidebar-nav a:hover {
|
||||
color: #e2e8f0;
|
||||
background: #1e293b;
|
||||
border-left-color: #3b82f6;
|
||||
}
|
||||
|
||||
/* Admin section */
|
||||
.sidebar-admin {
|
||||
padding: 1rem;
|
||||
border-top: 1px solid #1e293b;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.sidebar-admin label {
|
||||
display: block;
|
||||
margin-bottom: 0.35rem;
|
||||
font-weight: 600;
|
||||
color: #94a3b8;
|
||||
font-size: 0.7rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
.sidebar-admin select {
|
||||
width: 100%;
|
||||
padding: 0.4rem;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #334155;
|
||||
background: #1e293b;
|
||||
color: #e2e8f0;
|
||||
font-size: 0.8rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
.sidebar-admin button {
|
||||
width: 100%;
|
||||
padding: 0.45rem;
|
||||
border-radius: 6px;
|
||||
border: none;
|
||||
background: #3b82f6;
|
||||
color: #fff;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.sidebar-admin button:hover { background: #2563eb; }
|
||||
.sidebar-admin .status-msg {
|
||||
margin-top: 0.35rem;
|
||||
font-size: 0.7rem;
|
||||
min-height: 1rem;
|
||||
}
|
||||
|
||||
/* Main content */
|
||||
.main {
|
||||
margin-left: 280px;
|
||||
flex: 1;
|
||||
padding: 2rem;
|
||||
max-width: 1100px;
|
||||
}
|
||||
|
||||
/* Utilities */
|
||||
.card {
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.08);
|
||||
padding: 1.25rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 2px 8px;
|
||||
border-radius: 9999px;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
|
||||
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid #e2e8f0; }
|
||||
th { font-weight: 600; color: #475569; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
|
||||
tr.anomalie { background: #fef2f2; }
|
||||
details { margin-top: 0.35rem; }
|
||||
details summary {
|
||||
cursor: pointer;
|
||||
font-size: 0.75rem;
|
||||
color: #3b82f6;
|
||||
}
|
||||
details pre {
|
||||
font-size: 0.75rem;
|
||||
background: #f8fafc;
|
||||
padding: 0.5rem;
|
||||
border-radius: 6px;
|
||||
margin-top: 0.25rem;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
h2 { font-size: 1.1rem; margin-bottom: 0.75rem; color: #0f172a; }
|
||||
h3 { font-size: 0.95rem; margin-bottom: 0.5rem; color: #334155; }
|
||||
.info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.info-item label { display: block; font-size: 0.7rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
|
||||
.info-item span { font-size: 0.9rem; }
|
||||
.section { margin-bottom: 1.5rem; }
|
||||
ul.bullet { list-style: disc; padding-left: 1.5rem; font-size: 0.85rem; }
|
||||
ul.bullet li { margin-bottom: 0.25rem; }
|
||||
a.back { font-size: 0.85rem; color: #3b82f6; text-decoration: none; }
|
||||
a.back:hover { text-decoration: underline; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Sidebar -->
|
||||
<aside class="sidebar">
|
||||
<div class="sidebar-header">
|
||||
<h1>T2A Viewer</h1>
|
||||
<p>Visualisation CIM-10</p>
|
||||
</div>
|
||||
<nav class="sidebar-nav" id="sidebar-nav">
|
||||
{% block sidebar %}{% endblock %}
|
||||
</nav>
|
||||
<div class="sidebar-admin">
|
||||
<label for="model-select">Modèle Ollama</label>
|
||||
<select id="model-select"><option>Chargement…</option></select>
|
||||
<button id="model-apply">Appliquer</button>
|
||||
<div class="status-msg" id="model-status"></div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<!-- Main -->
|
||||
<div class="main">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
const sel = document.getElementById('model-select');
|
||||
const btn = document.getElementById('model-apply');
|
||||
const status = document.getElementById('model-status');
|
||||
|
||||
function loadModels() {
|
||||
fetch('/admin/models')
|
||||
.then(r => r.json())
|
||||
.then(d => {
|
||||
sel.innerHTML = '';
|
||||
if (d.models && d.models.length) {
|
||||
d.models.forEach(m => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = m;
|
||||
opt.textContent = m;
|
||||
if (m === d.current) opt.selected = true;
|
||||
sel.appendChild(opt);
|
||||
});
|
||||
} else {
|
||||
sel.innerHTML = '<option>Aucun modèle</option>';
|
||||
}
|
||||
})
|
||||
.catch(() => { sel.innerHTML = '<option>Erreur</option>'; });
|
||||
}
|
||||
|
||||
btn.addEventListener('click', function() {
|
||||
const model = sel.value;
|
||||
if (!model || model === 'Aucun modèle' || model === 'Erreur') return;
|
||||
status.textContent = '…';
|
||||
status.style.color = '#94a3b8';
|
||||
fetch('/admin/models', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({model: model})
|
||||
})
|
||||
.then(r => r.json())
|
||||
.then(d => {
|
||||
if (d.ok) {
|
||||
status.textContent = 'Modèle appliqué';
|
||||
status.style.color = '#16a34a';
|
||||
} else {
|
||||
status.textContent = d.error || 'Erreur';
|
||||
status.style.color = '#dc2626';
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
status.textContent = 'Erreur réseau';
|
||||
status.style.color = '#dc2626';
|
||||
});
|
||||
});
|
||||
|
||||
loadModels();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user