特色栏目

ASP源码

PHP源码

.NET源码

JSP源码

游戏频道
专题合集
关闭菜单
首页> AI教程> FHIR 问卷设计器:LOINC 与 SNOMED CT 集成 - Openclaw Skills

FHIR 问卷设计器:LOINC 与 SNOMED CT 集成 - Openclaw Skills

时间:2026-03-26 18:51:02 作者:互联网

什么是 FHIR 问卷设计器?

FHIR 问卷设计器是一个专门的框架,旨在弥合原始临床需求与标准化医疗数据结构之间的鸿沟。该技能使 AI 代理能够通过实时查询 LOINC 和 SNOMED CT 代码来生成符合 FHIR 标准的问卷定义,确保从源头准确采集临床数据。通过在开发工作流中使用 Openclaw Skills,您可以自动化创建复杂的医疗表单,同时严格遵守国际医疗信息化标准。

其核心是通过执行严格的临床术语查询政策来优先考虑数据完整性。它禁止使用记忆或幻觉的临床代码,要求针对官方术语服务器进行实时验证。这种方法确保了生成的 JSON 结构在技术上是可靠的,并可直接用于互操作医疗环境。

下载入口:https://github.com/openclaw/skills/tree/main/skills/elmariachi111/fhir-questionnaire

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install fhir-questionnaire

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 fhir-questionnaire。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

FHIR 问卷设计器 应用场景

FHIR 问卷设计器 工作原理
  1. 代理分析需求文档以识别特定的临床观察、问题和状况。
  2. 执行搜索脚本以获取观察结果的官方 LOINC 代码和临床概念的 SNOMED CT 代码。
  3. 代理查询术语服务器以获取基于选择的问题的标准答案选项(ValueSets)。
  4. 使用处理 linkId、项目类型和术语绑定的预定义模板生成符合 FHIR 标准的 JSON 结构。
  5. 使用内部验证脚本根据官方 FHIR 架构对最终问卷进行验证,以确保技术合规性。

FHIR 问卷设计器 配置指南

要实现此技能,您必须安装 Python 3.8 或更高版本以及所需的验证依赖项:

pip install jsonschema

该技能需要对 clinicaltables.nlm.nih.gov(用于 LOINC)和 tx.fhir.org(用于 SNOMED CT 和 ValueSet 扩展)的白名单网络访问权限。默认术语提供程序目前不需要专有 API 密钥。

FHIR 问卷设计器 数据架构与分类体系

该技能通过脚本和资产的结构化层次结构管理其操作:

组件 用途
scripts/ 用于 LOINC/SNOMED 搜索、ValueSet 扩展和 JSON 验证的 Python 工具。
assets/templates/ minimaladvanced 复杂度的模块化 JSON 模板。
references/ 涵盖 FHIR 规范和建模最佳实践的技术指南。
output/ 准备好进行服务器部署的有效 FHIR 问卷 JSON 资源。

通过主要技能文件中的 YAML 标头跟踪元数据,以管理环境依赖项(如 python>=3.8)。

name: design-fhir-loinc-questionnaires
description: Helps creating FHIR conforming questionnaire definitions from plain requirement ideation docs. Contains scripts to look up LOINC and SNOMED CT codes for medical conditions, findings, observations, medications, procedures from a official coding APIs. No API keys required at the moment. 
metadata:
  dependencies: python>=3.8, jsonschema>=4.0.0

FHIR Questionnaire Skill

?? CRITICAL RULES - READ FIRST

NEVER suggest LOINC or SNOMED CT codes from memory or training data. ALWAYS use the search and query scripts in this skill.

When any clinical code is needed:

  1. For clinical questions/observations: ALWAYS run python scripts/search_loinc.py "search term" FIRST
  2. For clinical concepts/conditions: ALWAYS run python scripts/search_snomed.py "search term" FIRST
  3. ONLY use codes returned by the scripts
  4. If search fails or returns no results, DO NOT make up codes

Clinical codes from AI memory are highly unreliable and will cause incorrect clinical coding.

Network Access Requirements

Requires whitelisted network access:

If network access fails, STOP. Do not suggest codes.

Essential Scripts (Use These Every Time)

1. Search LOINC Codes

ALWAYS run this before suggesting any LOINC code (clinical questions/observations):

python scripts/search_loinc.py "depression screening"
python scripts/search_loinc.py "blood pressure" --format fhir

2. Search SNOMED CT Codes

ALWAYS run this before suggesting any SNOMED CT code (clinical concepts/conditions):

