25

Looking for a tool/library to convert XML to X12 (270 - medical eligibility request) and then to convert the X12 response (271 - eligibility response) back to XML. This will be embedded in a server application (will consider any target language). I've toyed with idea of writing my own X12 parser and generator but this project will most likely expand to other X12 transactions and I'd like to find a solution that will be extensible.

jdigital
  • 11,926
  • 4
  • 34
  • 51

5 Answers5

12

I came across this: OopFactory X12 Parser - https://x12parser.codeplex.com/releases/view/106524

Incredible. Source code was well structured, everything built on first open, even had unit tests.

Pulled into my project, it converted all the files I tried.

It includes a command line exe which worked - but as a .Net guy the library was really impressive.

-Update-

The short short version comes down to something like this:

var fstream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
var parser = new X12Parser();
var interchange = parser.ParseMultiple(fstream).First();
var x12Xml = interchange.Serialize();
JonK
  • 622
  • 7
  • 13
  • Considering using this as well. Did you pull in the binaries or the sources? How do you accomplish constructing, say, an x12 270 eligibility request? – Isaac Kleinman Jan 15 '14 at 00:25
  • 1
    Updated my post, Isaac – JonK Jan 16 '14 at 18:16
  • So you're using `OopFactory` for parsing `x12` files which you receive; not for generating `x12` to be sent out? – Isaac Kleinman Jan 16 '14 at 18:44
  • Also, you didn't mention: did you build the sources or used the binaries? – Isaac Kleinman Jan 16 '14 at 18:45
  • I used the binaries, and that's correct - I'm just reading the x12 files. I'm pretty certain the libraries allow for x12 generation from the included classes too. – JonK Jan 17 '14 at 22:06
  • Actually see [this discussion](https://x12parser.codeplex.com/discussions/450308) and [my question](http://stackoverflow.com/questions/21125420/compose-x12-270-eligibility-benefit-inquiry-using-oopfactory-x12-parser) regarding (not) using x12Parser for generating a `270`. You may want to curb your enthusiasm somewhat or specify your exact use of the project. – Isaac Kleinman Jan 19 '14 at 17:59
8

I ended up creating my own XML <-> x12 transformation tool. There were some commercial offerings that I came across (one of which, from EtaSoft, is worth checking out for their fine documentation) but ultimately the advantage of a homegrown solution was too great.

I did use the configuration files from X12::Parser as the basis for an X12 parser, essentially turning the config file into code and eliminating the overhead and error handling for managing configuration files that should in theory almost never change.

jdigital
  • 11,926
  • 4
  • 34
  • 51
3

One product I can speak to that you should avoid at all costs is EcMap. Having had about a year of experience with it now in my own employment in an EDI department, I can say I have seldom seen an application with a more poorly designed interface (except perhaps Lotus Notes), more confusing user documentation, and an absolutely ridiculous licensing scheme. It's essentially licensed per CPU (by CPU they mean core, so you're really hosed if you've got a new quad-core CPU) and it's more than 10K per license by the last quote I heard.

BBlake
  • 2,388
  • 1
  • 22
  • 31
2

Look at pyx12.

It includes scripts for X12 to XML and XML to X12.

Why Python? Because you'll often need to customize X12 documents to handle the allowed variations between payers and providers.

S.Lott
  • 384,516
  • 81
  • 508
  • 779
  • I got the impression reading somewhere (don't remember just where) that pyx12 wasn't well supported, and that the code and/or mappings were convoluted. Have you actually used pyx12? If so, what is your impression of it? – jdigital Jan 16 '09 at 04:14
  • Blog Entries: http://homepage.mac.com/s_lott/iblog/architecture/C465799452/E20080111205451/index.html, http://homepage.mac.com/s_lott/iblog/architecture/C465799452/E20080119082306/index.html, http://homepage.mac.com/s_lott/iblog/architecture/C465799452/E20080126181253/index.html – S.Lott Jan 16 '09 at 12:09
  • X12 is convoluted. pyx12 copes reasonably well with the complexity. I rolled my own anyway. But I studied their code to see what they did and why. – S.Lott Jan 16 '09 at 12:10
  • The expression "damned with faint praise" would seem to apply here. WHat about your code -- any plans to release it? – jdigital Jan 16 '09 at 18:39
  • How did this turn out? I'm in the same boat. Thanks! – Bill Martin Mar 31 '09 at 18:14
  • I'm not sure what "turns out" means -- some folks use pyx12; I rolled my own because I felt pyx12 wasn't suitable. – S.Lott Mar 31 '09 at 18:25
0

Here is an example of using pyx12 to write to an XML file

import pyx12.x12n_document
fd_source = "/path/to/edi/file"
output_file = "result.xml"
with open(output_file, 'w') as fd_xml:
    result = pyx12.x12n_document.x12n_document(param=param, src_file=fd_source,
                                               fd_997=None, fd_html=None, fd_xmldoc=fd_xml, xslt_files=None)
Abe
  • 8,623
  • 10
  • 50
  • 74
  • 4
    What are you passing in for `param` ? – eddyizm Aug 19 '20 at 18:05
  • No value is specified for the variable named 'param' on line 5, nor is 'param' declared above the line where it is referenced. I tried using 'None' but that did not work. Without a variable declaration and value assignment or just a value assignment for 'param' code does not work. It appears that param= in line 5 is expecting a class instance with a 'get' function and not a scaler value based on the error message. – Vance McCorkle Jun 11 '23 at 02:54