Form/Template Fill-in the blanks

A

allan

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
 
A

Aahz

My initial thought was to use:
1. .ini files to declare the EDI configuration

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.

This sounds like something you want to use XML for.
--
Aahz ([email protected]) <*> http://www.pythoncraft.com/

"Many customs in this life persist because they ease friction and promote
productivity as a result of universal agreement, and whether they are
precisely the optimal choices is much less important." --Henry Spencer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top