Strict validation in Mirth Connect - hl7

Within a Mirth Connect installation (version 3.5.1), I have setup a channel TCP (LLP) that receive a message HL7 and send an XML with the data of the PID segment (plus some of other useful informations about the HL7 message) to an external site.
I want to validate the message (if contains an error) and filtering the message according to some rules for the data of the segment PID (no name, no surname, etc).
To accompish this requirement, I have write a simple javascript filter and set in the channel (from Summary tab) the strict validation.
But I have this behavior.
If I don't use the strict validation option for the messages, I get all the data of the segment PID within tags like PID.1, PID.2 etc (e.g. for the name I have the following XML structure <PID.5><PID.5.1>XXX</PID.5.1>....</PID.5>).
Instead, if I use the strict validation option the message (in the filter) became different and other tags are present (e.g. for the name I have the following XML structure <PID.5><XPN.1><FN.1>XXX</FN.1></XPN.1>....</PID.5>).
Someone know the why I have this behavior? It is caused by some misconfiguration? Or it is the normal behavior?
Thanks at all for the support.
UPDATE
I realized only now that the structures were not visible.
Now, yes.
Thanks again at all for the support.

This is normal behavior. The default parser is implemented in the mirth hl7v2 datatype itself. When you use the strict parser, it uses the HAPI parser which produces the alternate xml you are seeing that actually conforms to the hl7 specification.

Related

Can single HL7 file contain multiple messages or just one?

I am trying to read & parse HL7 messages and have a question about how they're physically stored in a file.
Can a file contain multiple HL7 messages or will a file only contain single message?
HL7 message files have mostly the extension *.hl7.
There are the FHS (file header), FTS (file trailer) and BHS (batch header), BTS (batch trailer) segments to envelope multiple HL7-messages in one message file.
I recommend to search for "hl7 fhs bhs" in Google.
from HL7eu 2.3.6 HL7 Batch Protocol
[FHS] (file header segment)
{ [BHS] (batch header segment)
{ MSH (one or more HL7 messages)
....
....
....
}
[BTS] (batch trailer segment)
}
[FTS] (file trailer segment)
There is no such a concept in HL7 protocol as "File".
You choose whether to store the message in file or save it in database or elsewhere.
You create a file if you need.
You choose its extension as ".hl7" or ".txt" or else.
You choose whether there should be single message in a file or multiple.
HL7 message when transferred on socket needs to be enclosed in MLLP blocks. You can learn more about it here and here. Here, of-course it matters that you enclose each message separately in MLLP block.
Note that, even though you store the message in file, there is no "file header". So, to summarize it all -- "Its up to you".
I was not aware about FHS (file header) and BHS (batch header) feature (2.3.6 HL7 Batch Protocol) in HL7. I learned it from other answer from #sqlab on this question.
Yes; it is a feature for batching the messages.
But I still do not think the FHS and BHS is "file header" the way we have header for JPEG or many other file types where we can read just header and validate file type.
If there is no FHS segment in message file, we cannot say it is not a HL7 message.
Not sure though, one may have multiple "batches" in single file.
IMO, this more behaves like "batching the messages" than a "file header".
About extension ".hl7"; yes, many organizations use this extension commonly for HL7 files.
But it is not standard or mandatory or forced per say (not mentioned in Specifications).
Just making the extension ".txt" does not make it invalid HL7 file; though some third party applications may not work with it, but that is different problem.

Accept/Content-Type header based processing in Quart and Quart-Schema

Because I am rewriting a legacy app, I cannot change what the clients either send or accept. I have to accept and return JSON, HTML, and an in-house XML-like serialization.
They do, fortunately set headers that describe what they are sending and what they accept.
So right now, what I do is have a decoder module and an encoder module with methods that are basically if/elif/else chains. When a route is ready to process/return something, I call the decoder/encoder module with the python object and the header field, which returns the formatted object as a string and the route processes the result or returns Response().
I am wondering if there is a more Quart native way of doing this.
I'm also trying to figure out how to make this work with Quart-Schema. I see from the docs that one can do app.json_encoder = <class> and I suppose I could sub in a different processor there, but it seems application global, there's no way to set it based on what the client sends. Optimally, it would be great if I could just pass the results of a dynamically chosen parser to Quart-Schema and let it do it's thing on python objects.
Thoughts and suggestions welcome. Thanks!
You can write your own decorator like the quart-schema #validation_headers(). Inside the decorator, check the header for the Content-Type, parse it, and pass the parsed object to the func(...).

MWeb failed publishing to Evernote with "Error Domain=com.evernote.sdk Code=11"

I use MWeb to write markdown documents. Recently I met a problem when I publish markdown document to Evernote, this is the error code:
Error Domain=com.evernote.sdk Code=11
"Content of submitted note was malformed"
UserInfo={NSLocalizedDescription=Content of submitted note was malformed, parameter=Element type "row" must be declared.}
mweb-error
Root cause:
I used "Raw" in the doc, I think word "Raw" maybe a keyword in Evernote API. So if I add "Raw" in the doc, a raw definition must be declared.
My solution
surrounding the word "Raw" with ``. For example:
change "Java API, users need to use Dataset to represent a DataFrame." to "Java API, users need to use `Dataset` to represent a DataFrame."

When use Jena to read RDF(N-Triple),it throws out "com.hp.hpl.jena.shared.InvalidPropertyURIException "

I download an N-Triple file from dbpedia,but when I wanted to read it in to Jena model,some exceptions throw out.Below is a part of this file:
<http://dbpedia.org/resource/Jacky_Cheung>
<http://dbpedia.org/resource/Template:%E8%97%9D%E4%BA%BA> "\u9AD4\u91CD"#zh .
<http://dbpedia.org/resource/Jacky_Cheung> <http://dbpedia.org/resource/Template:%E8%97%9D%E4%BA%BA> "\u8EAB\u9AD8"#zh .
<http://dbpedia.org/resource/Jacky_Cheung> <http://dbpedia.org/resource/Template:%E8%97%9D%E4%BA%BA> "\u8840\u578B"#zh .
<http://dbpedia.org/resource/Jacky_Cheung> <http://dbpedia.org/resource/Template:%E8%97%9D%E4%BA%BA> "\u8A9E\u8A00"#zh .
The exception throws out is:
Exception in thread "main" com.hp.hpl.jena.shared.InvalidPropertyURIException: http://dbpedia.org/resource/Template:%E8%97%9D%E4%BA%BA
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.splitTag(BaseXMLWriter.java:393)
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.startElementTag(BaseXMLWriter.java:368)
at com.hp.hpl.jena.xmloutput.impl.Unparser$3.wTypeStart(Unparser.java:671)
at com.hp.hpl.jena.xmloutput.impl.Unparser.wPropertyEltValueString(Unparser.java:488)
at com.hp.hpl.jena.xmloutput.impl.Unparser.wPropertyEltValue(Unparser.java:473)
at com.hp.hpl.jena.xmloutput.impl.Unparser.wPropertyElt(Unparser.java:339)
at com.hp.hpl.jena.xmloutput.impl.Unparser.wPropertyEltStar(Unparser.java:811)
at com.hp.hpl.jena.xmloutput.impl.Unparser.wTypedNodeOrDescriptionLong(Unparser.java:797)
at com.hp.hpl.jena.xmloutput.impl.Unparser.wTypedNodeOrDescription(Unparser.java:727)
at com.hp.hpl.jena.xmloutput.impl.Unparser.wDescription(Unparser.java:686)
at com.hp.hpl.jena.xmloutput.impl.Unparser.wObj(Unparser.java:642)
at com.hp.hpl.jena.xmloutput.impl.Unparser.wObjStar(Unparser.java:317)
at com.hp.hpl.jena.xmloutput.impl.Unparser.wRDF(Unparser.java:298)
at com.hp.hpl.jena.xmloutput.impl.Unparser.write(Unparser.java:200)
at com.hp.hpl.jena.xmloutput.impl.Abbreviated.writeBody(Abbreviated.java:143)
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.writeXMLBody(BaseXMLWriter.java:500)
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:472)
at com.hp.hpl.jena.xmloutput.impl.Abbreviated.write(Abbreviated.java:128)
at com.hp.hpl.jena.xmloutput.impl.BaseXMLWriter.write(BaseXMLWriter.java:458)
at com.hp.hpl.jena.rdf.model.impl.ModelCom.write(ModelCom.java:277)
at jena.ReadRDF.main(ReadRDF.java:45)
Java Result: 1
The problem is caused by "%E8%97%9D%E4%BA%BA",when use URIref.decode() to decode URI with this string,"%E8%97%9D%E4%BA%BA" represents tow Chinese characters.
But when I use Sesame to read this N-Triple file,it is OK without any problem.
My questions are that whether any way to solve this problem in Jena,and why dbpedia choose N-Triple to be the default RDF syntax?.It works bad with Non-ASCII languages.
Also ,I want to know that,if I want to publish my RDF data as Linked data,but the URIs of resources come with some Chinese and Japanese,should I decode the URIs at first?
Well, your question isn't completely clear because you asked about "reading in a Jena model" but the stacktrace you quoted actually starts with a call to the writer.
Jena, in general, tries very hard to conform to the relevant RDF recommendations from W3C and IETF. In particular, it tries to not generate any URI's which do not conform to the rules for valid URI's. This is compounded in the case of writing XML, because most RDF identifiers are not legal XML element ID's, meaning that you have to split the URI somewhere and use XML namespaces to make the full identifier. Not all RDF toolkits are as particular as Jena is about conforming to some of the rules in the standards.
Things you can try:
do you need to call Model.write() as part of your loading process? You should be able to load and process a model, without the check for legal URI's being invoked.
try writing the output using Turtle format, rather than XML. Turtle doesn't have the same restrictions as XML, and it's a heck of a lot easier for humans to read as well.
if there are particular ill-formed URI's in the data you are loading, look to see if there is a newer version of the data. Illegal URI's in dbpedia has been an issue in the past. If the illegal URI's are still there in the latest version, notify the dbpedia team about them.
try pre-processing your data to remove triples containing illegal URI's before they enter your processing chain.
As for URI's containing Chinese and Japanese characters, Jena conforms to the IRI spec, so as long as your URI's conform to that you should be OK.

How to specify BasicHttpBinding with Savon (RoR)

Im getting this error:
(a:6016) The message with Action 'xxx'
cannot be processed at the receiver,
due to a ContractFilter mismatch at
the EndpointDispatcher. This may be
because of either a contract mismatch
(mismatched Actions between sender and
receiver) or a binding/security
mismatch between the sender and the
receiver. Check that sender and
receiver have the same contract and
the same binding (including security
requirements, e.g. Message, Transport,
None).
And I noticed that the binding used by my provider's WSDL is:
BasicHttpBinding_IxFlow
I guess I need to specify that in my Savon Controller. How can I do that?
Thx.
Since the error message is not really helpful (received this one for various errors) here are some suggestions:
try calling the service (or just generate the xml) from another client and record the XML
compare with Savonrb XML (it prints it to the console, not pretty formatted but good enough)
send the XML you captured from another client trough savon. Does this work? (you can specify custom XML with the block version of client#request method)
Look at (this was the problem with my service):
Order of parameters
Namespace of parameters
SOAPAction header (you can also specify it in the block version)

Resources