From: Tripp, B. <Bry...@uh...> - 2003-09-05 21:21:39
|
As an update for those interested, here is a summary of the problems that Phil reported earlier this week and how they have been addressed: 1) The search function iterated through messages incorrectly in some circumstances. This has been addressed by replacing Terser's custom iterator with the more robust MessageIterator (which was developed after Terser). 2) A couple of the problems occured because the search process finds an RXR segment prior to the one into which the expected values were parsed. This is actually valid behaviour (but something to watch out for if you are using search). 3) Some of the problems arose from a misunderstanding of the substring flag (which was perpetuated by the fact that Terser was accepting certain invalid input). IMPORTANT: I've changed documented behaviour here, to try to bring it in line with what people were probably expecting. Previously, a * at the beginning of a segment or group name indicated that the name was a substring (i.e. any structure that contained the name would be treated as a match). For example, *M would match MSH. Now, the wildcards * and ? are used to represent arbitrary characters (* = any number of characters; ? = 1 character). For example, *M would not match MSH, but M* or M?? would. Apologies on the last point if this breaks anyone's code. I think this makes more sense in the long run, but let me know if you disaree. I'm willing to change it back if the balance of feedback is in this direction. Bryan > -----Original Message----- > From: Phillip Trewhella [mailto:ptr...@in...] > Sent: August 31, 2003 2:24 PM > To: hl7...@li... > Subject: [HAPI-devel] Anyone Using Terser? > > > I am having some problems with Terser and am not quite sure if they're > related to usage or are HAPI bugs (or a combination of both). > Here is a > simple class that illustrates some of the problems I am having: > > String msg = > "MSH|^~\\&|POW|100||100|200012171800||RDE^O11|14718|P|2.4|||AL > |NE|0\r" + > "PID|0001|99999|2000006|000077777|Possible^Kim^||195002220000| > F||1|100 E San > Marcos Blvd^^San Marcos^CA^92069^USA^^^San > Diego|||||M||2000006|123-45-6789|A0012345^CA||1|||||||||\r" + > "ORC|NW|RX1|RX1||IP||^BID^X001^200012171800^200308200600|2045& > OE^123&PH|2000 > 12171800|Nurse1|Nurse2|1^Order MD|||200012171800||||\r" + > "RXE|^BID^X001^200012171800^200308200600|99089^DIGOXIN > (LANOXIN) -- 0.25 > mg|0.2500|0.2500|mg|TA|111^||||||||||||||222^||||0.0000|||||\r" + > "RXR|PO||\r"; > > PipeParser pipeParser = new PipeParser(); > Message message = pipeParser.parse(msg); > Terser terser = new Terser(message); > > String value = terser.get("/.ORC-2"); > // > works > > value = > terser.get("/RDE_O11_ORC*/RDE_O11_RXR/RXR-1"); // works > value = > terser.get("/*RDE_O11_ORC/RDE_O11_RXR/RXR-1"); // works > value = terser.get("/*RDE_O11_ORC/RXE-1-2"); > // > works > > value = terser.get("/.RXE-1-2"); // > yields HL7Exception: End of message reached -- this is a peer > to ORC, which > does work with same syntax > value = terser.get("/.RXR-1"); > // yields > "null" instead of "PO" > value = terser.get("/.RDE_O11_RXR/RXR-1"); > // yields > "null" instead of "PO" > value = terser.get("/RDE_O11_ORC*/.RXR(0)-1"); > // yields > "null" instead of "PO" > value = terser.get("/RDE_O11_ORC*/.RXR-1"); > // yields > "null" instead of "PO" > value = terser.get("/RDE_O11_ORC*/*/RXR-1"); > // yields > NoSuchElementException > value = terser.get("/*/RDE_O11_RXR/RXR-1"); > // yields > NoSuchElementException > System.out.println("value = " + value); > > > In a nutshell, as long as I use a "fully qualified" path to the target > component, everything works great. When I start trying to > use the searching > and substring features, I run into problems. Any suggestions? > > Thanks. > > Phil > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > 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. |