|
From: Scott A. <sa...@bj...> - 2006-07-24 15:44:09
|
To expand on this just a little *
I was specifically trying to figure out how I could disable the rule for =
the DT data type, which is why I was messing just with the primitive rule =
bindings.
I also tried disabling all rules by doing a:=20
parser.setValidationContext(new NoValidation());
Which again seemed to have no effect. =20
To test each scenario, after attempting to disable the rules, I would set =
a DT value to something that would not pass the original validation, then =
attempted to encode the message:
try {
a31.getINSURANCE(0).getIN1().getPlanEffectiveDate().setValue(" =
something invalid");
String m =3D parser.encode(a31);
} catch (DataTypeException dte) {
System.out.println("Still get DataTypeException...");
dte.printStackTrace();
}
>>> "Scott Arnold" <sa...@bj...> 7/24/2006 10:23:22 AM >>>
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 =3D new PipeParser();
ValidationContextImpl vc =3D (ValidationContextImpl)
parser.getValidationContext();
List rulebindings =3D vc.getPrimitiveRuleBindings();
for (Iterator iter =3D rulebindings.iterator(); iter.hasNext();) {
RuleBinding rb =3D (RuleBinding) iter.next();
// I individually tried the following three means for disabling
validation on a rule:
// rb.setActive(false);
// iter.remove(); =20
// rb =3D 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 =3D
(ValidationContextImpl)parser.getValidationContext();
List list =3D 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...=20
>
>
>
>
> -------------------------------------------------------
> 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=3Dlnk&kid=3D103432&bid=3D230486&dat=3D1=
21642=20
> _______________________________________________
> Hl7api-devel mailing list
> Hl7...@li...=20
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel=20
>
-------------------------------------------------------
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=3Dlnk&kid3432&bid#0486&dat1642=20
_______________________________________________
Hl7api-devel mailing list
Hl7...@li...=20
https://lists.sourceforge.net/lists/listinfo/hl7api-devel=20
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share =
your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE=
VDEV=20
_______________________________________________
Hl7api-devel mailing list
Hl7...@li...=20
https://lists.sourceforge.net/lists/listinfo/hl7api-devel=20
|