Best way to convert XML to X12 and X12 to XML
Asked Answered
H

5

26

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.

Hierarchize answered 16/1, 2009 at 2:26 Comment(0)
H
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.

Hierarchize answered 25/8, 2009 at 22:36 Comment(0)
Z
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();
Zajac answered 18/7, 2013 at 16:32 Comment(6)
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?Overside
Updated my post, IsaacZajac
So you're using OopFactory for parsing x12 files which you receive; not for generating x12 to be sent out?Overside
Also, you didn't mention: did you build the sources or used the binaries?Overside
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.Zajac
Actually see this discussion and my question regarding (not) using x12Parser for generating a 270. You may want to curb your enthusiasm somewhat or specify your exact use of the project.Overside
H
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.

Hierarchize answered 25/8, 2009 at 22:36 Comment(0)
L
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.

Lukelukens answered 21/8, 2009 at 23:49 Comment(0)
T
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.

Timmie answered 16/1, 2009 at 2:45 Comment(6)
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?Hierarchize
Blog Entries: homepage.mac.com/s_lott/iblog/architecture/C465799452/…, homepage.mac.com/s_lott/iblog/architecture/C465799452/…, homepage.mac.com/s_lott/iblog/architecture/C465799452/…Timmie
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.Timmie
The expression "damned with faint praise" would seem to apply here. WHat about your code -- any plans to release it?Hierarchize
How did this turn out? I'm in the same boat. Thanks!Fatally
I'm not sure what "turns out" means -- some folks use pyx12; I rolled my own because I felt pyx12 wasn't suitable.Timmie
J
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)
Juglandaceous answered 19/9, 2018 at 1:14 Comment(2)
What are you passing in for param ?Babbling
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.Sinusitis

© 2022 - 2024 — McMap. All rights reserved.