Field validation against regex

View: New views
9 Messages — Rating Filter:   Alert me  

Field validation against regex

by Serbulent Unsal-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm trying Hapi's message validation example [1] but I couldn't get regex rule
exception as far as I change field values to non-valid ones. i.e in the example
I change the validMessage as below;

String validMessage = "MSH|^~\\&|MedSeries|CAISI_1-2|PLS|3910|something wrong
here ||ADT^A31^ADT_A05|75535037-1237815294895|P^T|2.4\r\n"
+ "EVN|A31|200903230934\r\n"
+ "PID|1||29^^CAISI_1-2^PI~\"\"||Test300^Leticia^^^^^L||19770202|
M||||||||||||||||||||||";


and parser can still parse the message and give me the output as "Successfully
parsed valid message"


Can anyone repeat this ? And any ideas about situation ?

Regards,

--
Serbulent Unsal | Software Expert
GSM : +90 555 697 50 46 | Tel : +90.312.478 48 00
Akgun Softwares & Services Pvt. Ltd.
Çetin Emeç Bulv. 4. Cad. No:5/3
06460 A.Öveçler / ANKARA

This e-mail and its attachments are private and confidential to the exclusive
use of the individual or entity to whom it is addressed. It may also be
legally confidential. Any disclosure, distribution or other dissemination of
this message to any third party is strictly prohibited. If you are not the
intended recipient, you may not copy, forward, send or use any part of it. If
you are not the intended recipient or the person who is responsible to
transmit to the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message and its attachments.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Re: Field validation against regex

by Serbulent Unsal-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 04 August 2009 05:32:25 pm Serbulent Unsal wrote:

> Hi,
>
> I'm trying Hapi's message validation example [1] but I couldn't get regex
> rule exception as far as I change field values to non-valid ones. i.e in
> the example I change the validMessage as below;
>
> String validMessage = "MSH|^~\\&|MedSeries|CAISI_1-2|PLS|3910|something
> wrong here ||ADT^A31^ADT_A05|75535037-1237815294895|P^T|2.4\r\n"
> + "EVN|A31|200903230934\r\n"
> + "PID|1||29^^CAISI_1-2^PI~\"\"||Test300^Leticia^^^^^L||19770202|
> M||||||||||||||||||||||";
>
>
> and parser can still parse the message and give me the output as
> "Successfully parsed valid message"
>
>
> Can anyone repeat this ? And any ideas about situation ?
>
> Regards,

PS: I also realize that test(String value) method of
ca.uhn.hl7v2.validation.impl.RegexPrimitiveRule was never called during
validation. Something  wrong about it but I can't figure out.


--
Serbulent Unsal | Software Expert
GSM : +90 555 697 50 46 | Tel : +90.312.478 48 00
Akgun Softwares & Services Pvt. Ltd.
Çetin Emeç Bulv. 4. Cad. No:5/3
06460 A.Öveçler / ANKARA

This e-mail and its attachments are private and confidential to the exclusive
use of the individual or entity to whom it is addressed. It may also be
legally confidential. Any disclosure, distribution or other dissemination of
this message to any third party is strictly prohibited. If you are not the
intended recipient, you may not copy, forward, send or use any part of it. If
you are not the intended recipient or the person who is responsible to
transmit to the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message and its attachments.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Re: Field validation against regex (SOLVED)

by Serbulent Unsal-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tuesday 04 August 2009 05:32:25 pm Serbulent Unsal wrote:

> Hi,
>
> I'm trying Hapi's message validation example [1] but I couldn't get regex
> rule exception as far as I change field values to non-valid ones. i.e in
> the example I change the validMessage as below;
>
> String validMessage = "MSH|^~\\&|MedSeries|CAISI_1-2|PLS|3910|something
> wrong here ||ADT^A31^ADT_A05|75535037-1237815294895|P^T|2.4\r\n"
> + "EVN|A31|200903230934\r\n"
> + "PID|1||29^^CAISI_1-2^PI~\"\"||Test300^Leticia^^^^^L||19770202|
> M||||||||||||||||||||||";
>
>
> and parser can still parse the message and give me the output as
> "Successfully parsed valid message"
>
>
> Can anyone repeat this ? And any ideas about situation ?
>
> Regards,

