-
Notifications
You must be signed in to change notification settings - Fork 155
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
HL7 TX type, obx.5 leading space being trimmed PipeParser #103
Comments
We also would like to use leading spaces to indent report sections and lists. In our tests with longer reports this increases readability significantly. |
All primitives (FT, ST, etc) are escaped by default. Are there any other primitives that have this requirement? I'd prefer not to have to put in a one-off just for TX. |
Hi,
Not sure what you mean by escaped, this isn’t an escape problem. The library is trimming leading spaces.
Standard 2.5.1
2.A.78 TX - text data
Definition: String data meant for user display (on a terminal or printer). Such data would not necessarily be left justified since leading spaces may contribute greatly to the clarity of the presentation to the user. Because this type of data is intended for display, it may contain certain escape character sequences Chapter 2: Control Page 2-226 Health Level Seven, Version 2.5.1 © 2007. All rights reserved. April 2007. Final Standard. designed to control the display. Escape sequence formatting is defined in Section 2.7 "Use of escape sequences in text fields". Leading spaces should be included. Trailing spaces should be removed.
From: Usualdosage <notifications@github.com>
Sent: 22 October 2020 20:46
To: nHapiNET/nHapi <nHapi@noreply.github.com>
Cc: Gareth Williams (NWIS - National Data Resource) <Gareth.J.Williams@wales.nhs.uk>; Author <author@noreply.github.com>
Subject: Re: [nHapiNET/nHapi] HL7 TX type, obx.5 leading space being trimmed PipeParser (#103)
All primitives (FT, ST, etc) are escaped by default. Are there any other primitives that have this requirement? I'd prefer not to have to put in a one-off just for TX.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#103 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AJPGNN4IIGD7FQ3GM3AC5CTSMCDX7ANCNFSM4FCJIPSA>.
Rydym yn croesawu derbyn gohebiaeth yng Nghymraeg. Byddwn yn ateb y fath ohebiaeth yng Nghymraeg ac ni fydd hyn yn arwain at oedi. We welcome receiving correspondence in Welsh. We will reply to such correspondence in Welsh and this will not lead to a delay.
|
You previously said:
And you are correct, escape() IS trimming leading and trailing spaces (Escape.cs line 187) for all primitive types, including TX. My question was regarding the other primitive types. Should they also ignore trimming, or is TX "special"? |
@slartibartfast3000 FYI in case you are interested. [Test]
public void TestPreserveFormattingChars()
{
var msg = new ORU_R01();
var ft = new FT(msg);
msg.GetRESPONSE().GetORDER_OBSERVATION().GetOBSERVATION().OBX.ValueType.Value = "FT";
msg.GetRESPONSE().GetORDER_OBSERVATION().GetOBSERVATION().OBX.GetObservationValue(0).Data = ft;
ft.Value = "H \\H\\ N \\N\\ ";
Assert.AreEqual("H \\H\\ N \\N\\ ", ft.Value);
Assert.AreEqual("H \\H\\ N \\N\\ ", PipeParser.Encode(ft, _encodingCharacters));
ft.Value = "H \\C00FF\\ N";
Assert.AreEqual("H \\C00FF\\ N", ft.Value);
Assert.AreEqual("H \\C00FF\\ N", PipeParser.Encode(ft, _encodingCharacters));
} Unit test result below
this is caused by |
Changed behaviour of Escape to (mostly) match hapi implamentation Also added unit test to ensure Escape behaves correctly (some borrowed from hapi)
Changed behaviour of Escape to (mostly) match hapi implementation Also added unit test to ensure Escape behaves correctly (some borrowed from hapi)
Changed behaviour of Escape to (mostly) match hapi implementation Also added unit test to ensure Escape behaves correctly (some borrowed from hapi)
Changed behaviour of Escape to (mostly) match hapi implementation Also added unit test to ensure Escape behaves correctly (some borrowed from hapi)
Changed behaviour of Escape to (mostly) match hapi implementation Also added unit test to ensure Escape behaves correctly (some borrowed from hapi)
Changed behaviour of Escape to (mostly) match hapi implementation Also added unit test to ensure Escape behaves correctly (some borrowed from hapi) Make line feed / carriage return hexadecimal escape sequences configurable
Changed behaviour of Escape to (mostly) match hapi implementation Also added unit test to ensure Escape behaves correctly (some borrowed from hapi) Make line feed / carriage return hexadecimal escape sequences configurable
Changed behaviour of Escape to (mostly) match hapi implementation Also added unit test to ensure Escape behaves correctly (some borrowed from hapi) Make line feed / carriage return hexadecimal escape sequences configurable Add .gitattributes to prevent the line endings of txt files being changed on checkout (was breaking tests)
Changed behaviour of Escape to (mostly) match hapi implementation Also added unit test to ensure Escape behaves correctly (some borrowed from hapi) Make line feed / carriage return hexadecimal escape sequences configurable Add .gitattributes to prevent the line endings of txt files being changed on checkout (was breaking tests)
2.4 standard states:
"2.9.48 TX - text data
String data meant for user display (on a terminal or printer). Such data would not necessarily be left jus-tified since leading spaces may contribute greatly to the clarity of the presentation to the user. "
Unless I've missed a config option or rule, escape() function in Escape.cs always trims leading and trailing spaces for type TX i.e. return result.ToString().Trim();
Perhaps it should be changed to only TrimEnd?
Example OBX...
Before...
OBX|23|TX|^Report Line 23|| Sample stored as serological investigations on samples taken within||||||C|||201607270920
After...
OBX|23|TX|^Report Line 23||Sample stored as serological investigations on samples taken within||||||C|||201607270920
The XMLParser works fine as it has KeepAsOriginalNodes property which the PipeParser does not have
The text was updated successfully, but these errors were encountered: