hl7js-grammar
HL7 Grammar Parser(hl7js compatible) for Node.js
Installation
install via NPM:
npm install hl7js-grammar
Usage
Initializing:
var parser = ;
reader.read(expression, callback)
/// Basic Parsing/// Ref: http://www.interfaceware.com/blog/hl7-segment-grammar-notation/var grSimple = 'MSH PID NK1 PV1';var grOptional = 'MSH PID NK1 PV1 [PV2]';var grMultiple = 'MSH PID {NK1} PV1 [PV2]';var grOptionalMultiple = 'MSH PID [{NK1}] PV1 [PV2]';var grGroup = 'MSH PID [{OBR {OBX}}]'; var expression = grGroup;parser; /// Prints the following/// ip: MSH PID [{OBR {OBX}}]/// [{"id":"MSH","required":true},{"id":"PID","required":true},{"id":"OBR","required":false,"isArray":true,"isGroup":true,"grammar":[{"id":"OBX","required":true,"isArray":true}]}]
Output format
Output is compatible to be used with hl7js
/// Formatvar grammar = id: 'Segment_ID' required: true isGroup: true isArray: true grammar: ; /// Examplevar oruGrammar = id: 'MSH' required: true id: 'PID' required: true id: 'OBR' required: true isGroup: true isArray: true grammar: id: 'OBX' required: true isArray: true ;
Contributions
Contributions are welcome
Issues
Please file your issues here: