I ended up answering my own question as I wrote this message up but
I figured I'd post it anyway.  This may be a well known issue (to everyone but 
me I guess) but, since it took a while to find any kind of a reference to the 
problem and many HL7 implementation guides still specify the use of these 
problem data types, this post might be helpful to some of you on this 
list...I've noticed several composite
data types that have issues parsing and encoding.  The composites in
question contain a composite subcomponent which in turn also contains a
composite sub-component (a sub-subcomponent).For instance, the TQ type (used in 
OBR
for Quantity/Timing) is defined as being composed of among other things
a CQ (Quantity) sub-component.  The CQ data type contains a CE (units)
sub-component.  If I look at an ORU_R01's OBR segment with VA's Message
Workbench OBR-27's Units sub-component is flagged as "Illegal sub-sub
components discovered. Data will be lost."  I thought that since the HAPI API 
represented this data structure, I might use it to configure and encode a 
message to get to the bottom of the problem:ca.uhn.hl7v2.model.v23.datatype.TQ 
tq = oru_23.getRESPONSE(0).getORDER_OBSERVATION(0).getOBR().getQuantityTiming();
            tq.getQuantity().getQuantity().setValue("2");
            tq.getQuantity().getUnits().getIdentifier().setValue("UNITS");
            tq.getQuantity().getUnits().getText().setValue("TEXT");            
tq.getQuantity().getUnits().getNameOfCodingSystem().setValue("CODE");           
 tq.getQuantity().getUnits().getAlternateIdentifier().setValue("AUNITS");       
     tq.getQuantity().getUnits().getAlternateText().setValue("ATEXT");          
  
tq.getQuantity().getUnits().getNameOfAlternateCodingSystem().setValue("ACODE");Encoding
 the message ends up producing the following output for OBR-27 (Quantity (TQ) 
is the very first component): 
2&UNITS^^text^23&text^949498432&X^X^abc^X^long default textQuantity (2) is 
present as is the first element of Units (UNITS).  Given HL7 ER7 delimiter 
usage rules, the missing output is inevitable.  The HL7 Specification says in
2.8.6 CM - composite:"Note that since HL7 delimiters are not recursive, an HL7 
data type
containing components cannot be a subcomponent. When this level of
detail is needed, each component of the HL7 data type can be encoded as
a separate subcomponent. For an example of this, see the encoding of
the filler order number in the order sequencing component of the
Timing/Quantity data type."The existence of a data type like TQ is in direct 
violation of the rules set out in 2.8.6 and there are other data types that 
also run afoul of 2.8.6.  Searching HL7.org's mailing lists I turned this up:  
http://lists.hl7.org/read/attachment/79260/1/htmlversion.html which pretty much 
says that data types with sub-subcomponents are a fundamental mistake in the 
HL7 2.x specification:"The places in the old versions v2.4- where 
sub-sub-components arise are broken; we have no workable solution for how to 
encode them at all. You can do one of these things:



* invent your own delimiter* refrain from putting data in the sub-components 
other than the first* use XML (you can represent it, but it won't pass schema 
validation)"

_________________________________________________________________
Live Search Maps – find all the local information you need, right when you need 
it.
http://maps.live.com/?icid=wlmtag2&FORM=MGAC01
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Reply via email to