This project has moved. For the latest updates, please go here.

271 Display Comments for EB03 Service Type Code

Jul 8, 2013 at 10:39 PM

Could someone please help?

I cannot seem to find how to show the Comment node for EB03 (or any children of EB03)

This is what I currently get while parsing 271;
<Loop LoopId="2110C" Name="Subscriber Eligibility or Benefit Information">
<!-- Eligibility or Benefit Information Code --> 
<!-- Active Coverage --> 
  <EB02 /> 
<!-- Industry Code --> 
And this is the desired outcome;
<Loop LoopId="2110C" Name="Subscriber Eligibility or Benefit Information">
<!-- Eligibility or Benefit Information Code --> 
<!-- Active Coverage --> 
  <EB02 /> 
<!-- Industry Code --> 
      <!-- Professional (Physician) Visit - Office -->
      <!-- Chiropractic -->
I haven't quite figured it out yet but, it seems maybe these comments are created somewhere in WriteXml method in OopFactory.X12.Parsing.Model.Segment.cs (around line 194).

Any information would be greatly appreciated!
Jul 11, 2013 at 4:54 PM
I have not personally been using these comments but i believe they can be added/modified by changing the Ansi-4010Specification.xml. Fo a search in the xml for the following
 <!-- 270/271 Segments --> -->"
Once there you will find a segment EB defined along with how it does comments for each element value ect. You should be able to add your own segment information here where appropriate. In your example you would want to add a new one such as
  <Segment SegmentId="EB03">
    <Element Name="Your XML Comment for EB0301 HERE" Type="ID" MinLength="1" MaxLength="2">
      <Allowed ID="98">Professional (Physician) Visit - Office</Allowed>
        <!--your other values/comment descriptions here -->
    <Element Name="Your XML Comment for EB0302 HERE" Type="ID" MinLength="1" MaxLength="2">
      <Allowed ID="33">Chiropractic</Allowed>
        <!--your other values/comment descriptions here -->

<!-- the two samples above show how to handle ones that comment a specific defined value  the next two are more basic -->
    <Element Name="Your XML Comment For EB0303"/>
    <Element Name="Your XML Comment For EB0304"/>
Again I do not modify this information but if I am incorrect I have hopefully at least set you on the right path.
Jul 11, 2013 at 10:14 PM
Thank you for the information. I started to look in this direction (I am using 5010 spec btw) but, the problem I've run into (and maybe I'm not looking at it right) is that EB0301, EB0302 etc will not always be the same so I cannot rely on a static comment based on these EB03* elements.

Maybe I've misunderstood the code but, I was attempting to find the reason why each ServiceType (lookup) only has the Code and not the Description in EligibilityBenefitDocument (as opposed to other lookup types like InfoType which has Code and Description. I was under the assumption that this ServiceType Description (in EligibilityBenefitDocument object) is set based on this Comment.

I've created a work around for now which uses the ServiceType code to get the required element and InnerText and set the ServiceType.Description based on the InnerText but, I have a suspicion that this is not the ideal solution because it seems as though maybe this should already be occurring and is possibly a bug? I could be wrong.

What I've done as a workaround (in case anyone else reads this);
1.) Created new EligibilityTransformService
2.) Created new Transform271ToBenefitResponse which (basically along with some helper methods) Modifies EligibilityBenefitDocument after it's created

i.e., pass BenefitInfos[0].ServiceTypes[n].Code to helper which returns InnerText of specific element and sets ServiceType.Description based on return InnerText
 <QualifierSet Id="1365" Name="Service Type Code">
    <Allowed ID="1">Medical Care</Allowed>
    <Allowed ID="2">Surgical</Allowed>
    <Allowed ID="3">Consultation</Allowed>
    <Allowed ID="4">Diagnostic X-Ray</Allowed>
    <Allowed ID="5">Diagnostic Lab</Allowed>
    <Allowed ID="6">Radiation Therapy</Allowed>
Forgive my code, it's ugly but, it's working for now;

Helper methods inside custom EligibilityTransformationService.cs;
private EligibilityBenefitDocument _SetServiceTypeDescriptions(EligibilityBenefitDocument benefitDocument, XmlDocument ansiSpecification)
            List<EligibilityBenefitInformation> benefitInfo = benefitDocument.EligibilityBenefitResponses[0].BenefitInfos;

            foreach (EligibilityBenefitInformation info in benefitInfo)
                foreach (var serviceType in info.ServiceTypes)
                    string code = serviceType.Code;
                    string id = "1365";
                    XmlNamespaceManager nsManager = new XmlNamespaceManager(ansiSpecification.NameTable);
                    nsManager.AddNamespace("ansi", "");
                    string xpathExpression = string.Format("descendant::ansi:QualifierSet[@Id='{0}']/ansi:Allowed[@ID='{1}']", id, code);

                    XmlNode ansiSpecNode = ansiSpecification.SelectSingleNode(xpathExpression,nsManager);
                    serviceType.Description = (this._GetServiceTypeDescription(code,ansiSpecNode));
            return benefitDocument;

        private string _GetServiceTypeDescription(string code, XmlNode ansiSpecNode)
            return ansiSpecNode.InnerText;
ServiceType will now have the following instead of Description being Null;

Code = "30",
Description = "Health Benefit Plan Coverage"

Please let me know If you have any suggestions to make ServiceType have Description, otherwise, I can live with my workaround for now.
Jul 11, 2013 at 10:40 PM
Edited Jul 11, 2013 at 10:43 PM
After reviewing how the 5010 specification.xml works i would assume the following would fix your issue without code changes:

    <Element Name="Industry Code" Reference="03" Type="AN" MinLength="1" MaxLength="30" />
    <Element Name="Industry Code" Reference="03" Type="AN" MinLength="1" MaxLength="30" QualifierSetRef="Service Type Code" />
edit : just wanted to add this is untested and merely a guess
Jul 12, 2013 at 2:29 PM
Edited Jul 12, 2013 at 3:31 PM
Hi, thank you again for the information. I tried making this change to the specification but, it didn't appear to work. As you can see in the image below, the Description is NULL;


This time, I made the change in OopFactory library Ansi-5010Specification.xml, recompiled and switched back to using the OopFactory EligibilityTransformationService.cs (as opposed to custom EligibilityTransformationService class).

Any thoughts?
Jul 12, 2013 at 3:21 PM
I will actually try to review and see how it really works instead of speculating a bit later today and give you a real solutions. I hate providing these guesses that end up not working =)
Jul 12, 2013 at 3:26 PM
It's no problem, I very much appreciate the help. I too will continue to review the source and update if I find anything.
Jan 13, 2014 at 3:34 PM
I think the fix is to change this line in Ansi-5010Specification.xml

<Segment SegmentId="EB">
<Element Name="Service Type Code" Reference="03" Type="ID" MinLength="1" MaxLength="2" QualifierSetRef="Service Type Code" />

The key points are
  • change Type="AN" to Type="ID".
  • Add the appropriate qualifier set QualifierSetRef="Service Type Code"
The serializer method will add the comment if the Type is an identifier, and with an associated description from the QualifierSetRef.

The Type "AN" means a free form text block, so the parser doesn't know there are predefined descriptions for each code. This is where the Type="ID" comes in.
IMO, this is a bug in the 5010Specification.xml file definition for this element, I'm not sure why it was "Industry Code" to start with, it seems "Service Type Code" is better.

Hope this helps, even though a little late.
Jan 13, 2014 at 3:43 PM
Thank you! I will try this. I've been using my workaround but, this will definitely be better.