Files
NextEdu/src/modules/diagnostic/components/confidence-utils.ts
SpecialX 9ceb2b7b67 feat(diagnostic): add export, stats service, and confidence utils
- Add export module for diagnostic report data export

- Add stats-service for diagnostic analytics aggregation

- Add confidence-utils for diagnostic confidence score calculations
2026-06-23 17:37:58 +08:00

32 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* v4-P3-7: 诊断报告数据置信度工具。
*
* 置信度等级用于指示报告基于的数据量是否充足,帮助教师判断报告可信度。
* 提取到独立文件供 report-list 和 student-diagnostic-view 共享,避免重复定义。
*/
import type { DiagnosticReportWithDetails } from "../types"
export type ConfidenceLevel = "high" | "medium" | "low" | "insufficient"
/**
* 根据报告数据计算置信度。
* 简化方案overallScore === null 表示无数据insufficient
* 否则视为高置信度high
* 后续可扩展为基于 totalQuestions 等数据量字段的多级判断。
*/
export function getConfidenceLevel(report: DiagnosticReportWithDetails): ConfidenceLevel {
if (report.overallScore === null) return "insufficient"
return "high"
}
export const confidenceBadgeVariant: Record<
ConfidenceLevel,
"default" | "secondary" | "destructive" | "outline"
> = {
high: "default",
medium: "secondary",
low: "destructive",
insufficient: "outline",
}