Pharmaceutical Monitoring Plan Generator(药品药学监护计划生成器)
Overview
Generate two Word documents for any drug–population combination:
1. Comprehensive Monitoring Plan(完整版监护计划)— evidence-based, with priority tiers (P0–P3), drug info, baseline assessment, dynamic monitoring, references
2. Quick-Reference Handbook(临床速查手册)— bedside action card format, 7 modules, printable
Both documents include Vancouver-style numbered references verified against literature search results.
Required Inputs
Before starting, confirm (or ask the user for) these parameters:
| Parameter | Description | Example |
|---|---|---|
drug_name |
Generic name of the drug (Chinese preferred) | 枸橼酸咖啡因注射液 |
drug_name_en |
English generic name | Caffeine citrate injection |
population |
Target patient population | 早产儿 (胎龄 < 34周) |
indication |
Primary indication | 早产儿呼吸暂停(AOP) |
output_dir |
Directory for output .docx files | (default: current workspace) |
Workflow(7-Step SOP)
Execute the following steps in order. Each step builds on the previous.
Step 1: Literature Search(文献检索)
Conduct systematic web searches to gather evidence for the drug–population pair. Search in both Chinese and English. Collect at minimum 10–15 references covering:
- RCTs / landmark trials — the highest-level evidence for this drug in this population
- Guidelines / expert consensus — Chinese (中华医学会/相关学组) and international (WHO, AAP, ESC, NICE, etc.)
- Systematic reviews / meta-analyses — Cochrane, JAMA, BMJ, specialty journals
- PK/PD studies — pharmacokinetics, therapeutic drug monitoring (TDM) data
- Safety / ADR literature — common adverse reactions, organ-specific effects
- Drug interaction studies — CYP metabolism, transporter interactions
Search queries (adapt to the specific drug):
1. "{drug_name_en}" "{population_en}" guidelines systematic review 2023 2024
2. "{drug_name_en}" pharmacokinetics "{population_en}" therapeutic drug monitoring
3. "{drug_name}" "{population}" 指南 专家共识 诊疗建议
4. "{drug_name_en}" adverse effects safety "{population_en}" review
5. "{drug_name}" "{population}" 药物相互作用 CYP
Verification rule: For each reference, verify existence via DOI, PubMed ID, or journal website URL. Never fabricate citations. If a reference cannot be verified, discard it and find a replacement.
Step 2: Evidence Synthesis & Priority Assignment(证据整合与优先级分级)
Organize all collected evidence into a structured knowledge base, then assign monitoring priority tiers using the "Frequency × Severity × Clinical Operability" framework:
| Priority | Definition | Criteria |
|---|---|---|
| P0 — Pre-prescription checkpoint | Must verify BEFORE first dose | Dosage errors, contraindications, critical drug interactions, administration route/speed |
| P1 — Daily/shift (bedside) | High frequency or severe consequence, zero-cost monitoring | Most common ADR, core efficacy indicator, severe ADR early detection |
| P2 — Periodic (3–7 days) | Moderate frequency, requires lab/assessment | Feeding tolerance, weight, blood glucose, efficacy assessment at key time points |
| P3 — As-needed (specific triggers) | Low frequency, requires special conditions | TDM (only when indicated), renal/hepatic function, EEG, specialized tests |
Key principles:
- The most common medication error for this drug → P0
- The most frequent ADR with bedside-visible signs → P1
- TDM is P3 unless the drug has a narrow therapeutic index
- Any monitoring already covered by routine ICU/NICU care → do not duplicate; just reference it
Step 3: Generate Comprehensive Monitoring Plan Word Document(生成完整版)
Run scripts/generate_full_plan.py with a JSON data file containing the structured monitoring content. See references/template_data_format.md for the JSON schema.
The full-plan document includes these sections:
1. Priority tier legend (P0–P3)
2. Part 1: Pre-prescription checkpoints (P0)
3. Part 2: Dynamic monitoring — P1 (daily), P2 (periodic), P3 (as-needed)
4. Part 3: Drug information & standard dosing regimen
5. Part 4: Baseline assessment
6. Part 5: Key time-node assessments
7. Part 6: Discontinuation evaluation
8. Part 7: Priority overview table (quick reference card)
9. Part 8: Monitoring record template
9. Part 9: Patient/family education
10. References (Vancouver numbered format)
Step 4: Generate Quick-Reference Handbook Word Document(生成速查手册)
Run scripts/generate_handbook.py with the same JSON data file.
The handbook document includes 7 modules (action-oriented, bedside-ready):
1. Dosing decision quick-reference
2. Pre-prescription checklist (6–8 red-line items)
3. Daily monitoring action card (P1/P2/P3 rows, 5 columns: what to watch / how to check / normal / abnormal → action)
4. Key time nodes (5 decision points)
5. Drug interaction warning card
6. Bedside monitoring record form (single-page printable with signature area)
7. Family education talking points
8. References (abbreviated, same numbering as full plan)
Step 5: Reference Cross-Check(参考文献交叉校验)
After generating both documents, run scripts/verify_refs.py to:
1. Extract all [N] citation numbers from tables and paragraphs in both .docx files
2. Extract all reference entries from the end of both documents
3. Verify: every cited number has a matching reference, and every reference is cited at least once
4. Report any discrepancies and fix them
Step 5b: Package Insert Calibration(说明书校准)⭐ NEW
Purpose: After the monitoring plan is generated and references are verified, calibrate all monitoring content against the official drug package insert (PI / 药品说明书) to ensure there are no factual contradictions with the approved labeling.
Why this step matters:
- Monitoring plans integrate evidence from multiple sources (guidelines, RCTs, expert consensus) that may differ from or extend beyond the approved labeling.
- Any contradiction between the monitoring plan and the official PI must be explicitly labeled as 超说明书用药 with documented evidence and informed consent requirements.
- This protects clinical staff and patients, and ensures the plan is legally and medically defensible.
How to obtain the package insert:
1. NMPA official database (首选): https://www.nmpa.gov.cn/datasearch/home-index.html — search the exact drug name, click "说明书"
2. 药智网: https://db.yaozh.com/ — supports full-text PI search with manufacturer version filtering
3. 丁香园用药助手: https://drugs.dxy.cn/
4. For imported drugs (FDA label): https://labels.fda.gov/
Save the PI as a .txt or .docx file. Then run scripts/calibrate_pi.py:
python scripts/calibrate_pi.py \
--data <json_path> \
--pi <package_insert_txt_or_docx_path> \
--output <report_docx_path>
If no PI file is available, run without --pi; the script will print an online search guide and generate a report with all 7 domains marked as NEEDS REVIEW (human verification required).
7 Calibration Domains:
| Domain | Content | Auto-check |
|---|---|---|
| D1 | 适应证与禁忌证 | 关键词匹配;超说明书适应证标注 |
| D2 | 剂量与给药方案 | 剂量数值一致性;差异标注来源 |
| D3 | 给药途径与溶媒 | 给药方式冲突检测 |
| D4 | 药物相互作用 | 超出说明书的相互作用标注来源 |
| D5 | 不良反应谱 | P1监护项与禁忌章节交叉核查;建议优先级升级 |
| D6 | 特殊人群(新生儿/早产儿) | 新生儿禁用/慎用标注;超说明书标识 |
| D7 | TDM目标范围 | 治疗浓度数值一致性;差异注明文献来源 |
Verdict interpretation:
- ✅ PASS — No discrepancy detected; proceed.
- ⚠️ WARNING — Difference found; may be evidence-based extension beyond PI. Must be reviewed by pharmacist + physician and labeled accordingly.
- ❌ CONFLICT — Direct contradiction with PI (e.g., contraindicated route used, prohibited population). Must be corrected before clinical use.
- 🔍 NEEDS REVIEW — No PI text provided; human review required.
Action rules after calibration:
- For each ⚠️ WARNING: add a footnote ※超说明书用药,依据:[文献来源] in the monitoring plan.
- For each ❌ CONFLICT: correct the monitoring plan immediately; do not deliver until resolved.
- The calibration report .docx (with sign-off table for pharmacist + physician) must be kept as a documentation artifact.
Important: This step is AI-assisted only. All flagged items must be reviewed and signed off by an experienced clinical pharmacist and attending physician before the plan is used clinically.
Step 6: Deliver & Summarize(交付与总结)
Present both files to the user via open_result_view and deliver_attachments. Provide a concise summary:
- Total references count and evidence level distribution
- Key P0 items (most critical safety checkpoints)
- Key P1 items (most common ADR / core efficacy monitoring)
- Notable clinical insights from the literature search
Script Usage
All scripts require python-docx (pip install python-docx).
generate_full_plan.py
python scripts/generate_full_plan.py --data <path_to_json> --output <output_docx_path>
generate_handbook.py
python scripts/generate_handbook.py --data <path_to_json> --output <output_docx_path>
verify_refs.py
python scripts/verify_refs.py <docx_path_1> <docx_path_2> ...
calibrate_pi.py(说明书校准,Step 5b)
# With PI file (recommended):
python scripts/calibrate_pi.py \
--data <path_to_json> \
--pi <package_insert.txt_or_docx> \
--output <drug_name_校准报告.docx>
# Without PI file (generates NEEDS REVIEW report + prints online search guide):
python scripts/calibrate_pi.py --data <path_to_json>
Output: A Word report with 7-domain calibration table, suggested corrections, human review checklist, and sign-off block for pharmacist + physician.
Data Format
The JSON data file follows this schema (see references/template_data_format.md for full specification):
{
"drug": {
"name_cn": "药品中文名",
"name_en": "English generic name",
"category": "药理分类",
"mechanism": "作用机制",
"indication_primary": "主要适应证",
"indication_secondary": ["次要适应证1", "次要适应证2"],
"loading_dose": "负荷剂量描述",
"maintenance_dose": "维持剂量描述",
"dose_adjustments": [
{"scenario": "情境", "adjustment": "调整方案"}
],
"administration": [
{"item": "给药途径/速度/溶媒等", "requirement": "要求"}
],
"drug_interactions": [
{"drug": "合并药物", "interaction": "相互作用", "action": "处置建议"}
],
"dose_conversion_note": "剂量换算注意事项(如有)"
},
"population": {
"name": "目标人群描述",
"key_chars": ["特征1", "特征2"]
},
"monitoring": {
"p0_prescription_checks": [
{"item": "核查项", "risk": "常见错误/风险", "method": "核查方法", "refs": ["[1]","[2]"]}
],
"p1_daily": [
{"category": "监护类别", "items": [
{"content": "具体监护内容", "frequency": "频率", "threshold": "触发阈值/正常标准", "action": "异常处置", "refs": ["[3]"]}
], "clinical_context": "简述该类监护的临床背景"}
],
"p2_periodic": [
{"category": "监护类别", "items": [
{"content": "具体监护内容", "frequency": "频率", "threshold": "触发阈值", "action": "异常处置", "refs": ["[4]"]}
]}
],
"p3_as_needed": [
{"category": "监护类别", "items": [
{"content": "具体监护内容", "frequency": "频率/时机", "threshold": "阈值/指征", "action": "处置", "refs": ["[5]"]}
], "note": "特别说明(如TDM不推荐常规)"}
],
"time_nodes": [
{"time": "时间点", "action": "做什么", "criteria": "判断标准", "next_step": "下一步"}
],
"discontinuation": {
"criteria": ["停药条件1", "停药条件2"],
"warnings": ["不宜停药信号1"],
"post_discontinuation": "停药后监护要点",
"refs": ["[6]","[7]"]
},
"baseline_assessment": {
"patient_info": [
{"item": "评估项", "content": "内容", "significance": "临床意义"}
],
"organ_function": [
{"system": "器官系统", "indicators": "关注指标", "significance": "临床意义"}
]
},
"family_education": [
{"topic": "沟通要点", "content": "通俗版内容"}
]
},
"references": [
{"num": 1, "text": "Author A, Author B. Title. Journal. Year;Vol(Issue):Pages. DOI: xxx."},
{"num": 2, "text": "中华医学会XX学组. XX共识. 中华XX杂志. Year;Vol(Issue):Pages."}
]
}
Quality Checklist
Before delivering, verify:
- [ ] All references are real and verifiable (DOI/PubMed URL confirmed)
- [ ] All [N] in text match reference list (verified by script)
- [ ] P0 items represent the highest-frequency medication errors for this drug
- [ ] P1 items are bedside-feasible with no extra cost
- [ ] TDM priority is justified by therapeutic index width
- [ ] Both documents share the same reference numbering
- [ ] Handbook fits within ~8 A4 pages with narrow margins
- [ ] [Step 5b] calibrate_pi.py has been run; no unresolved ❌ CONFLICT items remain
- [ ] [Step 5b] All ⚠️ WARNING items have been reviewed and labeled (超说明书用药注明依据)
- [ ] [Step 5b] Calibration report .docx generated and ready for pharmacist + physician sign-off
- [ ] [Step 5b] All D6 (special population) issues resolved — neonatal/off-label use explicitly labeled