Hi Frédéric,
thank you for your quick reply.
I did not wrote my own ValidationContextImpl, but I did something like this:
ValidationContextImpl context =
(ValidationContextImpl)pipeParser.getValidationContext();
List<?> list = context.getPrimitiveRuleBindings();
for (Object object : list) {
RuleBinding rb = (RuleBinding) object;
if(rb.getScope().equals("NM")) {
rb.setActive(false);
}
}
It worked also, but somebody told me that PID-2 ist not NM type. So I searched
and found this:
http://ihe.univ-rennes1.fr/HL7/segments.php?seg_code=PID
If you click an the CX (Datastructure for PID-2) you see that the first
sequence is defined as ST. Or is this incorrect?
That is what I don't understand. I don't like the solution above, because I
want to validate "real" NM fields the way hapi does.
Janine
-------- Original-Nachricht --------
> Datum: Thu, 3 Dec 2009 14:36:48 +0100
> Von: "Frédéric JECKER" <[email protected]>
> An: Janine Graul <[email protected]>
> CC: [email protected]
> Betreff: Re: [HAPI-devel] Failed validation rule PID #2
> Hi Janine,
>
> The parser uses a default validation context to check the primitives.
> The PID-2 field type is NM, so the parser checks for a number. In your
> case, the PID-2 field contains the 'OK' characters, that's why the validation
> fails.
>
> To get around this problem you must create a ValidationContextImpl
> subclass and set to use it by your parser by calling the
> parser.setValidationContext() method.
>
> Attached to this mail you will find the one I use (which is the original
> one with phone number checking deactivated).
>
> Regards
>
>
>
> Le 3 déc. 2009 à 14:19, Janine Graul a écrit :
>
> > Hi,
> >
> > I'm using hapi 0.6. I receive messages from HL7 versions 2.1, 2.3 and
> 2.5.
> > I get a message with a String in PID-Segment Field #2. Like this:
> >
> > PID||OK-0000359788|...
> >
> > Hapi validates this message, sends a nak and doesn't call my
> processMessage(Message in). The Exception which is thrown is:
> >
> > ca.uhn.hl7v2.model.DataTypeException: Failed validation rule: Matches
> the regular expression (\+|\-)?\d*\.?\d*: Segment: PID (rep 0) Field #2
> >
> > Could somebody tell me, why hapi verifies with a regular expression from
> a numeric field? I thought the PID #2-1 is a ST-Field.
> >
> > Janine
> > --
> > Sarah Kreuz, die DSDS-Siegerin der Herzen, mit ihrem eindrucksvollen
>
> > Debütalbum "One Moment in Time". http://portal.gmx.net/de/go/musik
> >
> >
> ------------------------------------------------------------------------------
> > Join us December 9, 2009 for the Red Hat Virtual Experience,
> > a free event focused on virtualization and cloud computing.
> > Attend in-depth sessions from your desk. Your couch. Anywhere.
> > http://p.sf.net/sfu/redhat-sfdev2dev
> > _______________________________________________
> > Hl7api-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Hl7api-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hl7api-devel