Now we will finally feed our database into Prolog just to see if what we generated was syntactically correct. We shouldn't bother the reader with the results of our typos here, these have been corrected beforehand. Rather, this section reveals the first severe errors in the HL7 specification. Here is what Prolog complains:
[WARNING: (/usr/share/doc/HL-7/kap4.msg:5) Syntax error: Operator expected] [WARNING: (/usr/share/doc/HL-7/kap7.msg:11) Syntax error: Operator expected]
Further investigations point us directly into the documents: At the definition of the order message we find what is extracted below. Note the matching of brackets and braces. The opening bracket before PID and below ORC are never closed properly. So where do we have to assume the closing brackets to be placed? The author of this document wasn't able to do correct this until he could see Version 2.2 (ballot 1) for the answer. In the table below, corrected brackets are set between asterisks.
ORM ORDER MESSAGE Chapter MSH Message Header II [ { NTE} ] Notes and Comments II [ PID Patient Identification III [{NTE}] Notes and Comments II [ PV1 ] *]* Patient Visit III { ORC Common Order IV [ Any Order Segment E.g., ORO, OBR, RX1 IV [ { NTE } ] [ { OBX } Results Segment VII [ { NTE} ]] Notes and Comments II *]* [ BLG ] Billing segment IV }
The second error is due to the same kind of grouping problem, however, this time we experience one closing brace too much. It's again hard to guess the correct grouping except from a minor mismatch in the PID group, it can be concluded from version 2.2 that what is set between asterisks is wrong, even though there is at least one mismatch in v2.2 too.
ORF Observational Report Chapter MSH Message Header II MSA Message Acknowledgement II { QRD Query Definition V [ QRF ] Query Filter V [ PID ] PATIENT ID III [{NTE*}]*} was: [{NTE]}} { [ ORC ] Order common OBR Observation request VII {[NTE]} Notes and comments II {[OBX] Result VII {[NTE]} Notes and comments II } } * * was: } [DSC] Continuation Pointer V
While we cannot be sure who caused this error, whether it was the original editor or some people of the German section of HL7 there is more evidence for the need to edit this document with different methods. E.g. emacs is an editor, which shows paranthesis matching and warns on mismatched paranthesis while they are typed. This is more convenient than WYSIWYG, since while typing a document control of correctness and consistency should take precedence over immediate control of layout(9).