3.3.0 • Published 1 year ago

simple-hl7 v3.3.0

Weekly downloads
3,991
License
MIT
Repository
github
Last release
1 year ago

simple-hl7

Node.js CI

A simple library for creating HL7 middleware, based on connect & express.

var hl7 = require('simple-hl7');

///////////////////SERVER/////////////////////
var app = hl7.tcp();

app.use(function(req, res, next) {
  //req.msg is the HL7 message
  console.log('******message received*****')
  console.log(req.msg.log());
  next();
})

app.use(function(req, res, next){
  //res.ack is the ACK
  //acks are created automatically

  //send the res.ack back
  console.log('******sending ack*****')
  res.end()
})

app.use(function(err, req, res, next) {
  //error handler
  //standard error middleware would be
  console.log('******ERROR*****')
  console.log(err);
  var msa = res.ack.getSegment('MSA');
  msa.setField(1, 'AR');
  res.ack.addSegment('ERR', err.message);
  res.end();
});

//Listen on port 7777
app.start(7777); //optionally pass encoding here, app.start(1234, 'latin-1');
///////////////////SERVER/////////////////////

///////////////////CLIENT/////////////////////
var client = hl7.Server.createTcpClient('localhost', 7777);

//create a message
var msg = new hl7.Message(
                    "EPIC",
                    "EPICADT",
                    "SMS",
                    "199912271408",
                    "CHARRIS",
                    ["ADT", "A04"], //This field has 2 components
                    "1817457",
                    "D",
                    "2.5"
                );

console.log('******sending message*****')
client.send(msg, function(err, ack) {
  console.log('******ack received*****')
  console.log(ack.log());
});
///////////////////CLIENT/////////////////////

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

4.0.1

1 year ago

3.3.0

1 year ago

4.0.0-beta.7

2 years ago

4.0.0-beta.6

3 years ago

3.2.4

3 years ago

4.0.0-beta.5

3 years ago

4.0.0-beta.4

3 years ago

4.0.0-beta.3

3 years ago

4.0.0-beta.2

3 years ago

4.0.0-beta.1

3 years ago

3.2.3

4 years ago

4.0.0-beta.0

4 years ago

3.2.2

4 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

7 years ago

2.1.0

8 years ago

2.0.1

8 years ago

2.0.0-b6

8 years ago

2.0.0-b5

8 years ago

1.6.4

8 years ago

2.0.0-b4

8 years ago

1.6.3

8 years ago

2.0.0-b3

8 years ago

2.0.0-b2

9 years ago

2.0.0-b1

9 years ago

1.6.2

9 years ago

1.6.1

9 years ago

1.6.0

9 years ago

1.5.1

9 years ago

1.4.4

9 years ago

1.4.3

9 years ago

1.4.2

10 years ago

1.4.1

10 years ago

1.4.0

10 years ago

1.3.2

10 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.0

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago