simple-hl7
A simple library for creating HL7 middleware, based on connect & express.
var hl7 = require('simple-hl7');
var app = hl7.tcp();
app.use(function(req, res, next) {
console.log('******message received*****')
console.log(req.msg.log());
next();
})
app.use(function(req, res, next){
console.log('******sending ack*****')
res.end()
})
app.use(function(err, req, res, next) {
console.log('******ERROR*****')
console.log(err);
var msa = res.ack.getSegment('MSA');
msa.setField(1, 'AR');
res.ack.addSegment('ERR', err.message);
res.end();
});
app.start(7777);
var client = hl7.Server.createTcpClient('localhost', 7777);
var msg = new hl7.Message(
"EPIC",
"EPICADT",
"SMS",
"199912271408",
"CHARRIS",
["ADT", "A04"],
"1817457",
"D",
"2.5"
);
console.log('******sending message*****')
client.send(msg, function(err, ack) {
console.log('******ack received*****')
console.log(ack.log());
});
Installation
$ npm install simple-hl7
Features
- Parser
- Message Builder/Editor API
- Server/Client components for TCP and File System Based Interfaces
Philosophy
Make HL7 interfaces and middleware as easy as express web servers.
Examples
See examples & tests folder on github.
People
Author: Bob Rupp bob@rupp.io
License
MIT