UUID in CDA/SPL? - uppercase or lowercase?

Nov 6, 2013

UUIDs may be represented either in uppercase or lowercase. Lowercase is common in Unix, and uppercase is common on windows (COM). HL7 never said, in the context of data types R1, whether UUIDs should be uppercase, lowercase, or either. Though the literal form implies that it should be uppercase:

   INT hexDigit : "0"     { $.equal(0); }
                | "1"     { $.equal(1); }
                | "2"     { $.equal(2); }
                | "3"     { $.equal(3); }
                | "4"     { $.equal(4); }
                | "5"     { $.equal(5); }
                | "6"     { $.equal(6); }
                | "7"     { $.equal(7); }
                | "8"     { $.equal(8); }
                | "9"     { $.equal(9); }
                | "A"     { $.equal(10); }
                | "B"     { $.equal(11); }
                | "C"     { $.equal(12); }
                | "D"     { $.equal(13); }
                | "E"     { $.equal(14); }
                | "F"     { $.equal(15); }

But no one ever read or understood the literal form anyway ;-). More importantly, the schema allows both. Here’s the regex:

 [0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}

Actually, there were earlier versions where it only allowed uppercase, consistent with the abstract literal form. In practice, though, people used a mix of either, and by the time it was brought to committee, it was too late to close the door. We did publish a technical clarification that uppercase only UUIDs were required, but too many implementers had existing CDA and SPL documents with lowercase GUIDs, and so we have to accept either.

In the Australian pcEHR, about 95% of UUIDs are lowercase, and 5% are uppercase. Implementers should be aware that comparison of UUIDs is case insensitive - don’t get caught out doing a case sensitive comparison, because eventually a bug may happen (though when is unsure, since the only cases of re-use of the same UUID at the moments are from the same authoring system, and so far, systems have been consistent. So it’s unlikely, but not impossible).

What we won’t allow in the PCEHR is to use mixed case within the one UUID - all uppercase, or all lowercase.

p.s. The subject came up in conformance, so I thought I’d clarify here, since many PCEHR implementers follow my blog