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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@healthcare-interoperability/hl7v2-core

v1.7.1

Published

Core module for HL7v2 message generation and parsing library

Downloads

11

Readme

@healthcare-interoperability/hl7v2-core

Description

This npm package provides utilities and classes for handling HL7v2 messaging. It includes classes for primitive data types, complex data types, segments, and trigger events.

Installation

To install the package, use npm:

npm install @healthcare-interoperability/hl7v2-core

Usage Examples

PrimitiveType

import { PrimitiveType } from '@healthcare-interoperability/hl7v2-core';

const primitiveValue = new PrimitiveType('Hello');
console.log(primitiveValue.toString()); // Output: 'Hello'
console.log(primitiveValue.toJSON()); // Output: 'Hello'

PrimitiveDataType

import { PrimitiveDataType } from '@healthcare-interoperability/hl7v2-core';

const primitiveData = new PrimitiveDataType('World');
console.log(primitiveData.toString()); // Output: 'World'
console.log(primitiveData.toJSON()); // Output: 'World'

ComplexType

import { ComplexType } from '@healthcare-interoperability/hl7v2-core';

const complexValues = ['Value1', 'Value2'];
const complexInstance = new ComplexType(complexValues);
console.log(complexInstance.toString()); // Output: 'Value1^Value2'
console.log(complexInstance.toJSON()); // Output: ['Value1', 'Value2']

ComplexDataType

import { ComplexDataType } from '@healthcare-interoperability/hl7v2-core';

const complexDataValues = ['Data1', 'Data2'];
const complexDataInstance = new ComplexDataType(complexDataValues);
console.log(complexDataInstance.toString()); // Output: 'Data1^Data2'
console.log(complexDataInstance.toJSON()); // Output: ['Data1', 'Data2']

Segment

import { Segment } from '@healthcare-interoperability/hl7v2-core';

const segmentValues = 'PID|1|John Doe|...';
const segmentInstance = new Segment(segmentValues);
console.log(segmentInstance.toString()); // Output: 'PID|1|John Doe|...'
console.log(segmentInstance.toJSON()); // Output: { PID: { ... } }

TriggerEvent

import { TriggerEvent } from '@healthcare-interoperability/hl7v2-core';

const hl7Message = 'MSH|^~\\&|...';
const triggerEventInstance = new TriggerEvent(hl7Message);
console.log(triggerEventInstance.toJSON()); // Output: Parsed JSON representation of the HL7 message

API Reference

PrimitiveType

  • toString(): Returns the string representation of the primitive value.
  • toJSON(): Returns the JSON representation of the primitive value.

PrimitiveDataType extends PrimitiveType

  • Inherits methods from PrimitiveType.

ComplexType

  • setValues(values): Sets values based on array, object, or primitive data.
  • toString(): Returns a string representation of the complex type.
  • toJSON(): Returns a JSON representation of the complex type.

ComplexDataType extends ComplexType

  • Inherits methods from ComplexType.

Segment extends ComplexType

  • toString(): Returns a string representation of the segment.
  • toJSON(): Returns a JSON representation of the segment.

TriggerEvent

  • toJSON(mode, flag): Returns a JSON representation of the parsed HL7 message.
  • setCustomSegments(segmentId, segmentInstance): Sets custom segments to the TriggerEvent instance.

HL7®, FHIR® and the FHIR are the registered trademarks of Health Level Seven International and their use does not constitute endorsement by HL7.