fix: preserve confirmed followup snapshots and expand flow checks
This commit is contained in:
@@ -33,19 +33,21 @@ def main():
|
||||
output.mkdir(parents=True, exist_ok=True)
|
||||
output.chmod(0o700)
|
||||
manifest = {"generator": "followup-audio-synthetic-v1", "synthetic": True,
|
||||
"recorded_at": "2026-09-29 10:00:00", "fixtures": []}
|
||||
"recorded_at": "2026-09-29 10:00:00", "speech_revision": "ordinary-dialogue-v2", "fixtures": []}
|
||||
words = ["紫色海豚", "水晶风车", "绿色蜻蜓", "银色树叶", "蓝色鲸鱼", "金色河流", "红色石榴", "白色云朵"]
|
||||
with tempfile.TemporaryDirectory(prefix="followup-audio-synthetic-") as temporary:
|
||||
temp = pathlib.Path(temporary)
|
||||
middle_text = "这是纯合成的声音长度测试,不对应任何真实患者。现在继续校验这段音频的可听性。重复的测试语句不是医疗事实,不应反复生成随访记录。"
|
||||
# Synthetic provenance stays in the manifest. The speech must not contradict
|
||||
# the expected task by declaring all reported measurements non-facts.
|
||||
middle_text = "客服说,电话里的声音还清楚吗?患者说,很清楚。客服说,好的,我们继续聊。患者说,好的,您说吧。"
|
||||
run(["say", "-v", args.voice, "-r", "190", "-o", str(temp / "middle.aiff"), middle_text])
|
||||
for case, seconds, systolic, diastolic in (("short", 60, 131, 86), ("medium", 900, 139, 88), ("long", 3598, 147, 91)):
|
||||
head_canary = "".join(secrets.SystemRandom().sample(words, 3))
|
||||
tail_canary = "".join(secrets.SystemRandom().sample(words, 3))
|
||||
while tail_canary == head_canary:
|
||||
tail_canary = "".join(secrets.SystemRandom().sample(words, 3))
|
||||
head = f"这是一段人工合成的音频测试。开始校验词是,{head_canary}。昨天晚上九点,收缩压一百二十六,舒张压八十二。前天下午两点,餐后血糖七点二。"
|
||||
tail = f"现在是这段音频的最后部分。今天早晨七点,收缩压{systolic},舒张压{diastolic}。末尾校验词是,{tail_canary}。合成测试到此结束。"
|
||||
head = f"患者说,我先读三个词,{head_canary}。昨天晚上九点,我测的血压是收缩压一百二十六,舒张压八十二。前天下午两点,我测的餐后血糖是七点二。"
|
||||
tail = f"患者说,我再补充一次测量。今天早晨七点,我的收缩压是{systolic},舒张压是{diastolic}。最后再读三个词,{tail_canary}。客服说,好的,再见。"
|
||||
run(["say", "-v", args.voice, "-r", "190", "-o", str(temp / "head.aiff"), head])
|
||||
run(["say", "-v", args.voice, "-r", "190", "-o", str(temp / "tail.aiff"), tail])
|
||||
filler_seconds = seconds - duration(temp / "head.aiff") - duration(temp / "tail.aiff")
|
||||
|
||||
Reference in New Issue
Block a user