JSPM

  • Created
  • Published
  • Downloads 533
  • Score
    100M100P100Q93905F

Node.js wrapper for the official ATIH grouping engine (PMSI GHM/GHS) used in French hospital medical coding. This package provides access to the native C groupage module for classifying inpatient stays into GHM and GHS codes as part of the PMSI/T2A system.

Package Exports

  • @beparallel/grouping
  • @beparallel/grouping/package.json

Readme

@beparallel/grouping

Node.js wrapper for the official ATIH grouping engine (PMSI GHM/GHS) used in French hospital medical coding. This package provides access to the native C groupage module for classifying inpatient stays into GHM and GHS codes as part of the PMSI/T2A system.

Installation

npm install @beparallel/grouping

Usage

import { grp, grp2024, grp2025 } from '@beparallel/grouping'

// Use the automatic version selector
const result = grp({
  rumObjects: [...],
  typeEtab: 1
})

// Or use a specific version
const result2025 = grp2025({
  rumObjects: [...],
  typeEtab: 1
})

Troubleshooting

"invalid ELF header" Error

This error occurs when the native binaries were compiled for a different architecture than the one you're running on. This commonly happens in CI/CD environments.

Quick Fix

  1. Rebuild the package for your platform:

    npm rebuild @beparallel/grouping
  2. If that doesn't work, install build tools and rebuild:

    # On Linux
    sudo apt-get update
    sudo apt-get install build-essential python3 python3-dev
    
    # On macOS
    xcode-select --install
    
    # On Windows
    npm install --global windows-build-tools
    
    # Then rebuild
    npm rebuild @beparallel/grouping

For CI/CD Environments

Add these steps to your CI/CD pipeline:

GitHub Actions (Linux):

- name: Install build tools
  run: |
    sudo apt-get update
    sudo apt-get install -y build-essential python3 python3-dev

- name: Install dependencies
  run: npm ci

- name: Rebuild native modules
  run: npm rebuild @beparallel/grouping

GitHub Actions (macOS):

- name: Install Xcode Command Line Tools
  run: xcode-select --install || true

- name: Install dependencies
  run: npm ci

- name: Rebuild native modules
  run: npm rebuild @beparallel/grouping

Diagnostic Tool

Run the built-in diagnostic tool to check your environment:

npx @beparallel/grouping diagnose

Or if you have the package locally:

npm run diagnose

Other Common Issues

  1. Missing build tools: Install the appropriate build tools for your platform
  2. Node.js version mismatch: Ensure you're using a compatible Node.js version
  3. Permission issues: Run with appropriate permissions or use sudo when necessary

API Reference

grp(input: GroupingInput)

Automatically selects the appropriate grouping version (2024 or 2025) based on the RUM objects.

grp2024(input: GroupingInput)

Uses the 2024 grouping algorithm.

grp2025(input: GroupingInput)

Uses the 2025 grouping algorithm.

Types

interface GroupingInput {
  rumObjects: RUMObject[]
  typeEtab: number
}

interface GroupingResult {
  returnCode: number
  returnError: GroupingError
  // ... other result properties
}

Development

# Install dependencies
pnpm install

# Build native modules
pnpm build:native

# Build TypeScript
pnpm build:ts

# Run tests
pnpm test

# Run diagnostics
pnpm diagnose