Show annotated and unannotated series counts
This commit is contained in:
@@ -191,6 +191,25 @@ function setSeries(list) {
|
||||
renderSeries();
|
||||
}
|
||||
|
||||
function isSeriesAnnotated(series) {
|
||||
const annotation = series.annotation || {};
|
||||
return Boolean(annotation.skipped || annotation.plain_ct || asList(annotation.body_parts).length || annotation.notes || annotation.ai_model);
|
||||
}
|
||||
|
||||
function refreshStudyAnnotationSummary() {
|
||||
if (!app.study || !app.series.length) return;
|
||||
const annotated = app.series.filter(isSeriesAnnotated).length;
|
||||
const total = app.series.length;
|
||||
const summary = {
|
||||
annotated_series: annotated,
|
||||
unannotated_series: Math.max(0, total - annotated),
|
||||
series_count: total,
|
||||
};
|
||||
Object.assign(app.study, summary);
|
||||
const study = app.studies.find((item) => item.ct_number === app.study.ct_number);
|
||||
if (study) Object.assign(study, summary);
|
||||
}
|
||||
|
||||
async function loadStudies() {
|
||||
const q = encodeURIComponent($("studySearch").value.trim());
|
||||
app.studies = await json(`/api/studies?q=${q}&limit=500`);
|
||||
@@ -211,7 +230,7 @@ function renderStudies() {
|
||||
<strong>${escapeHtml(study.ct_number)}</strong>
|
||||
<span>${escapeHtml(name)} · ${escapeHtml(study.patient_id || "无ID")}</span>
|
||||
<span>${escapeHtml(fmtDate(study.study_date))} ${escapeHtml(fmtTime(study.study_time))} · ${Number(study.dicom_file_count || 0)} 张</span>
|
||||
<span>${Number(study.annotated_series || 0)} 个序列已标注</span>
|
||||
<span>${Number(study.annotated_series || 0)} 个序列已标注,${Number(study.unannotated_series || 0)} 个序列未标注</span>
|
||||
`;
|
||||
button.onclick = () => selectStudy(study.ct_number);
|
||||
list.appendChild(button);
|
||||
@@ -233,6 +252,8 @@ async function selectStudy(ctNumber) {
|
||||
const data = await json(`/api/studies/${encodeURIComponent(ctNumber)}/series`);
|
||||
app.study = data.study;
|
||||
setSeries(data.series || []);
|
||||
refreshStudyAnnotationSummary();
|
||||
renderStudies();
|
||||
if (app.series.length) selectSeries(app.series[0].series_uid);
|
||||
} catch (err) {
|
||||
$("seriesGrid").innerHTML = `<p class="error-line">${escapeHtml(err.message)}</p>`;
|
||||
@@ -509,7 +530,9 @@ function updateLocalAnnotation(annotation) {
|
||||
const index = app.series.findIndex((item) => item.series_uid === app.activeSeries.series_uid);
|
||||
if (index >= 0) app.series[index].annotation = normalized;
|
||||
app.series = sortSeries(app.series);
|
||||
refreshStudyAnnotationSummary();
|
||||
renderSeries();
|
||||
renderStudies();
|
||||
applyAnnotationControls();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user