Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

HL7 - Segment notation PEG parser

NotificationsYou must be signed in to change notification settings

michael-golden/hl7-peg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Builds a JSON Abstract Syntax Tree that describes the HL7 Segment notation

PEG grammar rules

  • Segments are listed from left to rightand always starts with MSH
  • Optional segments are enclosed in[] square brackets
    • MSH PID NK1 PV1 [PV2]

    In this example, PV2 can be optionally included in the message.

    MSH|^~\&|...PID|....|...NK1|....|...PV1|....|...PV2|....|...
  • Repeating segments are enclosed in{} curly brackets.
    • MSH PID {NK1} PV1 [PV2]

    In this example, one or more NK1 segements can be included prior to PV1

    MSH|^~\&|...PID|....|...NK1|....|...NK1|....|...PV1|....|...PV2|....|...
  • Segments that are both optional and repeating are enclosed in both curly and square brackets[{}] or{[]}
    • MSH PID [{NK1}] PV1 [PV2]

    In this example, optional and repeating NK1 groups are optionally included.

    MSH|^~\&|...NK1|....|...NK1|....|...PV1|....|...
  • Optional or repeating segment groups contain multiple segment names inside of square or curly brackets
    • MSH PID [{OBR {OBX}}]

    In this example, multple sets of OBR, followed by OBX result groups can be optionally included.

    MSH|^~\&|...PID|....|...OBR|....|...OBX|....|...OBR|....|...OBX|....|...OBX|....|...

Table of contents

Setup

Install

npm install

Build

$ npm run compile
$ npm run start

Debug

$ npm run dev"MSH"

Usage

$ npm run start"MSH PID [{ IN1 [ IN2 ] [{ OBX }] }]"

Output

[{type:'segment',name:'MSH',required:true,repeating:false},{type:'segment',name:'PID',required:true,repeating:false},{type:'optional-repeating-segment',segments:[{type:'segment',name:'IN1',required:true,repeating:false},{type:'optional-segment',name:'IN2',required:false,repeating:false},{type:'optional-repeating-segment',segments:[{type:'segment',name:'OBX',required:true,repeating:false}],required:false,repeating:true}],required:false,repeating:true}]

About

HL7 - Segment notation PEG parser

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp