rules for xml generation

Feb 5, 2012 at 7: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. 

Coordinator
Feb 6, 2012 at 2: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 3:31 PM
Edited Feb 7, 2012 at 4: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 8: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

Next

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

 ' write out xml to file

svX12Parse = Nothing

fstream = Nothing

interchange = Nothing

Feb 8, 2012 at 7: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

Boolean 

 

sbMessage.Append("Transform started - filename: "

& sFilename)

 

Dim sTransformedFilename As String

svX12Parse = New

X12Parser

 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

xmlDoc.LoadXml(xml)

 

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

oTrans.ParentNode.RemoveChild(oTrans)

 

Next

xmlNodeGE.ParentNode.RemoveChild(xmlNodeGE) 

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

xmlDoc2.LoadXml(oInterchange.Serialize())

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

 

For Each oTrans2 As XmlNode In xmlTransNodes

 

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

xmlDoc.SelectSingleNode(

"/Interchange/FunctionGroup").AppendChild(xmlNode2)  

Next

iNumOfTransactions = iNumOfTransactions + xmlTransNodes.Count

Next

 

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

xmlDoc.SelectSingleNode(

"/Interchange/FunctionGroup").AppendChild(xmlNode3)

xmlDoc.SelectSingleNode(

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

svX12Parse =

Nothing

fstream =

Nothing

interchange =

Nothing

lstInterchange =

Nothing

sTransformedFilename =

Path.GetFileNameWithoutExtension(sFilename) & ".xml"

sTransformedFilename = sProductionDir & sTransformedFilename

 

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

xmlDoc =

Nothing

 

If File.Exists(sTransformedFilename)

Then

sbMessage.Append(

"File transformed - filename: " & sTransformedFilename)

 

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

sbMessage.Append(

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

 

Return True

Else

sbMessage.Append(

"File failed - filename: " & sFilename)

 

Return False

 

End If

 

End Function

 
Feb 8, 2012 at 7: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.