Form/Template Fill-in the blanks

allan kawenks at gmail.com
Sat Jul 25 14:04:45 EDT 2009


I'm attempting to create a generic python script that will take an EDI
document specification and a database of transactions and be able to
generate a raw EDI file (ansi X12).

I'm looking for ideas on how best to use the strengths of Python to
implement this. I've initially tackled the EDI 812 specifications and
narrowed this down to a specific implementation by a company. This
narrowed down version is what I want to achieve for output. But I want
the script to be generic enough such that I can plug-in another EDI
specification + a database transaction set and it will output the
proper raw file accordingly.

My initial thought was to use:
1. .ini files to declare the EDI configuration
2. Use SQLAlchemy as ORB to simplify access to database objects.

INI file configuration:
* A "root" INI file indicates other INI files that define each segment
of the EDI document.
* Each segment INI defines the data elements of each segment and the
behavior of the segment (one instance or multiple-instance as in a
loop, sequence order, segment code, etc.)
* Specify data elements as either constant, system function (like
datetime), database field or object method (object being the
segment's)
* Load all the ini configuration into a "template" object. Each
segment ini maps to its own segment object.

DB using SQLAlchemy
Gather a Trading Partner data and Credit Transaction (EDI 812
remember?) into one dictionary object
Gather Credit Transaction details into another dictionary object where
it can generate the multiple instance segments

The heart of the matter is how to fuse together the template and the
data from the dictionary objects efficiently. It should be generic
enough to take another set of data dictionary and another template to
generate a completely new EDI document.

I'm stuck at this fusing together thing. Is this a good approach? Is
there an easier to implement approach?

Comments, suggestions, questions please.

Allan



More information about the Python-list mailing list