in reply to Re^2: Parsing EDI messages
in thread Parsing EDI messages

My problems are:
  1. How to apply the rules (the 'standard' and others defined by the receiver)? There are 100s (perhaps 1000s) of constraints to check. How to do the mappings?
  2. How to construct a solid, fast and accurate data structure that allows me to extract any kind of information from an EDI message?
I can't speak to the first (showing an example or three of a "rule" might help), but the second almost says database to me. Data structures are geared well towards doing things in a certain way. For instance, if you create a data structure based on people, you could structure it as a hash of hashes, with family name as the primary key and individuals as the sub-keys. Finding how many people are males over 25 from this structure isn't pretty. It seems that you want more flexiblity in the way that you get data out of the parsed message. As it stands, your initial structure didn't look that bad. The only complaint that I'd have against it is the existance of non-descriptive keys at the first level (they're all numbers which don't convey any information to me). After that, everything starts to fall into place.


Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come