views:

42

answers:

1

My Case:

I'm working on a system that will need to create various X12 files for health care (insurance) transactions and inquiries (Specifically 270 Eligibility and 837 Claim).

I know there are good tools out there (pyx12 specifically) for converting between XML and X12, and actually I've gone as far as importing some components from pyx12 to actually create/manipulate x12 data.

Even considering that, after researching the formats a bit, I'm starting to believe that I could have an easier time generating these formats using a template language. I think that it would be a matter of defining for loops for any segments&loops that need to be repeated per portion claim/inquiry, and the header regions are going to be somewhat static besides whatever element values that could be easily updated by my context.

Almost all of my records are coming out from sqlalchemy so it should be easy enough to loop through my records in the database where relations are very well defined and mapped.

My questions:

  1. I suppose this is less of a question and more of a quest for advice & insight, so feel free to shoot with all of that. IE, Do you think this is a good idea or a waste of time?
  2. For any die-hard x12 people, what kind of problems have you run into building x12 from scratch? What should I watch out for?
  3. Has this style of implementation been done before? Are there examples of specific X12 format templates available, from any language? (I did look with little success)

Just a side note:

We're already working with python and django, so that template language is available to us. If we need to do these things as a background process we'll either do the hacky config environment tricks to get django templates to work outside of our django project or else use jinja instead--which is nearly interchangeable.

+1  A: 

I haven't worked on x12 specifically, but I've often generated all kinds of textual formats by templating, and I can confirm it works like a charm. I would recommend mako (because it basically gives you all the power of Python for your templating), but if you're keen on staying with django-like templates, then jinja2 is definitely the way to go. Its main advantages include speed, ease of debugging, and a richer templating library, as well as the ease of stand-alone use.

Alex Martelli