Hapi 2.1 version's MSH-9 filed concerns - hl7

I'm using Hapi release version 2.1 and it works perfectly. But I have an issue with an error response that I get from Hapi. My request is:
MSH|^~\&|||||20130612174137.811+0530||OUL^R22^OUL_R22|2801|T|2.5
And my response is:
MSH|^~\&|||||20130612174152.606+0530||ACK^R22^ACK|1624|T|2.5
MSA|AE|2801
ERR|||207^Application internal error^HL70357^^^^^^errmsg|E
In the above response, if you check the MSH-9 field, it is:
ACK^R22^ACK
Shouldn't that be "ACK"? Because it is additionally adding "R22" message to that field, which is not valid. And I suspect that it picks that from the original request.
Can anybody help me on this? How can I avoid that invalid segment?
Why does Hapi additionally add that field in the MSH-9 field?

As the definition of the field MSH-9 in HL7 Version 2.5 is
<Message Code (ID)> ^ <Trigger Event (ID)> ^ <Message Structure (ID)>
this is a correct and valid implementation.
Maybe you can get an generic acknowledgement by using either an older message version in MSH-12 or by using an generic message template.

Related

In the .net Graph SDK, Range().Clear() gives compilation error and doesn't work as told in documentation

I am using .net Graph SDK (Microsoft.Graph) version 3.21. I am following the below documentation link from Microsoft:
https://learn.microsoft.com/en-us/graph/api/range-clear?view=graph-rest-1.0&tabs=csharp
In this link, it is said that we can clear a range of cells and C# code to do so is given. When I try, I am getting error for the Clear
I am able to get Range, but the clear shows error.
Error CS1061 'IWorkbookWorksheetRangeRequestBuilder' does not contain a definition for 'Clear' and no accessible extension method 'Clear' accepting a first argument of type 'IWorkbookWorksheetRangeRequestBuilder' could be found (are you missing a using directive or an assembly reference?)
Am I missing something? What else am I supposed to do?
Note:
All other Graph calls work. I am able to retrieve Range:
var range = await _graphServiceClient.Sites["root"].Drives[file.ParentReference.DriveId]
.Items[file.Id].Workbook.Worksheets["Sheet1"].Range().Request().GetAsync();
It seems a bug, not only Clear but also Delete/Format/Merge... are not contained. There is a similar issue. The methods work in Java but not C#, Filipowicz251 has commented it in Github.
You could call HTTP Request to clear range values without sdk.
POST https://graph.microsoft.com/v1.0/me/drive/items/{id}/workbook/names/{name}/range/clear
Content-type: application/json
Content-length: 32
{
"applyTo": "applyTo-value"
}
Example here: https://vincentlauzon.com/2017/01/31/using-microsoft-graph-api-to-interact-with-azure-ad/

Validate XML against schematron using SAXON EE edition

