We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have this PID segment: PID|1|124553|124553^^^TEST^PI~~~||JOHN^DOE|
PID|1|124553|124553^^^TEST^PI~~~||JOHN^DOE|
If i use this code to get the name it works: req.msg.getSegment('PID').getComponent(5, 1)
req.msg.getSegment('PID').getComponent(5, 1)
If i use this code to get the text "TEST", i get an empty string: req.msg.getSegment('PID').getComponent(3, 4)
req.msg.getSegment('PID').getComponent(3, 4)
If i then remove the ~ repetition separator, then it works!
I can re-parse the message manually, but i prefer a more "elegant" solution.
const field = req.msg.getSegment('PID').getField(3, 1); const reparse = new hl7.Parser().parseField(field); console.log(reparse.value[0][3].toString());
Is there a bug about this, or am i wrong in something?
EDIT:
I think you can just check if you have repetition in the field adding something like this in the getComponent function.
if(components.value) components = components.value[0]; // HERE I CHECK IF I HAVE REPETITIONS
The text was updated successfully, but these errors were encountered:
yea, I think this is an issue. v4 has a method called getFieldComponent(3, 1, 1) https://github.com/hitgeek/simple-hl7/blob/v4.0/lib/hl7/segment.js to make this easier.
getFieldComponent(3, 1, 1)
In v3 you need to use getField() and split it like pid.getField(3, 1).split('^')[0]
getField()
pid.getField(3, 1).split('^')[0]
Sorry, something went wrong.
yea, I think this is an issue. v4 has a method called getFieldComponent(3, 1, 1) https://github.com/hitgeek/simple-hl7/blob/v4.0/lib/hl7/segment.js to make this easier. In v3 you need to use getField() and split it like pid.getField(3, 1).split('^')[0]
Oh ok! I made a pull request with the fix mentioned and it works. If you want to try it out to make a minor release just for now.
Thank you.
No branches or pull requests
I have this PID segment:
PID|1|124553|124553^^^TEST^PI~~~||JOHN^DOE|
If i use this code to get the name it works:
req.msg.getSegment('PID').getComponent(5, 1)
If i use this code to get the text "TEST", i get an empty string:
req.msg.getSegment('PID').getComponent(3, 4)
If i then remove the ~ repetition separator, then it works!
I can re-parse the message manually, but i prefer a more "elegant" solution.
Is there a bug about this, or am i wrong in something?
EDIT:
I think you can just check if you have repetition in the field adding something like this in the getComponent function.
The text was updated successfully, but these errors were encountered: