npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@aegisx/claim-validator

v1.0.0

Published

NHSO 16 Files Claim Validation Rules for Thai Healthcare

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 build

Usage

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: error

C 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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/new-rule)
  3. Add/modify rules in YAML format
  4. Run tests (npm test)
  5. Submit Pull Request

Adding New Rules

  1. สร้างไฟล์ YAML ใน directory ที่เหมาะสม
  2. ใส่ข้อมูลตาม schema ที่กำหนด
  3. ระบุ source และ effectiveDate
  4. Run validation: npm run validate:yaml

⚠️ Disclaimer

ข้อมูลในโปรเจคนี้รวบรวมจากแหล่งข้อมูลสาธารณะของ สปสช. และบัญชียาหลักแห่งชาติ
กรุณาตรวจสอบความถูกต้องกับประกาศล่าสุดก่อนนำไปใช้งานจริง

ผู้พัฒนาไม่รับผิดชอบต่อความเสียหายที่อาจเกิดขึ้นจากการใช้งานข้อมูลเหล่านี้

📚 References

📄 License

MIT License - see LICENSE file

👥 Contributors

  • รพ.ขอนแก่น - กลุ่มงานสุขภาพดิจิทัล

Made with ❤️ for Thai Healthcare