I am evaluating SAXON EE edition to validate XML against xsd and schematron.
Can someone help me in resolving the following queries:
While validating xml document against xsd, can we also get xpath of that error node along with errors in plain text. Currently I am getting error only.
Can we validate xml against schematron using Saxon EE version? Any code sample would be a great help.
Thanks.
1. While validating xml document against xsd, can we also get xpath of that error node.
Yes, the error information includes an XPath reference to the invalid node (in most cases: there are some cases such as duplicate IDs where there isn't one specific node in error).
If you generate an XML validity report using SchemaValidator.SetValidityReporting() then the resulting report will include the path information. Here's an example:
<?xml version="1.0" encoding="UTF-8"?>
<validation-report xmlns="http://saxon.sf.net/ns/validation"
system-id="file:/Users/mike/repo2/samples/data/books-invalid.xml">
<error line="3"
column="17"
path="/Q{}BOOKLIST[1]/Q{}BOOKS[1]/#x"
xsd-part="1"
constraint="cvc-complex-type.3">Attribute #x is not allowed on element <BOOKS></error>
<error line="10"
column="17"
path="/Q{}BOOKLIST[1]/Q{}BOOKS[1]/Q{}ITEM[1]/Q{}PRICE[1]"
xsd-part="2"
constraint="cvc-datatype-valid.1">The content "$0.2" of element <PRICE> does not match the required simple type. Cannot convert string to decimal: $0.2</error>
<error line="21"
column="20"
path="/Q{}BOOKLIST[1]/Q{}BOOKS[1]/Q{}ITEM[2]/Q{}PUB-DATE[1]"
xsd-part="2"
constraint="cvc-datatype-valid.1">The content "2002-02-31" of element <PUB-DATE> does not match the required simple type. Invalid date "2002-02-31" (Non-existent date)</error>
<error line="42"
column="22"
path="/Q{}BOOKLIST[1]/Q{}BOOKS[1]/Q{}ITEM[3]/Q{}REPUTATION[1]"
xsd-part="1"
constraint="cvc-complex-type.2.4">In content of element <ITEM>: The content model does not allow element <REPUTATION> to appear immediately after element <WEIGHT>. No further elements are allowed at this point. </error>
<meta-data>
<validator name="SAXON-EE" version="9.8.0.9"/>
<results errors="4" warnings="0"/>
<schema file="books.xsd" xsd-version="1.1"/>
<run at="2018-03-07T15:22:04.847Z"/>
</meta-data>
</validation-report>
You can also get the information if you supply an IInvalidityHandler as a callback to the SchemaValidator, though this requires a bit more digging. Saxon calls your IInvalidityHandler supplying a StaticError object (which is a bit of a misnomer). The StaticError object doesn't have the path information directly available, but it contains a reference to an XPathException object which can be cast to a ValidationException, and ValidationException has a method getPath() which returns this information if available.
2. Can we validate xml against schematron.
Saxon doesn't include a schematron validator per se, though many of the third-party tools that do schematron validation make use of Saxon "under the hood". I'm not up-to-date with the situation on .NET - but essentially there are two kinds of Schematron processor: those that generate XSLT code from the schematron schema (which typically use Saxon both to generate the XSLT and to execute it), and "native" processors. Searching for "schematron on .NET" gives you quite a number of projects, but I have no idea of their current status or quality.

Unable to Parse NTE if the segment order is changed

I got a HL7 message with NTE segment. The HL7 message type RDE_O11 and version 2.5. While passing message with NTE, NHAPI is not parsing it. So with the following message,
MSH|^~\&|xxxx|xxxx|||||RDE^O11^RDE_O11||P|2.5||||||ASCII|||
PID||||||||||||N|||||||||
PV1|||||||||
ORC|||||||
RXO||||||||||||||||||||||||||
RXR||||||
RXE|||||M
NTE|1||#2 from 10/19/15 amb|RE
TQ1||
TQ1|||PO Q6H PRN|A||
RXR||||||
If I change the position of NTE right after MSH, NHAPI is able to parse it.
MSH|^~\&|xxxx|xxxx|||||RDE^O11^RDE_O11||P|2.5||||||ASCII|||
NTE|1||#2 from 10/19/15 amb|RE
PID||||||||||||N|||||||||
PV1|||||||||
ORC|||||||
RXO||||||||||||||||||||||||||
RXR||||||
RXE|||||M
TQ1||
TQ1|||PO Q6H PRN|A||
RXR||||||
What kind of error are you getting? The HL7 specification for the RDE_O11 message structure does allow NTE segments to appear after RXE (among several other locations). So it ought to work.

Quickfixj rejecting incoming message with "Tag appears more than once" where there is no repeated tag

Quickfixj is rejecting the following logon message:
8=FIXT.1.1|9=163|35=A|34=77086|1128=9|49=XXxVENUExXX|56=XXxUSxXX|52=20140704-11:24:22.308|108=4|98=0|1137=9|789=78069|58=RFA:f718fdb8-2ed3-4e0b-965f-4305188d06f9|1409=0|1407=100|10=013|
The actual log entry for it is:
20140704-11:24:22.316 ERROR [QFJ Message Processor] quickfixj.errorEvent - FIXT.1.1:XXxUSxXX->XXxVENUExXX: Rejecting invalid message: quickfix.FieldException: Tag appears more than once, field=1407: 8=FIXT.1.1^A9=184^A35=A^A34=77086^A49=XXxVENUExXX^A52=20140704-11:24:22.308^A56=XXxUSxXX^A1128=9^A58=RFA:f718fdb8-2ed3-4e0b-965f-4305188d06f9^A98=0^A108=4^A553=USRC^A554=test234^A789=7806 9^A1137=9^A1407=100^A1409=0^A10=093^A
Tag 1407 doesn't appear more than once though. We're using Quickfixj 1.5.3. With a FIX Version 5.0 SP2 - EP100 data dictionary. I can't see any issues with the data dictionary entries. The Logon message fields are all flat (except for the optional MsgTypeGrp which is not being used). Have tried with ValidateFieldsOutOfOrder as both Y and N. Config entries are:
[DEFAULT]
ConnectionType=initiator
HeartBtInt=4
FileStorePath=/dir/storeLoc
FileLogPath=/dir/logLoc
StartDay=sun
StartTime=09:55:00
EndDay=sun
EndTime=09:45:00
UseDataDictionary=Y
AppDataDictionary=/dir/dicLoc/QuickFIX_EP100.xml
TransportDataDictionary=/dir/dicLoc/QuickFIX_EP100.xml
ValidateFieldsOutOfOrder=N
EnableNextExpectedMsgSeqNum=Y
# Only the SP2 version supported
DefaultApplVerID=9
DefaultApplExtID=100
BeginString=FIXT.1.1
TargetCompID=XXxVENUExXX
TargetSubID=XXxSUBxXX
# Endpoint
SocketConnectHost=xxx.xxx.xxx.xxx
SocketConnectPort=XXXXX
[SESSION]
SenderCompID=XXxUSxXX
SenderLocationID=XXxLocxXX
Anyone have any ideas what could cause this. It couldn't be because there is '1407' in today's date?

HL7 parser to parse v2.7 messages in java

I'm looking for a HL7 parser that would parse v2.7 messages. I have tried Hapi but it has support only upto v2.6.
Can you anyone please provide any suggestions in parsing v2.7 messages?
Additionally to allowing unknown versions (like nradov pointed out), you need to inject the right model class factory, e.g. GenericModelClassFactory, into the parser or you might end up with an exception:
ca.uhn.hl7v2.HL7Exception: No map found for version null. Only the following are available: [V22, V25, V21, V23, V24]
So the complete solution is
use the GenericModelClassFactory
allow unknown versions
and it looks like this:
final ModelClassFactory modelClassFactory = new GenericModelClassFactory();
final PipeParser parser = new PipeParser(modelClassFactory);
parser.getParserConfiguration()
.setAllowUnknownVersions(true);
final Message message = parser.parse(message);
Like nradov said, you can use HAPI to parse V2.7. But you'll need to call this to prevent the "2.7 is not recognized" Exception:
parser.getParserConfiguration().setAllowUnknownVersions(true);
You can still use HAPI to parse HL7 V2.7. It just doesn't have convenient methods to easily access the new fields that were added after V2.6.

Resources