Another example of where one shouldn’t should not let an edge case complicated a core design is HL7.
The Health Level Seven standard for electronic data transmission is a format which looks like this:
...
Legal - but not smart in my opinion. But why bother? The vast majority HL7 implementations use the standard characters. It’s just introducing friction and complexity for no good reason.
In Chameleon my first HL7 parser product I went to great effort to faithfully implement this part of the standard. What a waste of effort! Nowadays if I were to write an HL7 parser from scratch I wouldn’t implement this feature of HL7 as a core part of the filterparser.
Instead if a customer encountered the way that makes sense to solve the problem is just to preprocess the data with a normalization script like this:
Code Block | ||
---|---|---|
| ||
function HL7Normalize(Msg) local Result = Msg -- Get the | delimiter local D= Msg:sub(4,4) Result:gsub(D, "|") -- Repeat for the other 4 delimeters return Result end |
Solve a one off problem uncommon problems with a one off simple piece of code solutions - see separation of concerns.
In Iguana X the normalization can be done in a ‘neuron’ to handle this special edge case.