Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newlines in Segment Names #87

Open
jasondalycan opened this issue Jan 21, 2023 · 1 comment
Open

Newlines in Segment Names #87

jasondalycan opened this issue Jan 21, 2023 · 1 comment

Comments

@jasondalycan
Copy link

My platform is Debian Bullseye (WSL2), Node.js 16.

When accessing req.msg.segments within the server component the segment names all appear to be prefixed with a newline:

See the following example:

console.log(req.msg.segments);

image

The message is sent via dcm4che hl7send and contains the following:

image

@hitgeek
Copy link
Owner

hitgeek commented Feb 12, 2023

my guess would by the incoming messages are using a different segment seperator, probably \r\n ... the default the parser expects is \r https://github.com/hitgeek/simple-hl7/blob/master/lib/hl7/parser.js#L17 ..

You can pass a different segment seperator via the parser options. When using a server component, you can pass a parser to use. https://github.com/hitgeek/simple-hl7/blob/master/lib/server/tcp-server.js#L23

so it might look something like

var parser = new hl7.Parser({ segmentSeperator: '\r\n' })

var server = new hl7.tcp( { parser: parser });

Also you could try using v4, which is also availible on npm. v4 will inspect the message and use the correct segmentSeperator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants