From: Tripp, B. <Bry...@uh...> - 2003-05-08 17:24:05
|
Hi Alexei, Good idea, and I'm sure lots of other people are suffering from the same problem, but I have to ask you to keep this change local to UHN. Changing a message value quietly could be dangerous, and we can't count on people to be aware of the new "recovered" flag. I want to move all validation to a separate process that is much more configurable (i.e. not perform any validation when values are set, which would fix this problem and others). However, this is a substantial change. We have lots of new features that should be consolidated into a stable release (0.4) before starting something new, so let's just get 0.4 done and then we can turn our attention here. Bryan -----Original Message----- From: alexei guevara [mailto:ale...@ho...] Sent: May 8, 2003 11:37 AM To: hl7...@li... Subject: [HAPI-devel] new feature (making the PipeParser able to recover from errors) We are using HAPI to parse ADT and ORDER messages at UHN, and because of some "lack of std. compliance" by our HIS, we are getting invalid messages (not at the message structure level, but at the primitive level). For ex.: some components that are meant to be numeric are alphanumeric. My proposal is simple and easy to implement. We'll be adding an event handler to the parser to be invoked whenever such parsing error occurs, and the code in the event will try to recover from that error, by marking the parsed component as recovered and assigning a valid value to it. Right now this functionality will have to be added at the PipeParser level, I propose to perform some refactoring in the future, such a way we can make this sort of functionality common to all parser impls. Some pseudo-code implementing the described feature. class PipeParser { boolean parse( Type destination, String data, EncodingCharacters encodingChars, boolean subComponents) { ... else if (destination instanceof Primitive) { Primitive prim = (Primitive) destination; try { prim.setValue( Escape.unescape(data, encodingChars) ); } catch (DataTypeException e) { //try to recover boolean recovered = invokeRecoveryHandler( data, destination, e ); if (recovered==true) { //we must change the primitive intf. a bit prim.setRecovered( true ); } else { throw e; } } isLeaf = true; } ... } } MailFiler <http://www.mailfiler.com> [AG-JU4UEF4] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/2003 This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. If you have received this e-mail in error, please contact the sender and delete all copies. Opinions, conclusions or other information contained in this e-mail may not be that of the organization. |