
Product
Redesigned Repositories Page: A Faster Way to Prioritize Security Risk
Our redesigned Repositories page adds alert severity, filtering, and tabs for faster triage and clearer insights across all your projects.
HL7Parser is a CommonJS module for working with HL7 2.x messages.
HL7Parser can be installed using npm:
$ npm install hl7parser --save
Parse an HL7 message.
var hl7parser = require("hl7parser");
var message = hl7parser.create("MSH|^~\&|||||20121031232617||ADT^A04|20381|P|2.3||||NE\rEVN|A04|20121031162617||01\rPID|1|16194|16194||Jones^Bob");
console.log(message.get("PID.5.2").toString()); // prints "Bob"
See the tests for more examples.
An HL7 message.
addSegment
name
length
get
set
exists
forEach
toString
toRaw
toArray
isEmpty
toDate
toInteger
toFloat
toBoolean
Adds a segment to the message.
Parameters
string
- The name of the segment to add (e.g. "PID").Returns: Node
The name of the node.
Type: string
The number of child nodes in the node.
Type: number
Gets a child node with the given path.
Parameters
string | number
- The path of the child node to retrieve. The path can be a number or string. If the path is a
number, then child node at the specified index is returned.Returns: Node
Sets a child node at the given path.
Parameters
string
- The path of the child node to set.any
- The value to set at the given path.Returns: void
Checks if a child node exists at the given path.
Parameters
string | number
- That path to check.Returns: boolean
Iterates through all child nodes, calling the callback for each node. Similar to Array.forEach.
Parameters
Returns: void
Returns a string representation of the node. If the node has child nodes then the raw representation of the node is returned; otherwise, the value of the node is returned with escape sequences resolved.
Returns: string
Returns the raw string representation of the node, including delimiters and escape sequences.
Returns: string
Returns all child nodes as an array.
Returns: Node[]
Returns true if the node is empty; otherwise, returns false.
Returns: boolean
Returns the value of the node as a date. If the length of the string is exactly 8, the value is parsed using the format YYYYMMDD. If the length of the string is >= 14, the value is parsed using the format YYYYMMDDHHMMSS.
Returns: Date
Returns the value of the node as an integer.
Returns: number
Returns the value of the node as a floating point number.
Returns: number
Returns the value of the node as a boolean. A value of "Y" is returned as true. A value of "N" is returned as false. All other values return null.
Returns: boolean
A node in an HL7 message. Can represent a message, segment, field, component, or sub-component.
name
length
get
set
exists
forEach
toString
toRaw
toArray
isEmpty
toDate
toInteger
toFloat
toBoolean
The name of the node.
Type: string
The number of child nodes in the node.
Type: number
Gets a child node with the given path.
Parameters
string | number
- The path of the child node to retrieve. The path can be a number or string. If the path is a
number, then child node at the specified index is returned.Returns: Node
Sets a child node at the given path.
Parameters
string
- The path of the child node to set.any
- The value to set at the given path.Returns: void
Checks if a child node exists at the given path.
Parameters
string | number
- That path to check.Returns: boolean
Iterates through all child nodes, calling the callback for each node. Similar to Array.forEach.
Parameters
Returns: void
Returns a string representation of the node. If the node has child nodes then the raw representation of the node is returned; otherwise, the value of the node is returned with escape sequences resolved.
Returns: string
Returns the raw string representation of the node, including delimiters and escape sequences.
Returns: string
Returns all child nodes as an array.
Returns: Node[]
Returns true if the node is empty; otherwise, returns false.
Returns: boolean
Returns the value of the node as a date. If the length of the string is exactly 8, the value is parsed using the format YYYYMMDD. If the length of the string is >= 14, the value is parsed using the format YYYYMMDDHHMMSS.
Returns: Date
Returns the value of the node as an integer.
Returns: number
Returns the value of the node as a floating point number.
Returns: number
Returns the value of the node as a boolean. A value of "Y" is returned as true. A value of "N" is returned as false. All other values return null.
Returns: boolean
Creates a new HL7 message. If the message text is not specified, an empty HL7 message is created.
Parameters
string
- Optional. The text to parse.Returns: Message
FAQs
HL7 2.x parser and generator.
We found that hl7parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Our redesigned Repositories page adds alert severity, filtering, and tabs for faster triage and clearer insights across all your projects.
Security News
Slopsquatting is a new supply chain threat where AI-assisted code generators recommend hallucinated packages that attackers register and weaponize.
Security News
Multiple deserialization flaws in PyTorch Lightning could allow remote code execution when loading untrusted model files, affecting versions up to 2.4.0.