Skip to content

Commit

Permalink
Fix for Issue 1 reader.read not working with grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshrr committed Apr 8, 2017
1 parent 76538bf commit b8efc14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Reader.prototype.read = function (data, grammarExpression, callback) {

if (!grammarExpression) {
/// Checking in the package
var msgType = message.segments["0"].fields["8"].value;
var msgType = message.mshSegment.messageType;
if (grammar[msgType]) {
grammarExpression = grammar[msgType];
} else {
Expand Down
5 changes: 3 additions & 2 deletions test/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ var oruPath = 'samples/oru.hl7';
/// JSON Parsing
fs.readFile(path.join(__dirname, adtPath), function (err, buffer) {
console.time('ADT_Time');
var reader = new Reader();
var reader = new Reader('JSON');

reader.read(buffer.toString(), 'MSH PID [{NK1}] PV1 [PV2]', function (err, hl7Data, hl7Json) {
//reader.read(buffer.toString(), 'MSH PID [{NK1}] PV1 [PV2]', function (err, hl7Data, hl7Json) {
reader.read(buffer.toString(), function (err, hl7Data, hl7Json) {
console.log(err);

if (!err) {
Expand Down

0 comments on commit b8efc14

Please sign in to comment.