HIPAA 4010 to 5010: how the XQuery Update Facility helps

February 03, 2009 Data & AI

If you have seen the live or recorded webinar we recently presented about how the DataDirect Data Integration Suite can help dealing with the HIPAA 4010 to 5010 and ICD-9 to ICD-10 migrations, you may have noticed a very good example about how the recently introduced XQuery Update Facility (XUF) helps.
The scenario is relatively simple: XML Converters support bi-directional conversions between HIPAA (4010 or 5010) and XML; as you might expect, the result of a HIPAA 4010 conversion into XML is somewhat different from the XML Schema used by XML Converters to model HIPAA 5010. That implies that leveraging XML Converters to transform a HIPAA 4010 message into HIPAA 5010 is surely possible, but a few changes need to occur in the XML model to accommodate the version update.
Just as an example of what kind of changes we are talking about, consider the following example; this is a portion of what XML Converters generate when transforming a HIPAA 4010 837P ("claim submission") message into XML:[cc lang="xquery"]

00

01 SECRET ZZ SUBMITTERS ID ZZ RECEIVERS ID 090102 1253 U 00401 837000001 1 T :

HC SENDER CODE RECEIVER CODE 20090102 0802 1 X 004010X098A1

...

[/cc]
That XML is consistent with the XML Schema and content of a HIPAA 4010 message; to make it consistent with the XML Schema and content of a HIPAA 5010 message (which is what we need to do to use XML Converters to convert the XML back into the EDI format of a HIPAA 5010 837P message), we need to perform a few changes:
- the "ISA11-InterchangeControlStandards" element needs to be renamed as "ISA11-RepetitionSeparator"
- the "ISA12-InterchangeControlVersion" element needs to be renamed as "ISA12-InterchangeControlVersionNumber" and its value needs to become "00501"
- the "ISA15-UsageIndicator" element needs to be renamed as "ISA15-InterchangeUsageIndicator"
- the "GS08-VersionReleaseIndustry" element needs to be replaced by a "GS08-VersionReleaseIndustryIdentifierCode" element with value "005010X222"

As DataDirect XQuery is a highly performant and scalable XQuery engine, well integrated with XML Converters, that's what I would like to use to take care of these simple changes; if I want to change the XML fragment displayed above as described, the typical way to do that using XQuery 1.0 would be something similar to this:[cc lang="xquery"]

{ /HIPAA/ISA/ISA01-AuthorizationInformationQualifier }, { /HIPAA/ISA/ISA02-AuthorizationInformation }, { /HIPAA/ISA/ISA03-SecurityInformationQualifier }, { /HIPAA/ISA/ISA04-SecurityInformation }, { /HIPAA/ISA/ISA05-InterchangeIdQualifier }, { /HIPAA/ISA/ISA06-InterchangeSenderId }, { /HIPAA/ISA/ISA07-InterchangeIdQualifier }, { /HIPAA/ISA/ISA08-InterchangeReceiverId }, { /HIPAA/ISA/ISA09-InterchangeDate }, { /HIPAA/ISA/ISA10-InterchangeTime },

{ /HIPAA/ISA/ISA11-InterchangeControlStandards/text() }

00501 { /HIPAA/ISA/ISA13-InterchangeControlNumber }, { /HIPAA/ISA/ISA14-AcknowledgmentRequested },

{ /HIPAA/ISA/ISA15-UsageIndicator/text() }

{ /HIPAA/ISA/ISA16-ComponentElementSeparator/text() }

{ /HIPAA/GS/GS01-FunctionalIdentifierCode }, { /HIPAA/GS/GS02-ApplicationSendersCode }, { /HIPAA/GS/GS03-ApplicationReceiversCode }, { /HIPAA/GS/GS04-Date }, { /HIPAA/GS/GS05-Time }, { /HIPAA/GS/GS06-GroupControlNumber }, { /HIPAA/GS/GS07-ResponsibleAgencyCode }, 005010X222

...

[/cc]
That looks like a pretty tedious operation, doesn't it; considering that this example is only about a fragment of the XML model generated by the conversion, you can imagine that the resulting 4010 to 5010 XML model transformation would end up being quite a lot of work.
That's a typical XQuery example in which the XQuery Update Facility shows its power when dealing with XML transformations; using XUF (which is fully supported in the latest version of DataDirect XQuery), you are not forced to map the source XML piece by piece into the target XML; instead, you can define more naturally and in a compact way what the differences are. The above example becomes this straightforward fragment of XQuery when leveraging XUF:[cc lang="xquery"]copy $doc5010 := . modify ( rename node $doc5010/HIPAA/ISA/ISA11-InterchangeControlStandards as QName("", "ISA11-RepetitionSeparator"), replace value of node $doc5010/HIPAA/ISA/ISA12-InterchangeControlVersion with "00501", rename node $doc5010/HIPAA/ISA/ISA12-InterchangeControlVersion as QName("", "ISA12-InterchangeControlVersionNumber"), rename node $doc5010/HIPAA/ISA/ISA15-UsageIndicator as QName("", "ISA15-InterchangeUsageIndicator"), insert node <GS08-VersionReleaseIndustryIdentifierCode>005010X222</GS08-VersionReleaseIndustryIdentifierCode> before $doc5010/HIPAA/GS/GS08-VersionReleaseIndustry, delete node $doc5010/HIPAA/GS/GS08-VersionReleaseIndustry ) return $doc5010 [/cc]
What a difference! Now I can easily understand what I'm changing, and the code is much more compact! A few more changes to the incoming HIPAA 4010 message, and the combination of DataDirect XQuery and XML Converters is able to handle the conversion of the 4010 message into 5010. As mentioned above, you can see the result of the operation in the webinar recording.

So, to summarize, the important points here are:
- The combination of DataDirect XQuery and XML Converters helps dealing with conversions of EDI messages, also when you are dealing with conversions from one EDI format/version to a different one
- The use of the new XQuery Update Facility enhancements to XQuery 1.0 makes many transformation scenarios much easier to implement

Minollo