Files
online_sys/frontend_大健康/fix_health11_final.py

169 lines
7.5 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
print("修复health_11的结构...")
# 读取文件
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js', 'r', encoding='utf-8') as f:
content = f.read()
# 备份
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js.backup_health11_fix', 'w', encoding='utf-8') as f:
f.write(content)
# 找到health_11的开始和结束
health11_start = content.find('"id": "health_11"')
if health11_start == -1:
print("未找到health_11")
exit(1)
# 找到industries数组结束
industries_end = content.find('];', health11_start)
# 获取health_11的内容
health11_content = content[health11_start:industries_end]
# 移除所有错误位置的questions
# 1. 找到所有positions
positions_matches = list(re.finditer(r'"id":\s*"health_11_\d+"', health11_content))
# 提取所有position对象
positions = []
for i, match in enumerate(positions_matches):
start = match.start()
# 找到这个position的结束下一个position的开始或positions数组结束
if i < len(positions_matches) - 1:
end = positions_matches[i + 1].start()
else:
# 最后一个position找到它的结束
# 查找requirements数组结束后的'}'
req_end = health11_content.find('"requirements":', start)
if req_end > 0:
# 找到requirements数组的结束
bracket_start = health11_content.find('[', req_end)
bracket_end = health11_content.find(']', bracket_start)
# position对象的结束是']'后的'}'
pos_end = health11_content.find('}', bracket_end)
end = pos_end + 1
else:
end = len(health11_content)
position_obj = health11_content[start:end]
# 移除position内的questions如果有
if '"questions":' in position_obj:
# 找到requirements的结束
req_end_match = re.search(r'"requirements":\s*\[[^\]]*?\]', position_obj)
if req_end_match:
# 保留到requirements结束
clean_position = position_obj[:req_end_match.end()]
# 查找position对象原本的结束'}'
remaining = position_obj[req_end_match.end():]
# 跳过questions内容找到属于position的'}'
# 这需要计算括号平衡
clean_position += '\n }'
else:
clean_position = position_obj
else:
clean_position = position_obj
positions.append(clean_position)
# 重建health_11对象
health11_new = ''' {
"id": "health_11",
"name": "药物研发",
"positions": [
'''
# 添加所有positions
health11_new += ',\n '.join(positions)
# 关闭positions数组
health11_new += '''
],
"questions": [
{
"id": "group_q1",
"question": "二、生物制药特性",
"subQuestions": [
{
"id": "q1",
"question": "生物药物有哪些化学与生物学特性?",
"answer": "生物药物的化学本质可以是蛋白质、多肽、抗体或核酸,分子量大多在数万到数十万之间。它们的稳定性受温度、湿度、光照影响,需要在冷链或特定环境下保存;溶解性与分子量、荷电状态相关;药代动力学则取决于分子大小与代谢通路。"
},
{
"id": "q2",
"question": "体液调控药物有哪些作用?",
"answer": "体液调控药物包括胰岛素(调控血糖)、血液制品(如白蛋白、免疫球蛋白)、促红细胞生成素(刺激红细胞生成)和脂肪因子(调节脂质代谢)。这些药物通过补充或调节人体内源性活性物质,实现代谢平衡、免疫增强和生理调控。"
},
{
"id": "q3",
"question": "生物制药中的主要产品有哪些?",
"answer": "生物制药主要产品包括治疗性蛋白如胰岛素、生长激素单克隆抗体如抗肿瘤药物疫苗如重组疫苗血液制品如凝血因子细胞与基因治疗产品如CAR-T。这些产品广泛应用于肿瘤、免疫、代谢疾病治疗。"
}
]
},
{
"id": "group_q2",
"question": "三、药理学特性",
"subQuestions": [
{
"id": "q4",
"question": "生物制药的药理学特性是什么?",
"answer": "生物制药的药理学特性包括:高特异性(作用于特定靶点或受体);低毒性(较少产生非特异性反应);免疫原性(可能引起抗药抗体);药代动力学复杂(代谢途径多样化);给药途径受限(多为注射给药)。理解这些特性对药物研发至关重要。"
},
{
"id": "q5",
"question": "生物药物的清除途径有哪些?",
"answer": "生物药物主要通过以下途径清除:肾脏滤过(小分子蛋白);肝脏代谢(酶解作用);网状内皮系统吞噬(大分子药物);受体介导的内吞(抗体类);蛋白酶降解(多肽类)。不同药物的清除机制影响其半衰期和给药频率设计。"
},
{
"id": "q6",
"question": "如何评价生物药物的安全性?",
"answer": "生物药物安全性评价包括免疫原性测试抗药抗体检测毒理学研究急性、慢性毒性生殖毒性评估致癌性试验过敏反应监测细胞因子释放综合征评估。这些评价需遵循ICH等国际指南确保临床应用安全。"
}
]
},
{
"id": "group_q3",
"question": "四、生物药物分类",
"subQuestions": [
{
"id": "q7",
"question": "常见的生物药物类型有哪些?",
"answer": "常见生物药物包括重组蛋白药物如干扰素、EPO单克隆抗体如贝伐珠单抗融合蛋白如依那西普多肽激素如GLP-1类似物疫苗如HPV疫苗基因治疗药物细胞治疗产品。每类药物都有独特的作用机制和临床应用。"
},
{
"id": "q8",
"question": "抗体药物的作用机制有哪些?",
"answer": "抗体药物作用机制包括:直接中和(阻断配体-受体结合ADCC效应抗体依赖的细胞毒性CDC效应补体依赖的细胞毒性信号传导阻断免疫检查点抑制药物偶联递送。这些机制使抗体药物在肿瘤、自身免疫疾病治疗中发挥重要作用。"
},
{
"id": "q9",
"question": "核酸类药物的发展现状如何?",
"answer": "核酸药物包括DNA和RNA类已在疫苗如mRNA新冠疫苗、基因治疗CRISPR相关药物中广泛应用。虽然在稳定性、递送效率方面仍存在挑战但发展前景广阔。"
}
]
}
]
}'''
# 替换原内容
content_before = content[:health11_start]
content_after = content[industries_end:]
# 查找health_10的结束
health10_end = content_before.rfind('},')
# 构建新内容
new_content = content_before[:health10_end + 2] + '\n' + health11_new + '\n' + content_after
# 写回文件
with open('/Users/apple/Documents/cursor/教务系统/frontend_大健康/src/mocks/resumeInterviewMock.js', 'w', encoding='utf-8') as f:
f.write(new_content)
print("✓ 修复完成!")