I can finally solve the situation with a small fix in
"ca.uhn.hl7v2.model.v24.datatype.TS.java"

The problem was define of TS's first component as a ST value. Because of this
situation validator does not apply regex matching rule "datetime" ( which is
defined in ca.uhn.hl7v2.validation.impl.DefaultValidation )  on the "Date/Time
Of Message" field.

So I change type of first component of TS class ( ST to TSComponentOne ) in  
"ca.uhn.hl7v2.model.v24.datatype.TS.java" as below

// data[0] = new ST(message);
                data[0] = new TSComponentOne(message);

I know that this classes are produced automatically by source-generator but I
can't find a better way to fix this bug. ( I hope it a bug not a feature :) )

James would u think fix this issue in the mainstream ? Or is there a better way
to do this ?


--
Serbulent Unsal | Software Expert
GSM : +90 555 697 50 46 | Tel : +90.312.478 48 00
Akgun Softwares & Services Pvt. Ltd.
Çetin Emeç Bulv. 4. Cad. No:5/3
06460 A.Öveçler / ANKARA

This e-mail and its attachments are private and confidential to the exclusive
use of the individual or entity to whom it is addressed. It may also be
legally confidential. Any disclosure, distribution or other dissemination of
this message to any third party is strictly prohibited. If you are not the
intended recipient, you may not copy, forward, send or use any part of it. If
you are not the intended recipient or the person who is responsible to
transmit to the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message and its attachments.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Re: Field validation against regex

by James Agnew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Serbulent,

Can you post the code you use to add the regex rule?

Cheers,
James


On Tue, Aug 4, 2009 at 11:05 AM, Serbulent Unsal <serbulent.unsal@...> wrote:
On Tuesday 04 August 2009 05:32:25 pm Serbulent Unsal wrote:
> Hi,
>
> I'm trying Hapi's message validation example [1] but I couldn't get regex
> rule exception as far as I change field values to non-valid ones. i.e in
> the example I change the validMessage as below;
>
> String validMessage = "MSH|^~\\&|MedSeries|CAISI_1-2|PLS|3910|something
> wrong here ||ADT^A31^ADT_A05|75535037-1237815294895|P^T|2.4\r\n"
> + "EVN|A31|200903230934\r\n"
> + "PID|1||29^^CAISI_1-2^PI~\"\"||Test300^Leticia^^^^^L||19770202|
> M||||||||||||||||||||||";
>
>
> and parser can still parse the message and give me the output as
> "Successfully parsed valid message"
>
>
> Can anyone repeat this ? And any ideas about situation ?
>
> Regards,

PS: I also realize that test(String value) method of
ca.uhn.hl7v2.validation.impl.RegexPrimitiveRule was never called during
validation. Something  wrong about it but I can't figure out.


--
Serbulent Unsal | Software Expert
GSM : +90 555 697 50 46 | Tel : +90.312.478 48 00
Akgun Softwares & Services Pvt. Ltd.
Çetin Emeç Bulv. 4. Cad. No:5/3
06460 A.Öveçler / ANKARA

This e-mail and its attachments are private and confidential to the exclusive
use of the individual or entity to whom it is addressed. It may also be
legally confidential. Any disclosure, distribution or other dissemination of
this message to any third party is strictly prohibited. If you are not the
intended recipient, you may not copy, forward, send or use any part of it. If
you are not the intended recipient or the person who is responsible to
transmit to the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message and its attachments.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Re: Field validation against regex

by Serbulent Unsal-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Friday 07 August 2009 01:34:27 am James Agnew wrote:
> Hi Serbulent,
>
> Can you post the code you use to add the regex rule?
>
> Cheers,
> James

No :) Because as I said in my first mail I use Hapi's message validation
example so I use DefaultValidationContext.  I'm expecting working of rules
which are defined in  DefaultValidation.java ;) But specifiacally the problem is
with datetime rule I paste it below

String datetimePattern  
            = "(\\d{4}([01]\\d(\\d{2}([012]\\d([0-5]\\d([0-5]\\d(\\.
\\d(\\d(\\d(\\d)?)?)?)?)?)?)?)?)?)?([\\+\\-]\\d{4})?";
        Rule datetime = new RegexPrimitiveRule(datetimePattern, "Version 2.5
Section 2.16.25");
        getPrimitiveRuleBindings().add(new RuleBinding("*", "TSComponentOne",
datetime));


PS:  I'm not to be sure whether you saw my last message [1]  or not ?  
[1] http://tiny.cc/ilUHK

Regards,

--
Serbulent Unsal | Software Expert
GSM : +90 555 697 50 46 | Tel : +90.312.478 48 00
Akgun Softwares & Services Pvt. Ltd.
Çetin Emeç Bulv. 4. Cad. No:5/3
06460 A.Öveçler / ANKARA

This e-mail and its attachments are private and confidential to the exclusive
use of the individual or entity to whom it is addressed. It may also be
legally confidential. Any disclosure, distribution or other dissemination of
this message to any third party is strictly prohibited. If you are not the
intended recipient, you may not copy, forward, send or use any part of it. If
you are not the intended recipient or the person who is responsible to
transmit to the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message and its attachments.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Re: Field validation against regex (SOLVED)

by Serbulent Unsal-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 06 August 2009 06:55:45 pm Serbulent Unsal wrote:

> On Tuesday 04 August 2009 05:32:25 pm Serbulent Unsal wrote:
> > Hi,
> >
> > I'm trying Hapi's message validation example [1] but I couldn't get regex
> > rule exception as far as I change field values to non-valid ones. i.e in
> > the example I change the validMessage as below;
> >
> > String validMessage = "MSH|^~\\&|MedSeries|CAISI_1-2|PLS|3910|something
> > wrong here ||ADT^A31^ADT_A05|75535037-1237815294895|P^T|2.4\r\n"
> > + "EVN|A31|200903230934\r\n"
> > + "PID|1||29^^CAISI_1-2^PI~\"\"||Test300^Leticia^^^^^L||19770202|
> > M||||||||||||||||||||||";
> >
> >
> > and parser can still parse the message and give me the output as
> > "Successfully parsed valid message"
> >
> >
> > Can anyone repeat this ? And any ideas about situation ?
> >
> > Regards,
>
> I can finally solve the situation with a small fix in
> "ca.uhn.hl7v2.model.v24.datatype.TS.java"
>
> The problem was define of TS's first component as a ST value. Because of
> this situation validator does not apply regex matching rule "datetime" (
> which is defined in ca.uhn.hl7v2.validation.impl.DefaultValidation )  on
> the "Date/Time Of Message" field.
>
> So I change type of first component of TS class ( ST to TSComponentOne ) in
> "ca.uhn.hl7v2.model.v24.datatype.TS.java" as below
>
> // data[0] = new ST(message);
> data[0] = new TSComponentOne(message);
>
> I know that this classes are produced automatically by source-generator but
> I can't find a better way to fix this bug. ( I hope it a bug not a feature
> :) )
>
> James would u think fix this issue in the mainstream ? Or is there a better
> way to do this ?

Ping ?

--
Serbulent Unsal | Software Expert
GSM : +90 555 697 50 46 | Tel : +90.312.478 48 00
Akgun Softwares & Services Pvt. Ltd.
Çetin Emeç Bulv. 4. Cad. No:5/3
06460 A.Öveçler / ANKARA

This e-mail and its attachments are private and confidential to the exclusive
use of the individual or entity to whom it is addressed. It may also be
legally confidential. Any disclosure, distribution or other dissemination of
this message to any third party is strictly prohibited. If you are not the
intended recipient, you may not copy, forward, send or use any part of it. If
you are not the intended recipient or the person who is responsible to
transmit to the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message and its attachments.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Re: Field validation against regex (SOLVED)

by Serbulent Unsal-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 10 August 2009 04:20:34 pm Serbulent Unsal wrote:
> > James would u think fix this issue in the mainstream ? Or is there a
> > better way to do this ?
>
> Ping ?

Ping again ?

--
Serbulent Unsal | Software Expert
GSM : +90 555 697 50 46 | Tel : +90.312.478 48 00
Akgun Softwares & Services Pvt. Ltd.
Çetin Emeç Bulv. 4. Cad. No:5/3
06460 A.Öveçler / ANKARA

This e-mail and its attachments are private and confidential to the exclusive
use of the individual or entity to whom it is addressed. It may also be
legally confidential. Any disclosure, distribution or other dissemination of
this message to any third party is strictly prohibited. If you are not the
intended recipient, you may not copy, forward, send or use any part of it. If
you are not the intended recipient or the person who is responsible to
transmit to the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message and its attachments.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Re: Field validation against regex (SOLVED)

by James Agnew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Serbulent,

Sorry I haven't gotten back to you on this, it's on my list of things to think about but I'm not sure what the right answer is. Maybe someone else here will have an idea.

You're definitely right, the first component of TS should be a TSComponentOne. I'm not sure if that was the case in previous releases (probably, I should check when I get a chance) but either way it was definitely the intention.

The only problem I see with fixing it might mean breaking other people's code. If someone had compiled their application against 0.6 and their code expetcted an ST there, suddenly seeing a TSComponentOne there could cause problems.

Thinking about this out loud though, maybe the right thing to do is to make TSComponentOne extend ST. That would avoid breaking existing code, and would still be compliant with the spec, since TS-1 is an ST.

Thoughts anyone? I think we might have a good solution here!

James

On Thu, Aug 20, 2009 at 3:11 AM, Serbulent Unsal <serbulent.unsal@...> wrote:
On Monday 10 August 2009 04:20:34 pm Serbulent Unsal wrote:
> > James would u think fix this issue in the mainstream ? Or is there a
> > better way to do this ?
>
> Ping ?

Ping again ?

--
Serbulent Unsal | Software Expert
GSM : +90 555 697 50 46 | Tel : +90.312.478 48 00
Akgun Softwares & Services Pvt. Ltd.
Çetin Emeç Bulv. 4. Cad. No:5/3
06460 A.Öveçler / ANKARA

This e-mail and its attachments are private and confidential to the exclusive
use of the individual or entity to whom it is addressed. It may also be
legally confidential. Any disclosure, distribution or other dissemination of
this message to any third party is strictly prohibited. If you are not the
intended recipient, you may not copy, forward, send or use any part of it. If
you are not the intended recipient or the person who is responsible to
transmit to the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message and its attachments.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel

Re: Field validation against regex (SOLVED)

by James Agnew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well.. One more thing to add, it looks like this changed between 0.4 and 0.5- In the 0.4 library TS-1 is a TSComponentOne, where in the 0.5 library it is an ST.

Maybe the right thing to do here is just fix it as you suggest, I'm worried about other unintended consequences frrom chancing the hierarchy above TSComponentOne. I'm thinking unless anyone has a good argument against, let's go with that and I'll make sure it's mentioned in the release notes for the next version.

Cheers,
James

On Thu, Aug 20, 2009 at 3:11 AM, Serbulent Unsal <serbulent.unsal@...> wrote:
On Monday 10 August 2009 04:20:34 pm Serbulent Unsal wrote:
> > James would u think fix this issue in the mainstream ? Or is there a
> > better way to do this ?
>
> Ping ?

Ping again ?

--
Serbulent Unsal | Software Expert
GSM : +90 555 697 50 46 | Tel : +90.312.478 48 00
Akgun Softwares & Services Pvt. Ltd.
Çetin Emeç Bulv. 4. Cad. No:5/3
06460 A.Öveçler / ANKARA

This e-mail and its attachments are private and confidential to the exclusive
use of the individual or entity to whom it is addressed. It may also be
legally confidential. Any disclosure, distribution or other dissemination of
this message to any third party is strictly prohibited. If you are not the
intended recipient, you may not copy, forward, send or use any part of it. If
you are not the intended recipient or the person who is responsible to
transmit to the intended recipient, please contact the sender by reply e-mail
and destroy all copies of the original message and its attachments.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@...
https://lists.sourceforge.net/lists/listinfo/hl7api-devel