eCTD XML Compiler
ID: 197
Automatically convert uploaded drug application documents (Word/PDF) into XML skeleton structure compliant with eCTD 4.0/3.2.2 specifications.
When to Use
- - Use this skill when the task needs Automatically convert uploaded drug application documents (Word/PDF) into XML skeleton structure compliant with eCTD 4.0/3.2.2 specifications.
- Use this skill for academic writing tasks that require explicit assumptions, bounded scope, and a reproducible output format.
- Use this skill when you need a documented fallback path for missing inputs, execution errors, or partial evidence.
Key Features
- - Scope-focused workflow aligned to: Automatically convert uploaded drug application documents (Word/PDF) into XML skeleton structure compliant with eCTD 4.0/3.2.2 specifications.
- Packaged executable path(s):
scripts/main.py. - Reference material available in
references/ for task-specific guidance. - Structured execution path designed to keep outputs consistent and reviewable.
Dependencies
CODEBLOCK0
Example Usage
See ## Usage above for related details.
CODEBLOCK1
Example run plan:
- 1. Confirm the user input, output path, and any required config values.
- Edit the in-file
CONFIG block or documented parameters if the script uses fixed settings. - Run
python scripts/main.py with the validated inputs. - Review the generated output and return the final artifact with any assumptions called out.
Implementation Details
See ## Workflow above for related details.
- - Execution model: validate the request, choose the packaged workflow, and produce a bounded deliverable.
- Input controls: confirm the source files, scope limits, output format, and acceptance criteria before running any script.
- Primary implementation surface:
scripts/main.py. - Reference guidance:
references/ contains supporting rules, prompts, or checklists. - Parameters to clarify first: input path, output path, scope filters, thresholds, and any domain-specific constraints.
- Output discipline: keep results reproducible, identify assumptions explicitly, and avoid undocumented side effects.
Quick Check
Use this command to verify that the packaged script entry point can be parsed before deeper execution.
CODEBLOCK2
Audit-Ready Commands
Use these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.
CODEBLOCK3
Workflow
- 1. Confirm the user objective, required inputs, and non-negotiable constraints before doing detailed work.
- Validate that the request matches the documented scope and stop early if the task would require unsupported assumptions.
- Use the packaged script path or the documented reasoning path with only the inputs that are actually available.
- Return a structured result that separates assumptions, deliverables, risks, and unresolved items.
- If execution fails or inputs are incomplete, switch to the fallback path and state exactly what blocked full completion.
Overview
eCTD (electronic Common Technical Document) is the electronic Common Technical Document standard established by ICH for submitting drug registration applications to regulatory agencies such as FDA and EMA.
This tool parses uploaded drug application documents (Word/PDF) and converts them into XML skeleton structure compliant with eCTD 4.0/3.2.2 specifications.
eCTD Structure
CODEBLOCK4
Usage
CODEBLOCK5
Arguments
| Argument | Description |
|---|
| INLINECODE8 | Input Word/PDF file paths (supports multiple) |
Options
| Option | Short | Description | Default |
|---|
| INLINECODE9 | INLINECODE10 | Output directory path | INLINECODE11 |
| INLINECODE12 |
-m | Target module (m1-m5, auto) |
auto |
|
--region |
-r | Target region (FDA, EMA, ICH) |
ICH |
|
--version |
-v | eCTD version (3.2.2, 4.0) |
4.0 |
|
--dtd-path |
-d | Custom DTD path | Built-in DTD |
|
--validate | | Validate generated XML |
False |
Examples
CODEBLOCK6
Input Document Processing
Supported Formats
- - Microsoft Word (.docx, .doc)
- PDF (.pdf)
Document Parsing Logic
- 1. Title Recognition: Extract heading hierarchy based on font size and style
- TOC Mapping: Auto-recognize section numbers (e.g., 3.2.S.1.1)
- Metadata Extraction: Extract author, date, version, and other information
- Content Classification: Map to corresponding eCTD modules based on keyword matching
Module Auto-Recognition Rules
| Keyword Pattern | Target Module |
|---|
| Administrative, Label, Package Insert | m1 |
| Summary, summary, Overview |
m2 |
| Quality, quality, CMC, API, Drug Product | m3 |
| Nonclinical, Toxicology, Pharmacokinetics | m4 |
| Clinical, clinical, Study, Trial | m5 |
Output Structure
Generated eCTD skeleton contains:
index.xml
Master index file containing references and sequence information for all modules.
Module XML (m1.xml - m5.xml)
XML skeleton for each module, containing:
- - Document hierarchy structure (
<leaf>, <node>) - Cross-references (
<cross-reference>) - Attribute definitions (ID, version, operation type)
MD5 Checksums
MD5 checksum values for each file to ensure integrity.
Installation
CODEBLOCK7
Validation
Using --validate option can validate generated XML:
- - DTD structure validation
- Required elements and attributes check
- Cross-reference integrity check
References
License
MIT License
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
No additional Python packages required.
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
Output Requirements
Every final response should make these items explicit when they are relevant:
- - Objective or requested deliverable
- Inputs used and assumptions introduced
- Workflow or decision path
- Core result, recommendation, or artifact
- Constraints, risks, caveats, or validation needs
- Unresolved items and next-step checks
Error Handling
- - If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.
- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
- If
scripts/main.py fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback. - Do not fabricate files, citations, data, search results, or execution outcomes.
Input Validation
This skill accepts requests that match the documented purpose of ectd-xml-compiler and include enough context to complete the workflow safely.
Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:
INLINECODE31 only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.
References
Response Template
Use the following fixed structure for non-trivial requests:
- 1. Objective
- Inputs Received
- Assumptions
- Workflow
- Deliverable
- Risks and Limits
- Next Checks
If the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.
eCTD XML 编译器
ID: 197
自动将上传的药品申请文档(Word/PDF)转换为符合 eCTD 4.0/3.2.2 规范的 XML 骨架结构。
使用时机
- - 当任务需要自动将上传的药品申请文档(Word/PDF)转换为符合 eCTD 4.0/3.2.2 规范的 XML 骨架结构时,使用此技能。
- 用于需要明确假设、限定范围和可重复输出格式的学术写作任务。
- 当需要针对缺失输入、执行错误或部分证据提供有文档记录的备用路径时,使用此技能。
主要特性
- - 聚焦范围的工作流程,对齐目标:自动将上传的药品申请文档(Word/PDF)转换为符合 eCTD 4.0/3.2.2 规范的 XML 骨架结构。
- 打包的可执行路径:scripts/main.py。
- 参考资料位于 references/ 目录,提供任务特定指导。
- 结构化的执行路径,确保输出一致且可审查。
依赖项
python-docx>=0.8.11 # Word 文档解析
PyPDF2>=3.0.0 # PDF 文本提取
lxml>=4.9.0 # XML 处理
使用示例
相关详情请参见上方的 ## 使用说明。
bash
cd 20260318/scientific-skills/Academic Writing/ectd-xml-compiler
python -m py_compile scripts/main.py
python scripts/main.py --help
示例运行计划:
- 1. 确认用户输入、输出路径及任何必需的配置值。
- 如果脚本使用固定设置,编辑文件内的 CONFIG 块或文档化参数。
- 使用验证后的输入运行 python scripts/main.py。
- 审查生成的输出,并返回最终产物,同时注明所有假设。
实现细节
相关详情请参见上方的 ## 工作流程。
- - 执行模型:验证请求,选择打包的工作流程,生成限定范围的可交付成果。
- 输入控制:在运行任何脚本前,确认源文件、范围限制、输出格式和验收标准。
- 主要实现面:scripts/main.py。
- 参考指南:references/ 目录包含支持性规则、提示或检查清单。
- 需优先明确的参数:输入路径、输出路径、范围过滤器、阈值及任何领域特定约束。
- 输出规范:保持结果可重复,明确标识假设,避免未文档化的副作用。
快速检查
在深入执行前,使用此命令验证打包脚本入口点能否被解析。
bash
python -m py_compile scripts/main.py
审计就绪命令
使用这些具体命令进行验证。它们特意保持自包含,避免使用占位符路径。
bash
python -m py_compile scripts/main.py
python scripts/main.py --help
工作流程
- 1. 在进行详细工作前,确认用户目标、必需输入和不可协商的约束条件。
- 验证请求是否匹配文档化范围,如果任务需要不支持的假设,则提前停止。
- 仅使用实际可用的输入,使用打包脚本路径或文档化的推理路径。
- 返回结构化结果,区分假设、可交付成果、风险和未解决项。
- 如果执行失败或输入不完整,切换到备用路径,并明确说明阻止完整完成的具体原因。
概述
eCTD(电子通用技术文档)是 ICH 制定的电子通用技术文档标准,用于向 FDA、EMA 等监管机构提交药品注册申请。
本工具解析上传的药品申请文档(Word/PDF),并将其转换为符合 eCTD 4.0/3.2.2 规范的 XML 骨架结构。
eCTD 结构
eCTD/
├── m1/ # 模块1:行政信息和处方信息(区域特定)
│ ├── m1.xml
│ └── ...
├── m2/ # 模块2:CTD 总结
│ ├── m2.xml
│ └── ...
├── m3/ # 模块3:质量
│ ├── m3.xml
│ └── ...
├── m4/ # 模块4:非临床研究报告
│ ├── m4.xml
│ └── ...
├── m5/ # 模块5:临床研究报告
│ ├── m5.xml
│ └── ...
├── index.xml # 主索引文件
├── index-md5.txt # MD5 校验文件
└── dtd/ # DTD 文件
使用说明
text
python skills/ectd-xml-compiler/scripts/main.py [选项] <输入文件...>
参数
| 参数 | 描述 |
|---|
| input_files | 输入 Word/PDF 文件路径(支持多个) |
选项
| 选项 | 简写 | 描述 | 默认值 |
|---|
| --output | -o | 输出目录路径 | ./ectd-output |
| --module |
-m | 目标模块(m1-m5,auto) | auto |
| --region | -r | 目标区域(FDA,EMA,ICH) | ICH |
| --version | -v | eCTD 版本(3.2.2,4.0) | 4.0 |
| --dtd-path | -d | 自定义 DTD 路径 | 内置 DTD |
| --validate | | 验证生成的 XML | False |
示例
text
基本用法 - 自动检测模块
python skills/ectd-xml-compiler/scripts/main.py document1.docx document2.pdf
指定输出目录和模块
python skills/ectd-xml-compiler/scripts/main.py -o ./my-ectd -m m3 quality-doc.docx
FDA 提交格式
python skills/ectd-xml-compiler/scripts/main.py -r FDA -v 3.2.2 *.pdf
验证生成的 XML
python skills/ectd-xml-compiler/scripts/main.py --validate submission.pdf
输入文档处理
支持的格式
- - Microsoft Word(.docx,.doc)
- PDF(.pdf)
文档解析逻辑
- 1. 标题识别:根据字体大小和样式提取标题层级
- 目录映射:自动识别章节编号(例如 3.2.S.1.1)
- 元数据提取:提取作者、日期、版本等信息
- 内容分类:根据关键词匹配映射到相应的 eCTD 模块
模块自动识别规则
| 关键词模式 | 目标模块 |
|---|
| 行政、标签、说明书 | m1 |
| 总结、概要、概述 |
m2 |
| 质量、CMC、API、药品 | m3 |
| 非临床、毒理学、药代动力学 | m4 |
| 临床、研究、试验 | m5 |
输出结构
生成的 eCTD 骨架包含:
index.xml
主索引文件,包含所有模块的引用和序列信息。
模块 XML(m1.xml - m5.xml)
每个模块的 XML 骨架,包含:
- - 文档层级结构(,)
- 交叉引用()
- 属性定义(ID、版本、操作类型)
MD5 校验和
每个文件的 MD5 校验值,确保完整性。
安装
text
安装依赖
pip install python-docx PyPDF2 lxml
验证
使用 --validate 选项可验证生成的 XML:
- - DTD 结构验证
- 必需元素和属性检查
- 交叉引用完整性检查
参考资料
许可证
MIT 许可证
风险评估
| 风险指标 | 评估 | 级别 |
|---|
| 代码执行 | Python/R 脚本在本地执行 | 中 |
| 网络访问 |
无外部 API 调用 | 低 |
| 文件系统访问 | 读取输入文件,写入输出文件 | 中 |
| 指令篡改 | 标准提示指南 | 低 |
| 数据暴露 | 输出文件保存到工作区 | 低 |
安全检查清单
- - [ ] 无硬编码凭据或 API 密钥
- [ ] 无未经