This project has moved and is read-only. For the latest updates, please go here.

rules for xml generation

Feb 5, 2012 at 8:38 PM

When a 837 claim file is transformed to XML is it a hard rule that each claim becomes a <Transaction ControlNumber="00000000000"> or are there times when claims are bundled together inside of this node? I understand that the claim could be stored under subscriber or patient just want to make sure that it is one claim per transactioncontrol. 

Feb 6, 2012 at 3:33 PM

A transaction usually has multiple claims within it.

This is defined first by the spec, then by the limitations of the clearinghouse or trading partners that you do business with.  You are allowed to have up to 100 claims per patient or subscriber loop, but there is no limit to the number subscriber or patient loops within a transaction.  Clearinghouses or trading partners might define a limit in their companion guides that are based on what their infrastructure can accept.

If you are actually looking for how to uniquely identify a claim, this is usually done with the Patient Control Number CLM01, however since this is controlled by the submitter and won't always be unique across all submitters, it's actually up to your implementation with your clearinghouse to designate some other method for uniquely identifying claims.  In this case you would probably use REF*D9*XXXXX (Claim Identifier for Transmission Intermediaries) to be something unique across all your claims.  If you have multiple ways to receive claims you would have to implement each interface to not overlap their Claim Numbers.

Feb 7, 2012 at 4:31 PM
Edited Feb 7, 2012 at 5:30 PM

Ok so you are not doing any orginization or splitting when you transform to xml? So you do not unbundle claims anywhere but the unbundle tool? Would I would like to do is to unbundle into trasnaction sets but keep them in the same file. Could I do this by using the unbundle and the transform at the same time? Any gotchas to this? The reason for this is to allow the files to be more easily managed but also easier to navigate for our research partners.

Feb 7, 2012 at 9:29 PM

something like this:


Dim fstream As FileStream = New FileStream(sFilename, FileMode.Open, FileAccess.Read)


Dim interchange As Interchange = svX12Parse.Parse(fstream)


 Dim iNumOfTransactions As Integer = 0

Dim lstInterchange As List(Of Interchange) = svX12Parse.UnbundleByLoop(interchange, "2300")


' start a xml doc here and add nodes <?xml version="1.0"?><Interchange><ISA><FunctionGroup> get the values for these nodes from interchange


For Each oInterchange As Interchange In lstInterchange

 ' get transaction segments from each intterchange

 ' add to xml doc


 ' update the <GE> node to the correct transaction count

 ' write out xml to file

svX12Parse = Nothing

fstream = Nothing

interchange = Nothing

Feb 8, 2012 at 8:25 PM

okay I ended up with this. I have only tested it with one file so we will see if it works as I convert mor files. .


Public Function ParseFile(ByVal sFilename As String) As



sbMessage.Append("Transform started - filename: "

& sFilename)


Dim sTransformedFilename As String

svX12Parse = New


 Dim fstream As FileStream = New FileStream(sFilename, FileMode.Open, FileAccess.Read)


Dim interchange As Interchange = svX12Parse.Parse(fstream)

Dim xml As String 

= interchange.Serialize()  


Dim xmlDoc As New XmlDocument



Dim xmlNodeGE As XmlNode = xmlDoc.SelectSingleNode("/Interchange/FunctionGroup/GE")


Dim xmlNodeGE2 As XmlNode = xmlNodeGE


Dim xmlTransactionNodes As XmlNodeList

xmlTransactionNodes = xmlDoc.SelectNodes("/Interchange/FunctionGroup/Transaction"




For Each oTrans As XmlNode In xmlTransactionNodes





Dim lstInterchange As List(Of Interchange) = svX12Parse.UnbundleByLoop(interchange, "2300" )


Dim iNumOfTransactions As Integer = 0


For Each oInterchange As Interchange In lstInterchange


Dim xmlDoc2 As New XmlDocument


Dim xmlTransNodes As XmlNodeList = xmlDoc2.SelectNodes("/Interchange/FunctionGroup/Transaction")


For Each oTrans2 As XmlNode In xmlTransNodes


Dim xmlNode2 As XmlNode = xmlDoc.ImportNode(oTrans2, True)




iNumOfTransactions = iNumOfTransactions + xmlTransNodes.Count



Dim xmlNode3 As XmlNode = xmlDoc.ImportNode(xmlNodeGE2, True)




"/Interchange/FunctionGroup/GE/GE01" ).InnerText = iNumOfTransactions.ToString

svX12Parse =


fstream =


interchange =


lstInterchange =


sTransformedFilename =

Path.GetFileNameWithoutExtension(sFilename) & ".xml"

sTransformedFilename = sProductionDir & sTransformedFilename


My.Computer.FileSystem.WriteAllText(sTransformedFilename, xmlDoc.InnerXml, False )

xmlDoc =



If File.Exists(sTransformedFilename)



"File transformed - filename: " & sTransformedFilename)


File.Move(sFilename, sArchiveDir & Path.GetFileName(sFilename))


"File moved to archive - filename: " & sArchiveDir & Path .GetFileName(sFilename))


Return True



"File failed - filename: " & sFilename)


Return False


End If


End Function

Feb 8, 2012 at 8:27 PM

If you have a better or idea or if this functionality is already present then I would love to hear it. Thank you very much for this tool. It is very slick.