fhir-hl7-validator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFHIR & HL7 Validator
FHIR & HL7 验证工具
Healthcare data format validation skill for AI agents. Validates FHIR R5 resources, HL7 v2 messages, and CDA clinical documents. Ensures healthcare data interchange compliance with HL7 standards and identifies schema violations, missing required fields, and interoperability issues.
面向AI Agent的医疗数据格式验证技能。可验证FHIR R5资源、HL7 v2消息和CDA临床文档,确保医疗数据交换符合HL7标准,识别Schema违规、必填字段缺失和互操作性问题。
Capabilities
功能特性
- FHIR Validation - Validate FHIR R5 resources against official schemas
- HL7 Message Parsing - Parse and validate HL7 v2.x messages (ADT, ORU, OBX, RXO)
- CDA Document Validation - Validate Clinical Document Architecture (CDA) R2 documents
- Schema Compliance - Check resources against FHIR specification and UK Core
- Data Type Validation - Verify FHIR data types (Identifier, CodeableConcept, Reference, etc.)
- Reference Resolution - Validate internal and external references
- Cardinality Checking - Ensure required vs. optional field compliance
- Terminology Validation - Check value sets and coding systems (SNOMED CT, LOINC, ICD-10)
- Interoperability Analysis - Identify implementation guide adherence
- Error Reporting - Generate detailed validation error reports with remediation
- FHIR验证 - 对照官方Schema验证FHIR R5资源
- HL7消息解析 - 解析并验证HL7 v2.x消息(ADT、ORU、OBX、RXO)
- CDA文档验证 - 验证临床文档架构(CDA)R2文档
- Schema合规性检查 - 对照FHIR规范和UK Core检查资源
- 数据类型验证 - 验证FHIR数据类型(Identifier、CodeableConcept、Reference等)
- 引用解析 - 验证内部和外部引用
- 基数检查 - 确保必填与可选字段的合规性
- 术语验证 - 检查值集和编码系统(SNOMED CT、LOINC、ICD-10)
- 互操作性分析 - 识别对实施指南的遵循情况
- 错误报告 - 生成包含修复建议的详细验证错误报告
Usage
使用方法
/fhir-hl7-validator [command] [target] [options]/fhir-hl7-validator [命令] [目标] [选项]Commands
命令
- - Validate FHIR JSON/XML resource
validate-fhir <file> - - Validate HL7 v2 message
validate-hl7 <file> - - Validate CDA clinical document
validate-cda <file> - - Parse and display FHIR resource structure
parse-fhir <file> - - Parse and display HL7 segments
parse-hl7 <file> - - Validate all resource references
check-references <file> - - Validate coding systems and value sets
check-terminology <file> - - Validate multiple files
bulk-validate <directory> - - Generate validation report (JSON, markdown, HTML)
report <output-format>
- - 验证FHIR JSON/XML资源
validate-fhir <file> - - 验证HL7 v2消息
validate-hl7 <file> - - 验证CDA临床文档
validate-cda <file> - - 解析并展示FHIR资源结构
parse-fhir <file> - - 解析并展示HL7段
parse-hl7 <file> - - 验证所有资源引用
check-references <file> - - 验证编码系统和值集
check-terminology <file> - - 批量验证多个文件
bulk-validate <directory> - - 生成验证报告(JSON、markdown、HTML)
report <output-format>
Options
选项
- - FHIR version (default: R5; also 4.0, 3.0)
--version <ver> - - Implementation guide (e.g., uk-core, us-core)
--variant <name> - - Enforce must-support constraints
--strict - - Validate coding systems (enables online lookup)
--terminology-check - - Write report to file
--output <file> - - Output format: json, markdown, html, xml
--format <type>
- - FHIR版本(默认:R5;支持4.0、3.0)
--version <ver> - - 实施指南(例如:uk-core、us-core)
--variant <name> - - 强制执行must-support约束
--strict - - 验证编码系统(启用在线查询)
--terminology-check - - 将报告写入文件
--output <file> - - 输出格式:json、markdown、html、xml
--format <type>
Workflow
工作流程
Follow this workflow when invoked:
被调用时请遵循以下工作流程:
Step 1: Identify Healthcare Data Type
步骤1:识别医疗数据类型
Ask user to specify:
- Data format (FHIR, HL7 v2, CDA)
- FHIR version or HL7 dialect
- Implementation guide/profile (if applicable)
- Data source (EHR, lab system, imaging system)
请用户指定:
- 数据格式(FHIR、HL7 v2、CDA)
- FHIR版本或HL7方言
- 实施指南/配置文件(如适用)
- 数据源(电子健康记录EHR、实验室系统、影像系统)
Step 2: Validate Structure
步骤2:验证结构
Check:
- JSON/XML well-formedness
- Required elements present
- Data type conformance
- Cardinality compliance (min/max occurrences)
- Pattern and regex validation
检查:
- JSON/XML格式是否规范
- 必填元素是否存在
- 数据类型是否符合要求
- 基数合规性(最小/最大出现次数)
- 模式和正则验证
Step 3: Semantic Validation
步骤3:语义验证
Verify:
- Code system membership (SNOMED CT, LOINC, ICD-10, etc.)
- Reference consistency (local vs. external)
- Identifier uniqueness and format
- Date/time format accuracy (ISO 8601)
- Quantity unit validity
验证:
- 编码系统成员资格(SNOMED CT、LOINC、ICD-10等)
- 引用一致性(本地 vs 外部)
- 标识符唯一性和格式
- 日期/时间格式准确性(ISO 8601)
- 数量单位有效性
Step 4: Interoperability Check
步骤4:互操作性检查
Ensure compliance with:
- FHIR implementation guides
- US Core or UK Core profiles
- HL7 message specifications
- Clinical data interchange standards
确保符合以下要求:
- FHIR实施指南
- US Core或UK Core配置文件
- HL7消息规范
- 临床数据交换标准
Step 5: Generate Report
步骤5:生成报告
Provide:
- List of validation errors with line numbers
- Severity level (error, warning, info)
- Remediation guidance
- Reference to relevant standards
提供:
- 带行号的验证错误列表
- 严重级别(错误、警告、信息)
- 修复指导
- 相关标准参考
FHIR Resource Examples
FHIR资源示例
Patient Resource
患者资源
json
{
"resourceType": "Patient",
"id": "example",
"identifier": [
{
"system": "http://example.org/medical-record",
"value": "12345"
}
],
"name": [
{
"use": "official",
"given": ["Jane"],
"family": "Doe"
}
],
"birthDate": "1990-01-15",
"address": [
{
"use": "home",
"line": ["123 Main St"],
"city": "Springfield",
"state": "IL",
"postalCode": "62701"
}
]
}json
{
"resourceType": "Patient",
"id": "example",
"identifier": [
{
"system": "http://example.org/medical-record",
"value": "12345"
}
],
"name": [
{
"use": "official",
"given": ["Jane"],
"family": "Doe"
}
],
"birthDate": "1990-01-15",
"address": [
{
"use": "home",
"line": ["123 Main St"],
"city": "Springfield",
"state": "IL",
"postalCode": "62701"
}
]
}Observation Resource
观察资源
json
{
"resourceType": "Observation",
"id": "example",
"status": "final",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "39156-5",
"display": "BMI"
}
]
},
"subject": {
"reference": "Patient/example"
},
"valueQuantity": {
"value": 24.5,
"unit": "kg/m2",
"system": "http://unitsofmeasure.org",
"code": "kg/m2"
}
}json
{
"resourceType": "Observation",
"id": "example",
"status": "final",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "39156-5",
"display": "BMI"
}
]
},
"subject": {
"reference": "Patient/example"
},
"valueQuantity": {
"value": 24.5,
"unit": "kg/m2",
"system": "http://unitsofmeasure.org",
"code": "kg/m2"
}
}HL7 v2 Segment Examples
HL7 v2段示例
ADT Message (Patient Admission)
ADT消息(患者入院)
MSH|^~\&|SendingApp|SendingFac|ReceivingApp|ReceivingFac|202502071350||ADT^A01|123456|P|2.5
PID^^^12345||JaneDoe||19900115|F|||123 Main St^^Springfield^IL^62701|||||||S
PV1||I|ICU^FL2^BED01|||||||||||||||||||||||||||MSH|^~\&|SendingApp|SendingFac|ReceivingApp|ReceivingFac|202502071350||ADT^A01|123456|P|2.5
PID^^^12345||JaneDoe||19900115|F|||123 Main St^^Springfield^IL^62701|||||||||S
PV1||I|ICU^FL2^BED01|||||||||||||||||||||||||||Common Validation Errors
常见验证错误
| Error | Cause | Solution |
|---|---|---|
| Missing required element | Element marked | Add the required element |
| Invalid data type | Value doesn't match specified type | Convert to correct type (e.g., date to YYYY-MM-DD) |
| Unknown code system | Code not in specified value set | Use code from official code system (SNOMED CT, LOINC) |
| Broken reference | Reference target doesn't exist | Verify reference path and ID |
| Invalid identifier format | ID format doesn't match pattern | Follow system-specific identifier format |
| 错误类型 | 原因 | 解决方案 |
|---|---|---|
| 必填元素缺失 | 标记为 | 添加必填元素 |
| 数据类型无效 | 值与指定类型不匹配 | 转换为正确类型(例如:日期格式改为YYYY-MM-DD) |
| 未知编码系统 | 编码不在指定值集中 | 使用官方编码系统中的编码(SNOMED CT、LOINC) |
| 引用断裂 | 引用目标不存在 | 验证引用路径和ID |
| 标识符格式无效 | ID格式不符合规则 | 遵循系统特定的标识符格式 |
Standards & Implementation Guides
标准与实施指南
- FHIR R5 (http://hl7.org/fhir/R5/)
- HL7 v2.5.1 (http://www.hl7.org/)
- CDA R2 (https://www.hl7.org/implement/standards/cdar2/)
- US Core (http://www.hl7.org/fhir/us/core/)
- UK Core (https://digital.nhs.uk/developer/api-catalogue/fhir-uk-core)
- SNOMED CT (https://www.snomed.org/)
- LOINC (https://loinc.org/)
- ICD-10 (https://www.cdc.gov/nchs/icd/icd10cm.htm)
- FHIR R5 (http://hl7.org/fhir/R5/)
- HL7 v2.5.1 (http://www.hl7.org/)
- CDA R2 (https://www.hl7.org/implement/standards/cdar2/)
- US Core (http://www.hl7.org/fhir/us/core/)
- UK Core (https://digital.nhs.uk/developer/api-catalogue/fhir-uk-core)
- SNOMED CT (https://www.snomed.org/)
- LOINC (https://loinc.org/)
- ICD-10 (https://www.cdc.gov/nchs/icd/icd10cm.htm)
References
参考资料
- Fast Healthcare Interoperability Resources (FHIR) - R5 Specification
- HL7 Version 2.5.1 - Standard for Healthcare Data Exchange
- Clinical Document Architecture R2 - CDA Specification
- NIST SP 800-66 Rev. 2 - HIPAA Security Implementation Guidance
- HL7 FHIR Implementation Guides
- Fast Healthcare Interoperability Resources (FHIR) - R5规范
- HL7 Version 2.5.1 - 医疗数据交换标准
- Clinical Document Architecture R2 - CDA规范
- NIST SP 800-66 Rev. 2 - HIPAA安全实施指南
- HL7 FHIR实施指南