@aegisx/claim-validator
v1.0.0
Published
NHSO 16 Files Claim Validation Rules for Thai Healthcare
Maintainers
Readme
📋 NHSO Claim Rules
ระบบ Rules สำหรับตรวจสอบข้อมูล 16 แฟ้ม และเงื่อนไขการเบิก สปสช.
📌 Overview
โปรเจคนี้รวบรวมเงื่อนไขการเบิกจ่ายของ สปสช. ในรูปแบบ YAML/JSON ที่สามารถนำไปใช้งานได้ทันที รวมถึง Validator ที่พร้อมใช้งานใน TypeScript
✅ Features
- 16 Files Structure Validation - ตรวจสอบโครงสร้างข้อมูล 16 แฟ้ม
- C Error Codes - รหัสข้อผิดพลาดทั้งหมดของระบบ e-Claim
- Drug J2 Rules - เงื่อนไขยาบัญชี จ(2) ครบทุกรายการ
- TypeScript Validator - พร้อมใช้งานทันที
🚀 Quick Start
Installation
# Clone repository
git clone https://github.com/your-org/nhso-claim-rules.git
cd nhso-claim-rules
# Install dependencies
npm install
# Build
npm run buildUsage
import { NhsoValidator } from './validator/src';
// Initialize validator
const validator = new NhsoValidator();
// Load rules
await validator.loadRules('./rules');
// Validate claim data
const results = validator.validate(claimData);
// Generate report
const report = validator.generateReport(results);
console.log(report);📁 Project Structure
nhso-claim-rules/
├── rules/
│ ├── structure/
│ │ └── 16-files-validation.yaml # โครงสร้าง 16 แฟ้ม
│ ├── c-error/
│ │ └── c-error-codes.yaml # C Error codes
│ └── drug-j2/
│ └── drug-j2-rules.yaml # ยาบัญชี จ(2)
├── validator/
│ └── src/
│ └── index.ts # TypeScript Validator
├── dist/
│ ├── all-rules.json # Compiled rules (auto-generated)
│ └── all-rules.min.json
├── package.json
└── README.md📋 Rules Format
Drug J2 Rule Example
id: J2-SOFVEL-001
name:
th: 'Sofosbuvir/Velpatasvir'
en: 'Sofosbuvir/Velpatasvir'
genericName: 'Sofosbuvir + Velpatasvir'
indications:
- id: IND-001
description: 'รักษาตับอักเสบซีเรื้อรัง (Chronic Hepatitis C)'
icd10: ['B18.2']
conditions:
- id: COND-001
type: diagnosis
description: 'ต้องมี ICD B18.2'
field: DIAGCODE
operator: equals
values: ['B182']
severity: error
message: 'ต้องมีการวินิจฉัย Chronic Hepatitis C (B18.2)'
- id: COND-002
type: specialist
description: 'ต้องสั่งใช้โดยอายุรแพทย์ระบบทางเดินอาหาร'
field: PROVIDER_SPECIALTY
operator: in
values: ['0600', '0601']
severity: errorC Error Code Example
- code: 'C201'
description: 'ไม่มีรหัสการวินิจฉัยโรคหลัก'
field: 'DIAGCODE'
validation: 'has_principal_diagnosis'
solution: 'บันทึกรหัสโรคหลัก แล้วส่งข้อมูลเข้ามาใหม่'
severity: error🔧 Validation Layers
| Layer | Description | Examples | | ------------------ | ------------------------------ | ------------------------------------- | | L1: Structure | ตรวจสอบโครงสร้างข้อมูล | CID checksum, required fields, format | | L2: Cross-file | ตรวจสอบความสัมพันธ์ระหว่างแฟ้ม | PDX required, date consistency | | L3: Business | ตรวจสอบ business rules | Discharge status, newborn weight | | L4: Drug/J2 | ตรวจสอบเงื่อนไขยา | ICD match, specialist required |
📊 Coverage
C Error Codes
| Category | Count | Coverage | | ---------------------- | ----- | ----------- | | Patient Data (101-150) | 50+ | ✅ Complete | | Diagnosis (201-250) | 30+ | ✅ Complete | | Charge/Cost (301-400) | 20+ | ✅ Complete | | COVID-19 (310-350) | 40+ | ✅ Complete |
Drug J2 Categories
| Category | Count | Status | | ------------ | ----- | ------ | | Antifungal | 3 | ✅ | | Antibiotics | 2 | ✅ | | Hepatitis C | 1 | ✅ | | Cancer | 4 | ✅ | | HIV | 1 | ✅ | | Neurological | 1 | ✅ | | Endocrine | 1 | ✅ |
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/new-rule) - Add/modify rules in YAML format
- Run tests (
npm test) - Submit Pull Request
Adding New Rules
- สร้างไฟล์ YAML ใน directory ที่เหมาะสม
- ใส่ข้อมูลตาม schema ที่กำหนด
- ระบุ
sourceและeffectiveDate - Run validation:
npm run validate:yaml
⚠️ Disclaimer
ข้อมูลในโปรเจคนี้รวบรวมจากแหล่งข้อมูลสาธารณะของ สปสช. และบัญชียาหลักแห่งชาติ
กรุณาตรวจสอบความถูกต้องกับประกาศล่าสุดก่อนนำไปใช้งานจริง
ผู้พัฒนาไม่รับผิดชอบต่อความเสียหายที่อาจเกิดขึ้นจากการใช้งานข้อมูลเหล่านี้📚 References
📄 License
MIT License - see LICENSE file
👥 Contributors
- รพ.ขอนแก่น - กลุ่มงานสุขภาพดิจิทัล
Made with ❤️ for Thai Healthcare