python scripts/search_snomed.py "diabetes"
python scripts/search_snomed.py "hypertension" --format fhir
python scripts/search_snomed.py "diabetes mellitus" --semantic-tag "disorder"

Note: The --semantic-tag filter works best when the semantic tag appears in the display name (e.g., "Diabetes mellitus (disorder)").

3. Find Answer Options

For questions with standardized answers:

python scripts/query_valueset.py --loinc-code "72166-2"
python scripts/query_valueset.py --loinc-code "72166-2" --format fhir

4. Validate Questionnaire

Before finalizing:

python scripts/validate_questionnaire.py questionnaire.json

Templates

Start with assets/templates/:

Workflows

Standardized Clinical Instruments (PHQ-9, GAD-7, etc.)

# Step 1: Find panel code (NEVER skip this)
python scripts/search_loinc.py "PHQ-9 panel"

# Step 2: Find answer options
python scripts/query_valueset.py --loinc-code "FOUND-CODE" --format fhir

# Step 3: See examples/templates
# Check references/examples.md for complete implementations

Custom Organizational Questionnaires

# Step 1: Start with template
cp assets/templates/advanced.json my-questionnaire.json

# Step 2: For any clinical questions, search LOINC
python scripts/search_loinc.py "body weight"

# Step 3: Add answer options if available
python scripts/query_valueset.py --loinc-code "FOUND-CODE"

# Step 4: For custom questions without LOINC results, use inline answerOptions
# (no coding system needed - just code + display)

# Step 5: Validate
python scripts/validate_questionnaire.py my-questionnaire.json

Custom Answer Lists (When LOINC Has No Match)

When LOINC search returns no suitable answer list, use inline answerOption with system-less valueCoding by default. This is the simplest, spec-compliant approach for custom answer lists:

{
  "linkId": "sleep-quality",
  "type": "choice",
  "text": "How would you rate your sleep quality?",
  "answerOption": [
    {"valueCoding": {"code": "good", "display": "Good"}},
    {"valueCoding": {"code": "fair", "display": "Fair"}},
    {"valueCoding": {"code": "poor", "display": "Poor"}}
  ]
}

Do NOT invent a coding system URI. Omitting system is valid FHIR and signals that these are local, questionnaire-scoped codes.

Opt-in: Reusable Welshare Coding System

If the user explicitly requests reusable codes that can be shared across questionnaires, use the Welshare namespace (http://codes.welshare.app) via the helper script:

python scripts/create_custom_codesystem.py --interactive

This creates a CodeSystem + ValueSet pair. To convert an inline answer list to the reusable format, add "system": "http://codes.welshare.app/CodeSystem//.json" to each valueCoding and optionally reference the ValueSet via answerValueSet. See references/loinc_guide.md for details.

Common Patterns

See references/examples.md for complete working examples.

Script Reference

search_loinc.py - Find LOINC Codes

python scripts/search_loinc.py "blood pressure"
python scripts/search_loinc.py "depression" --limit 10 --format fhir

search_snomed.py - Find SNOMED CT Codes

python scripts/search_snomed.py "diabetes"
python scripts/search_snomed.py "hypertension" --limit 10 --format fhir
python scripts/search_snomed.py "asthma" --format table
python scripts/search_snomed.py "diabetes mellitus" --semantic-tag "disorder"

Formats: json (default), table, fhir Semantic tags (when present in results): disorder, finding, procedure, body structure, substance, organism Note: Semantic tag filtering only works when tags are included in the display name from the terminology server.

query_valueset.py - Find Answer Options

python scripts/query_valueset.py --loinc-code "72166-2"
python scripts/query_valueset.py --loinc-code "72166-2" --format fhir
python scripts/query_valueset.py --search "smoking"

Alternative servers (if tx.fhir.org fails):

validate_questionnaire.py - Validate Structure

python scripts/validate_questionnaire.py questionnaire.json
python scripts/validate_questionnaire.py questionnaire.json --verbose

extract_loinc_codes.py - Analyze Codes

python scripts/extract_loinc_codes.py questionnaire.json
python scripts/extract_loinc_codes.py questionnaire.json --validate

create_custom_codesystem.py - Reusable Custom Codes (Opt-in)

python scripts/create_custom_codesystem.py --interactive

Only use when the user explicitly requests reusable codes across questionnaires. Uses the Welshare namespace: http://codes.welshare.app. Default for custom answers is inline answerOption without a coding system.

Troubleshooting

Deep Knowledge References

We've assembled deep knowledge for you to consult on specific topics. Checkout the index file on See REFERENCE.md and drill down the knowledge path for highly detailed instructions on modelling questionnaires.

相关文章

热门文章

猜你喜欢

返回顶部