Attempting to use OOPFactory to parse 271 benefits

2019-07-21 00:15发布

问题:

I'm attempting to use OOPFactory to parse 271 files. (source code here: https://x12parser.codeplex.com/SourceControl/latest) The part I'm struggling with at the moment is getting benefits information. (I can get subscriber and source information just fine).

I've followed the instructions in this post: (Anyone translate a X12 271 Healthcare response) I can get an EligibilityBenefitDocument with the Subscriber and Source information, but the benefit information on the document winds up being either null, empty, or some other unhelpful value.

I've gone through the raw 271 data and verified that the information I'm looking for is indeed in there. (for reference, I've run multiple files from multiple payers)

I've traced through the both X12SteamReader and the X12Parser while they ran, and verified that the data made it all the way through the parser. It looks like things are working well with the parser. I'm not totally sure on how the EligiblityBenefitDocument is supposed to be generated. It looks like it uses some sort of xslt translation that doesn't seem to be working well for my 271 files. I've applied this tweak to my xslt file (https://x12parser.codeplex.com/workitem/2765) - it cleans up some null values, but still doesn't parse correctly.

What should I be looking at next?

  • It's possible that I'm using an unsupported EDI format. I'm not sure how to tell if that's the case
  • I've been programming for a long time, but I've never used the XSLT features of .NET Does anyone have any good links on where to get started there?
  • A quick solution would be AWESOME if anyone has one.

Thx!

========= Edit 1:

Here is my code that kicks things off:

    Dim ediFileString = path_to_my_file
    Dim fstream = New FileStream(ediFileString, FileMode.Open, FileAccess.Read)
    Dim service = New EligibilityTransformationService()
    Dim benefitDoc = service.Transform271ToBenefitResponse(fstream)
    Dim responses = benefitDoc.EligibilityBenefitResponses

I'm calling it from VB.NET instead of C#, but given that it all compiles down to MSIL, and that Source, Receiver, and Subscriber properties are all working, I don't think that's a reason why BenefitInfos would fail.

========= Edit 2: including more code in response to a request for more detail of what I'm trying to do

    Dim ediFileString = path_to_my_file
    Dim fstream = New FileStream(ediFileString, FileMode.Open, FileAccess.Read)
    Dim service = New EligibilityTransformationService()
    Dim benefitDoc = service.Transform271ToBenefitResponse(fstream)
    Dim responses = benefitDoc.EligibilityBenefitResponses

    Dim strClient = ""


    For Each client In benefitDoc.EligibilityBenefitResponses
        Try
            strClient = "MemberID: " + tidyNull(client.Subscriber.MemberId) + " Transaction Control Number: " + tidyNull(client.TransactionControlNumber) + Constants.vbCrLf
        Catch ex As Exception

        End Try
        Try
            strClient += "Member Name: " + tidyNull(client.Subscriber.Name.FirstName) + " " + tidyNull(client.Subscriber.Name.MiddleName) + " " + tidyNull(client.Subscriber.Name.LastName) + Constants.vbCrLf
        Catch ex As Exception

        End Try
        Try
            strClient += "Payer Name: " + tidyNull(client.Source.Name.LastName) + Constants.vbCrLf
        Catch ex As Exception

        End Try
        Try
            strClient += "Date of Birth: " + tidyNull(client.Subscriber.SerializableDateOfBirth) + Constants.vbCrLf
        Catch ex As Exception

        End Try
        Try
            strClient += "Address: " + tidyNull(client.Subscriber.Address.Line1)
            strClient += " " + tidyNull(client.Subscriber.Address.Line2) + " " + Constants.vbCrLf
            strClient += "Address: " + tidyNull(client.Subscriber.Address.City) + ", " + tidyNull(client.Subscriber.Address.StateCode) + ", " + tidyNull(client.Subscriber.Address.PostalCode) + Constants.vbCrLf
        Catch ex As Exception

        End Try

        Dim results As List(Of EligibilityBenefitInformation)


        Try
            results = client.BenefitInfos.FindAll(AddressOf searchPlanActive)
            If results.Count > 0 Then
                strClient += "Active Coverage!" + Constants.vbCrLf

            End If
        Catch ex As Exception
            strClient += "Coverage Type: Couldn't be found"
        End Try

        For Each benefit In client.BenefitInfos
            If benefit.Amount IsNot Nothing Then
                strClient &= " Code: " & benefit.Amount
            End If

            strClient &= " Percentage: " & benefit.Percentage
            Try
                strClient &= " CoverageLevel: " & benefit.CoverageLevel.Description
            Catch ex As Exception

            End Try


            Try
                strClient &= " InPlanNetwork: " & benefit.InPlanNetwork.Description
            Catch
            End Try

            Try
                strClient &= " PlanCoverageDescription: " & benefit.PlanCoverageDescription
            Catch ex As Exception

            End Try

            'strClient &= " Messages: " & benefit.Messages.FindLast()

            Try
                strClient &= " Amount: " & benefit.Amount.Value
            Catch ex As Exception

            End Try


            'strClient &= " Amount: " & benefit.AdditionalInfos
            strClient &= Constants.vbCrLf



        Next
        MsgBox(strClient)
    Next

======= EDIT 3:

I'm attempting to process a 5010 file; OOPFactory says "The built-in specs contain all 4010 standards and some 5010 specifications" https:// x12parser.codeplex.com/ (can't post another working link yet due to lack of reputation points)

======= Edit 4:

The failure seems to be happening in EligibilityTransformationService.cs on line 35. The correct information is making it into the XML, but is not deserializing properly.

var response = EligibilityBenefitDocument.Deserialize(responseXml);

I'm investigating why that might be.

===== Edit 5: In EligiblityTransformationService.cs, starting on line 32, the XML is transformed and then deserialized. The data in question is last seen on line 35 in the responseXml variable, but it never makes it into the response object.

It looks like an issue with the XSLT file.

            transform.Transform(XmlReader.Create(new StringReader(xml)), new XsltArgumentList(), outputStream);
            outputStream.Position = 0;
            string responseXml = new StreamReader(outputStream).ReadToEnd();
            var response = EligibilityBenefitDocument.Deserialize(responseXml);

回答1:

I actually use this same method for my own work at the office. The issues we always run into is the response we receive is either null or random values. What we had to do was continue searching patient information until we found as many possible results that would come back to us. So for example, if we wanted to look up policy date information, we use:

var service = new EligibilityTransformationService();
EligibilityBenefitDocument eligibilityBenefitDocument = service.Transform271ToBenefitResponse(response271Stream);
eligibilityBenefitDocument.EligibilityBenefitResponses = eligibilityBenefitDocument.EligibilityBenefitResponses;

foreach (EligibilityBenefitInformation benefitInfo in eligibilityBenefitDocument.EligibilityBenefitResponses[0].BenefitInfos)
       {               
           if (benefitInfo.InfoType.Code == "V")
               return Tuple.Create(false, "Medicare cannot process");

           if (benefitInfo.InfoType.Code == "6")
               return Tuple.Create(false, "Inactive Policy");


           if (benefitInfo.InsuranceType.Code == "HN" || benefitInfo.InsuranceType.Code == "12")
           {
               try
               {
                   return Tuple.Create(false, "MADV " + benefitInfo.Identifications[0].Id + " " + benefitInfo.RelatedEntities[0].Name.LastName);
               }
               catch
               {
                   return Tuple.Create(false, "MADV");
               }
           }
       }

We still work off and on with these responses to try and get them as accurate as possible, but unfortunately, it seems like the codes can change for different payers, and its a bit time consuming figuring out how each one works until you get their possible response variations.

EDIT:

If there are no benefitInfos in the response, it means that you are submitting the incorrect patient Information. I have the following check in my program:

if(eligiblityBenefitDocument.EligiblityBenefitResponses[0].BenefitInfos.Count() < 1)
     return "Subscriber Info Invalid"


标签: c# xml xslt edi