smat-stream
v1.1.7
Published
Given a SMAT msg file and associated idx file, parses the hl7 messages in a stream
Downloads
1
Maintainers
Readme
js-smat-parser
Given a SMAT msg file and associated idx file, parses the hl7 messages in a stream.
This stream reads the file in reverse order from end to beginning, so as to return messages in order of most recent to least.
NOTE: There must be both an .idx and .msg file with the same name (except the file extension) in the same directory for this to work
Usage
const SMATStream = require("smat-stream");
const stream = new SMATStream({
filename: "cpcs_lsu_adt.live_abs.abs_mt_out_out.02252020" // for example
})
stream.on("data", chunk => {
console.log(chunk); // { meta: {...}, rawMessage: "..." }
})
Data Chunks
Each data chunk represents a single hl7 message and its .idx file entry.
The two fields in each chunk are:
- meta: An object containing info from the .idx file
- rawMessage: the HL7 message as a raw string
So Meta
The meta object has the following fields
- MID: message id broken into
- DOMAIN
- HUB
- NUM
- SRCMID
- DOMAIN
- HUB
- NUM
- TYPE
- SOURCECONN
- ORIGSOURCECONN
- DESTCONN
- TIME
- PRIORITY
- DATAFMT
- SAVECONTEXT
- OFFSET: the byte offset of the start of the message in the .msg file
- LENGTH: the number of bytes in the message
- FLAGS
- STATE
- GROUPMID
- DOMAIN
- HUB
- NUM
- XLTTHREAD
- RETRIES
- SKIPXLT
- USERECOVERDB
- GROUPID
- TIMEIN
- TIMEXLT
- TIMEOUT
- TIMEQCUR
- TIMEQTOT
- TIMEREC
- TIMESTOR
- TIMEARC
- DBTABLE
- SEPCHARS
- DRIVERCTL
- USERDATA
TCL Keyed List Grammar
NOTE: TCL Keyed Lists are just lists of lists with 2 elements representing key/value pairs
list -> LCB value* RCB
value -> ID | NUMBER | list