/install redcap-crf-generator
REDCap CRF 数据字典生成器
概述
本技能将 Word 格式的临床试验方案/CRF 表单转换为符合 REDCap 标准的数据字典 CSV 文件。
数据字典格式(REDCap CSV)
| 列名 | 说明 | 示例 |
|---|---|---|
| Variable / Field Name | 字段变量名,CDISC规范 | sex, js_1, ws_22 |
| Form Name | 表单英文名 | demographics, basic_info |
| Section Header | 分节标题(仅首字段填写) | 人口学特征 |
| Field Type | 字段类型 | text, dropdown, radio, checkbox, calc, notes, file |
| Field Label | 字段中文标签 | 性别, 您对工作满意吗 |
| Choices, Calculations, OR Slider Labels | 选项(radio/checkbox/dropdown用) | 0, 否 | 1, 是 |
| Field Note | 特殊说明/格式要求 | 反向计分, YYYY-MM-DD |
| Text Validation Type | 验证类型 | date, phone, email, number, integer |
| Text Validation Min/Max | 数值范围 | 0, 100 |
| Identifier? | 是否隐私字段 | y(是)或留空 |
| Branching Logic | 分支逻辑 | [sex] = "0" |
| Required Field? | 是否必填 | y(是)或留空 |
⚠️ 重要:Section Header 规则
Section Header 仅第一个字段填写,后续同组字段留空!
这是 REDCap 数据字典的标准要求。同一个分节的字段,第一个字段标注 Section Header,后续字段该列留空。
示例:
Variable / Field Name,Form Name,Section Header,Field Type,Field Label,...
bi_1,basic_info,人口学特征,radio,您的性别,...
bi_2,basic_info,,radio,您的年龄,...
bi_3,basic_info,,radio,您的户籍,...
支持的字段类型
| 类型 | 说明 | Choices 格式 |
|---|---|---|
text |
单行文本 | 无 |
notes |
多行文本/备注 | 无 |
dropdown |
下拉选择 | 0, 选项1 | 1, 选项2 |
radio |
单选按钮 | 0, 选项1 | 1, 选项2 |
checkbox |
多选框 | 0, 选项1 | 1, 选项2 | 2, 选项3 |
calc |
计算字段 | round([weight]*10000/([height]^2),1) |
file |
文件上传 | 无 |
date |
日期(用text类型+date验证) | 无 |
量表支持
Likert 量表(职业压力等)
- 格式:
1, 非常符合 | 2, 基本符合 | 3, 有点不符合 | 4, 非常不符合 - 反向计分题选项顺序颠倒:
1, 非常不符合 | 2, 有点不符合 | 3, 基本符合 | 4, 非常符合
频率量表(工作状态等)
- 格式:
0, 从未发生 | 1, 一年几次或更少 | 2, 一月一次或更少 | 3, 一月几次 | 4, 一周一次 | 5, 一周几次 | 6, 每天发生
CDISC 变量命名规范
| 表单前缀 | 说明 | 示例 |
|---|---|---|
bi_ |
basic_info 基本信息 | bi_1, bi_2 |
js_ |
job_stress 职业压力 | js_1, js_31 |
ws_ |
work_status 工作状态 | ws_1, ws_22 |
mh_ |
mental_health 心理健康 | mh_1, mh_10 |
规则:
- 小写字母 + 下划线 + 数字
- 题号后缀便于溯源(如
js_5= job_stress 第5题) - 避免缩写,使用通用词汇
处理流程
- 读取 Word 文档 → 使用 python-docx 解析
- 识别结构 → 段落(基本信息和第四部分)/ 表格(第二、三部分量表)
- 字段解析 → 提取题目、选项、量表类型
- 智能推断 → 字段类型、验证规则、反向计分标记
- 生成 CSV → REDCap 标准格式,UTF-8 编码
使用方式
当用户上传 Word 文档并要求生成数据字典时:
- 读取文档内容
- 解析表单结构和字段
- 生成符合上述格式的 CSV
- 通过飞书发送文件给用户
依赖
pip install python-docx lxml
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install redcap-crf-generator - After installation, invoke the skill by name or use
/redcap-crf-generator - Provide required inputs per the skill's parameter spec and get structured output
What is Redcap Crf Generator?
REDCap 数据字典生成器 - 将 Word 文档(CRF/方案)转换为 CSV 格式的 REDCap 数据字典。 适用场景: - 用户上传临床试验 CRF/方案 Word 文档,要求生成数据字典 - 将问卷/调查表转换为 REDCap 可导入的 CSV 格式 功能特点: - 智能识别表单、分节、字段结构 -... It is an AI Agent Skill for Claude Code / OpenClaw, with 49 downloads so far.
How do I install Redcap Crf Generator?
Run "/install redcap-crf-generator" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Redcap Crf Generator free?
Yes, Redcap Crf Generator is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Redcap Crf Generator support?
Redcap Crf Generator is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Redcap Crf Generator?
It is built and maintained by kenlcj (@kenlcj); the current version is v1.0.0.