FHIRSCHEMA (法语)
TypeScript执行FHIRSchema转换器和验证器.
概览
该项目提供:
- 转换器: 将 FHIR 结构转换为 FHIRSchema 格式
- 验证器:对照FHIRSchema定义验证FHIR资源
安装
npm install @atomic-ehr/fhirschema
或者安装最新的金丝雀版本 :
npm install @atomic-ehr/fhirschema@canary
使用量
将结构定义转换为 FHIRSchema
import { translate } from '@atomic-ehr/fhirschema';
const structureDefinition = {
resourceType: 'StructureDefinition',
name: 'Patient',
// ... rest of the StructureDefinition
};
const fhirSchema = translate(structureDefinition);
验证 FHIR 资源
import { validate } from '@atomic-ehr/fhirschema';
const resource = {
resourceType: 'Patient',
// ... patient data
};
const schema = { /* FHIRSchema */ };
const context = { schemas: { Patient: schema } };
const result = validate(context, [], resource);
if (result.valid) {
console.log('Resource is valid');
} else {
console.log('Validation errors:', result.errors);
}
发展
运行测试
bun test
类型检查
bun run typecheck
大楼
bun run build
项目结构
├── src/
│ ├── converter/ # StructureDefinition to FHIRSchema converter
│ ├── validator/ # FHIRSchema validator
│ └── types.ts # Shared TypeScript types
├── test/
│ ├── unit/ # Unit tests
│ └── golden/ # Golden tests with expected outputs
├── spec/ # Specifications and documentation
├── adr/ # Architecture Decision Records
└── tasks/ # Task management
发展
本项目使用:
- 阿宝 作为运行时间和测试跑者
- 类型脚本 类型安全
- GitHub 动作 计算机/光盘
捐款
- 叉子存储器
- 创建您的特性分支( E)
git checkout -b feature/amazing-feature(中文(简体) ) - 提交更改( E)
git commit -m 'Add some amazing feature'(中文(简体) ) - 推向分行(
git push origin feature/amazing-feature(中文(简体) ) - 打开拉请求
许可证
[资料待补]