Protocol Deviation Classifier
Clinical trial protocol deviation classification tool, based on GCP and ICH E6 guidelines, automatically determines whether deviations belong to "major deviations" or "minor deviations".
Features
- - Automatic Classification: Automatically determines severity based on deviation description
- Risk Assessment: Assesses impact on subject safety, data integrity, and scientific validity
- Regulatory Basis: Classification basis complies with GCP, ICH E6, and FDA/EMA guidelines
- Report Generation: Generates deviation classification reports that meet regulatory requirements
- Chinese Support: Full support for Chinese clinical trial scenarios
Deviation Classification Standards
Major/Critical Deviation
Deviations that may affect trial data integrity, subject safety, or trial scientific validity:
| Category | Examples |
|---|
| Informed Consent | Performing research procedures without informed consent, using expired/incorrect informed consent forms |
| Inclusion/Exclusion Criteria |
Enrolling subjects who don't meet inclusion criteria, enrolling subjects who meet exclusion criteria |
| Investigational Product | Overdose administration, contraindicated concomitant medication, incorrect route of administration, randomization error |
| Safety | Not performing safety monitoring as required by protocol, missing SAE/SUSAR reports, delayed reporting |
| Blinding | Unblinding by unauthorized personnel, unrecorded emergency unblinding procedures |
| Data Integrity | Falsifying/fabricating data, systematic missing of critical data |
| Prohibited Operations | Violating key operational procedures of trial protocol, not performing key efficacy assessments |
Minor Deviation
Deviations unlikely to affect trial data integrity, subject safety, or trial scientific validity:
| Category | Examples |
|---|
| Visit Window | Slightly exceeding visit time window (e.g., within a few days), delay of non-critical visits |
| Sample Collection |
Minor timing deviations in non-critical sample collection, slight delays in sample processing |
| Questionnaire Completion | Quality of life questionnaires/diary cards submitted a few days late |
| Data Recording | Delays in non-critical data recording, spelling/formatting errors |
| Procedure Execution | Adjustment of secondary procedure execution order, omission of non-critical assessments (e.g., height measurement) |
| Documentation | Delays in source document signatures, missing secondary documents (e.g., non-critical examination reports) |
Usage
Python API
CODEBLOCK0
CLI Usage
CODEBLOCK1
Input Format
JSON Input File Format:
CODEBLOCK2
Output Format
Classification Result:
CODEBLOCK3
Classification Algorithm
Classification based on the following assessment dimensions:
- 1. Subject Safety Impact (Safety Impact)
- None: No impact
- Low: Minor impact
- Medium: Moderate impact
- High: Serious impact
- 2. Data Integrity Impact (Data Integrity Impact)
- None: No impact
- Low: Minor impact on non-critical data
- Medium: Partial impact on critical data
- High: Serious damage to critical data
- 3. Trial Scientific Validity Impact (Scientific Validity Impact)
- None: No impact
- Low: Minor impact on statistical power
- Medium: May affect primary endpoint
- High: Seriously affects trial conclusion
Classification Rules:
- - Any dimension is High → Major Deviation
- Safety dimension is Medium and Data/Science either is Medium+ → Major Deviation
- Other cases → Minor Deviation
Regulatory Basis
- - ICH E6(R2) Good Clinical Practice Guideline
- ICH E6(R3) Good Clinical Practice Guideline (Draft)
- FDA 21 CFR Part 312 (IND Regulations)
- FDA Guidance for Industry: Oversight of Clinical Investigations
- EMA Reflection Paper on Risk Based Quality Management
- NMPA Good Clinical Practice for Drug Clinical Trials
Dependencies
- - Python 3.8+
- No third-party dependencies (pure Python standard library implementation)
Notes
- 1. This tool provides classification recommendations, final determination must be confirmed by clinical quality assurance personnel
- Serious/critical deviations must be reported to sponsor and ethics committee immediately
- It is recommended to regularly review deviation trends and implement CAPA (Corrective and Preventive Actions)
- Classification standards may vary by regulatory agency, trial type, and protocol requirements
Risk Assessment
| Risk Indicator | Assessment | Level |
|---|
| Code Execution | Python/R scripts executed locally | Medium |
| Network Access |
No external API calls | Low |
| File System Access | Read input files, write output files | Medium |
| Instruction Tampering | Standard prompt guidelines | Low |
| Data Exposure | Output files saved to workspace | Low |
Security Checklist
- - [ ] No hardcoded credentials or API keys
- [ ] No unauthorized file system access (../)
- [ ] Output does not expose sensitive information
- [ ] Prompt injection protections in place
- [ ] Input file paths validated (no ../ traversal)
- [ ] Output directory restricted to workspace
- [ ] Script execution in sandboxed environment
- [ ] Error messages sanitized (no stack traces exposed)
- [ ] Dependencies audited
Prerequisites
CODEBLOCK4
Evaluation Criteria
Success Metrics
- - [ ] Successfully executes main functionality
- [ ] Output meets quality standards
- [ ] Handles edge cases gracefully
- [ ] Performance is acceptable
Test Cases
- 1. Basic Functionality: Standard input → Expected output
- Edge Case: Invalid input → Graceful error handling
- Performance: Large dataset → Acceptable processing time
Lifecycle Status
- - Current Stage: Draft
- Next Review Date: 2026-03-06
- Known Issues: None
- Planned Improvements:
- Performance optimization
- Additional feature support
方案偏离分类器
临床试验方案偏离分类工具,基于GCP和ICH E6指南,自动判断偏离属于重大偏离还是轻微偏离。
功能特点
- - 自动分类:根据偏离描述自动判断严重程度
- 风险评估:评估对受试者安全、数据完整性和科学价值的影响
- 法规依据:分类依据符合GCP、ICH E6和FDA/EMA指南
- 报告生成:生成符合监管要求的偏离分类报告
- 中文支持:全面支持中文临床试验场景
偏离分类标准
重大/关键偏离
可能影响试验数据完整性、受试者安全或试验科学价值的偏离:
| 类别 | 示例 |
|---|
| 知情同意 | 未获得知情同意即进行研究操作,使用过期/错误的知情同意书 |
| 入选/排除标准 |
纳入不符合入选标准的受试者,纳入符合排除标准的受试者 |
| 试验用药品 | 超剂量给药,使用禁忌合并用药,给药途径错误,随机错误 |
| 安全性 | 未按方案要求进行安全性监测,漏报SAE/SUSAR,延迟报告 |
| 盲法 | 未经授权人员揭盲,未记录的紧急揭盲程序 |
| 数据完整性 | 伪造/编造数据,关键数据系统性缺失 |
| 禁止操作 | 违反试验方案关键操作流程,未进行关键疗效评估 |
轻微偏离
不太可能影响试验数据完整性、受试者安全或试验科学价值的偏离:
| 类别 | 示例 |
|---|
| 访视窗口 | 略微超出访视时间窗口(如几天内),非关键访视延迟 |
| 样本采集 |
非关键样本采集时间轻微偏差,样本处理轻微延迟 |
| 问卷填写 | 生活质量问卷/日记卡延迟几天提交 |
| 数据记录 | 非关键数据记录延迟,拼写/格式错误 |
| 操作执行 | 次要操作执行顺序调整,遗漏非关键评估(如身高测量) |
| 文件记录 | 源文件签名延迟,缺少次要文件(如非关键检查报告) |
使用方法
Python API
python
from scripts.main import DeviationClassifier
初始化分类器
classifier = DeviationClassifier()
分类单个偏离
result = classifier.classify(
description=受试者访视延迟2天,
deviation_type=访视窗口
)
print(result.classification) # 轻微偏离
print(result.confidence) # 0.92
print(result.rationale) # 分类理由说明
批量分类
deviations = [
{description: 未获得知情同意即采集血样, type: 知情同意},
{description: 生活质量问卷延迟3天提交, type: 数据收集}
]
batch
results = classifier.classifybatch(deviations)
生成报告
report = classifier.generate
report(batchresults)
命令行使用
bash
分类单个偏离
python scripts/main.py classify --description 受试者访视延迟2天 --type 访视窗口
从文件批量分类
python scripts/main.py batch --input deviations.json --output report.json
交互式分类
python scripts/main.py interactive
评估偏离影响
python scripts/main.py assess \
--description 受试者意外服用双倍剂量试验药物 \
--safety-impact high \
--data-impact medium \
--scientific-impact medium
输入格式
JSON输入文件格式:
json
[
{
id: DEV-001,
description: 受试者访视延迟2天,
type: 访视窗口,
occurrence_date: 2024-01-15,
severity_factors: {
safety_impact: none,
data_impact: low,
scientific_impact: low
}
},
{
id: DEV-002,
description: 未获得知情同意即进行采血,
type: 知情同意,
severity_factors: {
safety_impact: high,
data_impact: high,
scientific_impact: high
}
}
]
输出格式
分类结果:
json
{
id: DEV-001,
classification: 轻微偏离,
classification_en: Minor Deviation,
confidence: 0.92,
rationale: 访视时间窗口轻微延迟(2天),不影响受试者安全、数据完整性或试验科学价值。,
risk_factors: {
safety_risk: none,
dataintegrityrisk: low,
scientificvalidityrisk: none
},
regulatory_basis: [
ICH E6(R2) 第4.5节,
GCP 第6.4.4节
],
recommended_actions: [
在文件中记录,
跟踪趋势
]
}
分类算法
基于以下评估维度进行分类:
- 1. 受试者安全影响(Safety Impact)
- 无:无影响
- 低:轻微影响
- 中:中度影响
- 高:严重影响
- 2. 数据完整性影响(Data Integrity Impact)
- 无:无影响
- 低:对非关键数据有轻微影响
- 中:对关键数据有部分影响
- 高:对关键数据造成严重损害
- 3. 试验科学价值影响(Scientific Validity Impact)
- 无:无影响
- 低:对统计效能有轻微影响
- 中:可能影响主要终点
- 高:严重影响试验结论
分类规则:
- - 任一维度为高 → 重大偏离
- 安全维度为中且数据/科学任一为中+ → 重大偏离
- 其他情况 → 轻微偏离
法规依据
- - ICH E6(R2) 药物临床试验质量管理规范指南
- ICH E6(R3) 药物临床试验质量管理规范指南(草案)
- FDA 21 CFR Part 312(IND法规)
- FDA行业指南:临床研究的监督
- EMA基于风险的质量管理反思文件
- NMPA药物临床试验质量管理规范
依赖项
- - Python 3.8+
- 无第三方依赖(纯Python标准库实现)
注意事项
- 1. 本工具提供分类建议,最终判定需由临床质量保证人员确认
- 严重/关键偏离必须立即报告申办方和伦理委员会
- 建议定期审查偏离趋势并实施CAPA(纠正和预防措施)
- 分类标准可能因监管机构、试验类型和方案要求而异
风险评估
| 风险指标 | 评估 | 等级 |
|---|
| 代码执行 | Python/R脚本本地执行 | 中 |
| 网络访问 |
无外部API调用 | 低 |
| 文件系统访问 | 读取输入文件,写入输出文件 | 中 |
| 指令篡改 | 标准提示指南 | 低 |
| 数据泄露 | 输出文件保存到工作区 | 低 |
安全检查清单
- - [ ] 无硬编码凭据或API密钥
- [ ] 无未经授权的文件系统访问(../)
- [ ] 输出不泄露敏感信息
- [ ] 已实施提示注入保护
- [ ] 已验证输入文件路径(无../遍历)
- [ ] 输出目录限制在工作区
- [ ] 在沙盒环境中执行脚本
- [ ] 错误消息已清理(不暴露堆栈跟踪)
- [ ] 已审计依赖项
先决条件
bash
Python依赖项
pip install -r requirements.txt
评估标准
成功指标
- - [ ] 成功执行主要功能
- [ ] 输出符合质量标准
- [ ] 优雅处理边缘情况
- [ ] 性能可接受
测试用例
- 1. 基本功能:标准输入 → 预期输出
- 边缘情况:无效输入 → 优雅错误处理
- 性能:大数据集 → 可接受处理时间
生命周期状态
- - 当前阶段:草案
- 下次审查日期:2026-03-06
- 已知问题:无
- 计划改进:
- 性能优化
- 附加功能支持