Parsing EDIFACT in Python with syntax trees
Edison is a new Python library designed to parse EDIFACT messages by modeling them as syntax trees rather than flat lists. This approach allows for more robust validation, recursive segment grouping, and easier integration into data processing workflows.
Why it matters
This tool simplifies the complex task of handling EDIFACT, a standard format for electronic data interchange in global supply chain and business communications.
An EDIFACT parser with a real syntax tree.
Edison is a Python library for parsing EDIFACT messages. Instead of treating a message as a flat list of segments, it models messages as a syntax tree: segments can define groups of child segments, recursively.
You define the syntax tree once, then parse, validate, or pretty-print messages against that structure. It works by converting the syntax tree to a state machine of possible transitions between segments.
Define EDIFACT syntax trees directly in Python. Segments can define groups of child segments, which can be conditional, mandatory, or repeatable. Attach parsing callbacks to the segments you care about. Select syntax tree by message version. Handle escaped EDIFACT separators and EBCDIC control characters. Properly tokenize segments with specified lengths like BLB Export transition graphs with pydot . Installation Edison requires Python 3.12 or newer.
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in