- Add export module for diagnostic report data export - Add stats-service for diagnostic analytics aggregation - Add confidence-utils for diagnostic confidence score calculations
32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
/**
|
||
* 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",
|
||
}
|