|
From: Scott A. <sa...@bj...> - 2006-07-24 15:24:00
|
Did anyone ever figure out how exactly to disable some or all of a
parser's validation? I did some experimentation myself using the
following code:
PipeParser parser = new PipeParser();
ValidationContextImpl vc = (ValidationContextImpl)
parser.getValidationContext();
List rulebindings = vc.getPrimitiveRuleBindings();
for (Iterator iter = rulebindings.iterator(); iter.hasNext();) {
RuleBinding rb = (RuleBinding) iter.next();
// I individually tried the following three means for disabling
validation on a rule:
// rb.setActive(false);
// iter.remove();
// rb = null;
}
// Also tried this (thinking maybe it would disable them all):
// parser.setValidationContext(null);
None of the means I tried had any affect. I'm still not sure what the
proper way of modifying or disabling a rule is.
Scott Arnold
BJC HealthCare
>>> "Bryan Tripp" <bp...@gm...> 1/26/2006 3:10:40 PM >>>
Hi Sarang,
The default behaviour is to validate against the HL7 telephone number
format (the string "() - " doesn't conform to this), but you can
configure all the validation rules that are used by a Parser. If you
want to do a lot of configuration you should construct your Parser
with a custom ca.uhn.hl7v2.validation.ValidationContext. But in this
case it's probably simplest to do this ...
ValidationContextImpl context =
(ValidationContextImpl)parser.getValidationContext();
List list = context.getPrimitiveRuleBindings();
... then dig through the list and replace the TN binding with
something that allows whatever you want to allow.
Bryan
On 1/26/06, Sarang Malwatkar <sma...@im...> wrote:
> Hi,
>
> We are getting a DataTypeException
> when parsing an ADT message,
> which contains a blank Phone Number in PID segment.
>
> The Phone Number actually contains
> empty brackets with spaces: "|( ) - |"
>
> Exception Details (in PipeParser):
> Error while parsing:ca.uhn.hl7v2.model.DataTypeException: Failed
validation
> rule:
> Matches the regular expression
> (\d{1,2})?(\(\d{3}\))?\d{3}-\d{4}(X\d{1,5})?(B\d{1,5})?(C.*)?:
> Segment: PID (rep 0) Field #14.
>
> Can't the HAPI Parser handle empty Phone Numbers ?
>
> The problem is that, the parser returns a 'null' Message Object.
> So we loose all the other valid fields also.
>
> Is there any solution to this ?
>
> We have tried both v0.4.3 as well as v0.5beta
>
>
> Thanks,
> -Sarang Malwatkar.
> Sr. Project Manager,
> iMedX Information Services,
> sma...@im...
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through
log files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD
SPLUNK!
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> _______________________________________________
> Hl7api-devel mailing list
> Hl7...@li...
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD
SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Hl7api-devel mailing list
Hl7...@li...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel
|