Files
silk/server-go/internal/service/cross_validate.go
T

35 lines
1.3 KiB
Go
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.
package service
// CrossValidate 交叉验证:AI 检测结果 vs LAMP 检测结果(规格书:一致→确认诊断;不一致→升级专家会诊)
func CrossValidate(aiClass, lampResult string, lampDiseases []string) (bool, string) {
switch {
case lampResult == "invalid":
return false, "LAMP 判读无效,建议复检或专家会诊"
case aiClass == "":
return false, "未找到关联巡检记录,暂无法交叉验证"
case aiClass == "sick" && lampResult == "positive":
return true, "AI 检出异常与 LAMP 阳性一致,确认诊断"
case aiClass == "healthy" && lampResult == "negative":
return true, "AI 未见异常与 LAMP 阴性一致"
case aiClass == "sick" && lampResult == "negative":
return false, "AI 检出异常但 LAMP 阴性,建议专家会诊"
case aiClass == "healthy" && lampResult == "positive":
return false, "AI 未见异常但 LAMP 阳性,建议专家会诊"
default:
return false, "交叉验证结果待确认"
}
}
// AIClassFromDetections 从巡检检测结果归纳 AI 结论(任一非 healthy 视为 sick
func AIClassFromDetections(detections []AIDetection) string {
if len(detections) == 0 {
return ""
}
for _, d := range detections {
if d.ClassName != "healthy" {
return "sick"
}
}
return "healthy"
}