You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
(4) |
May
(5) |
Jun
(6) |
Jul
(3) |
Aug
(13) |
Sep
(28) |
Oct
(33) |
Nov
(8) |
Dec
(1) |
2003 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(25) |
May
(21) |
Jun
(13) |
Jul
(12) |
Aug
(14) |
Sep
(6) |
Oct
(6) |
Nov
(16) |
Dec
(6) |
2004 |
Jan
(5) |
Feb
(7) |
Mar
(13) |
Apr
(17) |
May
(24) |
Jun
(14) |
Jul
(14) |
Aug
(8) |
Sep
(3) |
Oct
(8) |
Nov
(14) |
Dec
(26) |
2005 |
Jan
(18) |
Feb
(12) |
Mar
(29) |
Apr
(9) |
May
(4) |
Jun
(12) |
Jul
(17) |
Aug
(9) |
Sep
(12) |
Oct
|
Nov
(12) |
Dec
|
2006 |
Jan
(46) |
Feb
(18) |
Mar
(11) |
Apr
(13) |
May
(12) |
Jun
(27) |
Jul
(34) |
Aug
(45) |
Sep
(27) |
Oct
(13) |
Nov
(26) |
Dec
(22) |
2007 |
Jan
(21) |
Feb
(29) |
Mar
(32) |
Apr
(6) |
May
(11) |
Jun
(13) |
Jul
(14) |
Aug
(11) |
Sep
(15) |
Oct
(7) |
Nov
(30) |
Dec
(16) |
2008 |
Jan
(11) |
Feb
(14) |
Mar
(5) |
Apr
(18) |
May
(12) |
Jun
(11) |
Jul
(5) |
Aug
(12) |
Sep
(3) |
Oct
(2) |
Nov
(15) |
Dec
(2) |
2009 |
Jan
(18) |
Feb
(6) |
Mar
(9) |
Apr
(10) |
May
(29) |
Jun
(16) |
Jul
(44) |
Aug
(49) |
Sep
(14) |
Oct
(21) |
Nov
(11) |
Dec
(22) |
2010 |
Jan
(12) |
Feb
(13) |
Mar
(5) |
Apr
(6) |
May
(15) |
Jun
(15) |
Jul
(14) |
Aug
(20) |
Sep
(17) |
Oct
(36) |
Nov
(19) |
Dec
(7) |
2011 |
Jan
(8) |
Feb
(14) |
Mar
(21) |
Apr
(12) |
May
(6) |
Jun
(12) |
Jul
(17) |
Aug
(6) |
Sep
(13) |
Oct
(15) |
Nov
(26) |
Dec
(9) |
2012 |
Jan
(25) |
Feb
(13) |
Mar
(31) |
Apr
(10) |
May
(16) |
Jun
(21) |
Jul
(61) |
Aug
(38) |
Sep
(16) |
Oct
(13) |
Nov
(37) |
Dec
(26) |
2013 |
Jan
(20) |
Feb
(26) |
Mar
(34) |
Apr
(32) |
May
(27) |
Jun
(56) |
Jul
(16) |
Aug
(38) |
Sep
(35) |
Oct
(17) |
Nov
(11) |
Dec
(7) |
2014 |
Jan
(36) |
Feb
(13) |
Mar
(25) |
Apr
|
May
(27) |
Jun
(33) |
Jul
(34) |
Aug
|
Sep
(4) |
Oct
(11) |
Nov
(42) |
Dec
(2) |
2015 |
Jan
(5) |
Feb
(6) |
Mar
(11) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(2) |
Aug
(5) |
Sep
(5) |
Oct
(5) |
Nov
(8) |
Dec
(19) |
2016 |
Jan
(8) |
Feb
(12) |
Mar
(6) |
Apr
(5) |
May
(5) |
Jun
(3) |
Jul
(1) |
Aug
|
Sep
(9) |
Oct
(1) |
Nov
(2) |
Dec
(5) |
2017 |
Jan
(2) |
Feb
|
Mar
(3) |
Apr
(6) |
May
(8) |
Jun
(7) |
Jul
(14) |
Aug
(10) |
Sep
(6) |
Oct
(2) |
Nov
|
Dec
|
2018 |
Jan
|
Feb
(9) |
Mar
(2) |
Apr
(3) |
May
(1) |
Jun
(1) |
Jul
(1) |
Aug
(8) |
Sep
(4) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
2019 |
Jan
(10) |
Feb
(2) |
Mar
(6) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(5) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
2020 |
Jan
(9) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(9) |
Oct
(1) |
Nov
(11) |
Dec
|
2021 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(7) |
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2023 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
(2) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
(7) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(6) |
Nov
|
Dec
|
From: Jens V. <jen...@gm...> - 2016-01-04 21:41:16
|
Could you provide a stacktrace? On 3 January 2016 at 18:55, John Giotta <jdg...@gm...> wrote: > I was provided an HL7 file that if I simply trying to consume it with HAPI > I get an exception of formatting. > > How do I handle formatting exceptions, but still access the parts of the > HL7 I need? > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > -- Med venlig hilsen / Kind regards *Jens Kristian Villadsen* cand.polyt Stålhøjen 24 8240 Risskov Denmark Mobile +4523373806 jen...@gm... |
From: John G. <jdg...@gm...> - 2016-01-03 17:55:49
|
I was provided an HL7 file that if I simply trying to consume it with HAPI I get an exception of formatting. How do I handle formatting exceptions, but still access the parts of the HL7 I need? |
From: Davies, B. <Bri...@Mc...> - 2015-12-25 04:38:31
|
Not to worry, I was able to solve this issue. From: Davies, Brian [mailto:Bri...@Mc...] Sent: Wednesday, December 23, 2015 3:43 AM To: hl7...@li... Subject: [HAPI-devel] Creating a Message with Repeating Segments that are not in a Group Hi All, I am working with a vendor that needs repeating segments in a message that are not contained in a group. A typical message would look like the following: MSH|^~\&|Vendor||APP_RCV||20151109155046||RDS^R06|671-147754-932|P|2.5 PID|||671-147754-932||Patient_last_name^Patient_first_name^Patient_middle_name^Patient_name_suffix||||||^Address_line_1^Address_line_2^city^State^Zipcode||(000)000-0000 ORC|OK|671-30142746-7 RXD|7|XZ740^BRIEF,PROTECTION PLUS MEDIUM #MSC33005^L|20150728170826|1.0|||30142746|||ZTAD||||||||ZTAD|20160727||||||MSC33005 ZRX|USPS|00067101477540932101|30142746|38.37|1.03|1.79|38.37|1^Atlanta^100 SW CHURCH ST^#56957^ATLANTA^IL^61723-9998 ORC|OK|671-30142750-9 RXD|9|B0424^NUTRITION SUPL BOOST PLUS/MOCHA LIQUID^L|20150728185436|3.0|||30142750|||||||||||B4986255|20160129||||||00212931313 ZRX|USPS|1ZA4043E0328201395|30142750|40.5|1.03|1.25|13.5|1^Atlanta^100 SW CHURCH ST^#56957^ATLANTA^IL^61723-9998 Please note the repeating segments not contained in a group. It is not apparent how to create such a message without defining in a group. Is there a way to simply create this message without it being in a group? Thank you, Brian Davies |
From: Davies, B. <Bri...@Mc...> - 2015-12-23 09:44:18
|
Thank you Ian. It's working with a few rearrangements of the classes. From: Ian Vowles [mailto:Ian...@he...] Sent: Tuesday, December 22, 2015 3:16 PM To: hl7...@li... Subject: Re: [HAPI-devel] Custom Model Classes Following up on the example of our ORMIS message I posted earlier, I added an implementation called ORM_Q01. Code basically exactly the same as the ORU_R01 posted earlier (see below) I then added a test case to our test class (see further below), and successfully got an implementation of the custom message. As noted before, the package structure is critical, the message, group and segment packages must have all the relevant bits set up to make this strategy work. Any shortcuts are likely to cause problems. Hope this helps Ian ---- The ORM_Q01 message, which extends our custom ORU--- package au.gov.qld.health.sit.hl7.ormis.message; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.parser.ModelClassFactory; /** * Enable HAPI to generate an ORU^R01 message implementation of ORMIS_ORU * based on the values of MSH-9-1 and MSH-9-2. */ public class ORM_Q01 extends ORMIS_ORU { public ORM_Q01(ModelClassFactory factory) throws HL7Exception { super(factory); } } --- The test case which gets our ORU custom implementation in one test, and the new ORM_Q01 as another example --- package au.gov.qld.health.sit.hl7.ormis; import au.gov.qld.health.sit.hl7.ormis.message.ORU_R01; import au.gov.qld.health.sit.hl7.ormis.message.ORM_Q01; import ca.uhn.hl7v2.DefaultHapiContext; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.HapiContext; import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.model.Varies; import ca.uhn.hl7v2.parser.CustomModelClassFactory; import ca.uhn.hl7v2.parser.GenericParser; import ca.uhn.hl7v2.validation.builder.support.NoValidationBuilder; import java.util.HashMap; import java.util.Map; import org.junit.Test; import static org.junit.Assert.assertTrue; public class CustomMessageParseTest { private static final HapiContext HAPI_CONTEXT = createHapiContext(); private static final String MSH_FOR_ORU_R01 = "MSH|^~\\&|MSH-3|MSH-4|MSH-5.1^MSH-5.2|MSH-6|20130605000036|MSH-8|ORU^R01|MSH-10|P|2.3|MSH-13|MSH-14|MSH-15|MSH-16|MSH-17|MSH-18|MSH-19"; private static final String MSH_FOR_ORM_Q01 = "MSH|^~\\&|MSH-3|MSH-4|MSH-5.1^MSH-5.2|MSH-6|20130605000036|MSH-8|ORM^Q01|MSH-10|P|2.3|MSH-13|MSH-14|MSH-15|MSH-16|MSH-17|MSH-18|MSH-19"; @Test public void testParseCustomORU_R01Message() throws HL7Exception { Message message = new GenericParser(HAPI_CONTEXT).parse(MSH_FOR_ORU_R01); assertTrue("Parse custom ORU_R01 message", message instanceof ORU_R01); } @Test public void testParseCustomORU_Q01Message() throws HL7Exception { Message message = new GenericParser(HAPI_CONTEXT).parse(MSH_FOR_ORM_Q01); assertTrue("Parse custom ORU_Q01 message", message instanceof ORM_Q01); } private static HapiContext createHapiContext() { System.setProperty(Varies.DEFAULT_OBX2_TYPE_PROP, "ST"); System.setProperty(Varies.INVALID_OBX2_TYPE_PROP, "ST"); HapiContext hapiContext = new DefaultHapiContext(); Map<String, String[]> hl7VersionPackageNamesMap = new HashMap<String, String[]>(); String[] packageNames = {"ca.uhn.hl7v2.model.v24", "au.gov.qld.health.sit.hl7.ormis"}; hl7VersionPackageNamesMap.put("2.3", packageNames); hl7VersionPackageNamesMap.put("2.3.1", packageNames); hl7VersionPackageNamesMap.put("2.4", packageNames); hapiContext.setModelClassFactory(new CustomModelClassFactory(hl7VersionPackageNamesMap)); hapiContext.setValidationRuleBuilder(new NoValidationBuilder()); return hapiContext; } } From: Davies, Brian [mailto:Bri...@Mc...] Sent: Wednesday, 23 December 2015 1:39 AM To: hl7...@li...<mailto:hl7...@li...> Subject: Re: [HAPI-devel] Custom Model Classes Forgot to include the exception: RDS_R06is called!!!!!!! Exception in thread "main" java.lang.ClassCastException: ca.uhn.hl7v2.model.GenericSegment cannot be cast to com.mckn.mms.lds.hl7.zxx.custommodel.v25.group.PFG at com.mckn.mms.lds.hl7.zxx.custommodelv25.message.RDS_R06.getPFG(RDS_R06.java:67) at com.mpls.lds.hl7.zxx.custommodel.v25.message.TestMessageCreation.testParseCustomRDS_R06Message(TestMessageCreation.java:46) at com.mpls.lds.hl7.zxx.custommodel.v25.message.TestMessageCreation.main(TestMessageCreation.java:88) From: Davies, Brian [mailto:Bri...@Mc...] Sent: Tuesday, December 22, 2015 9:36 AM To: hl7...@li...<mailto:hl7...@li...> Subject: [HAPI-devel] Custom Model Classes Hi All, It seems to me that the custom model classes simply do not recognize the AbstractGroup types even when one tries to forcefully load the group from the custom model. I think Christian is absolutely right that the eventmap is the solution known to work for this issue. The problem for me however is that that solution seems rather extreme. Unfortunately, the message type I am trying to create is not a standard type. Here is a case in point. The code snippet below is actually in a package xxx.xxx.<version>.<type> but it seems only the eventmap is able to recognize all types package com.mckn.mms.lds.hl7.zxx.custommodel.v25.group public class PFG extends AbstractGroup { private static final long serialVersionUID = -5950843839679571210L; public PFG(Group parent, ModelClassFactory factory) { super(parent, factory); try { init(); } catch (HL7Exception e) { log.error("Unexpected error creating PFG.", e); } } ...... package com.mckn.mms.lds.hl7.zxx.custommodel.v25.group public PFG getPFG(){ //An attempt to load ModelClassFactory cfm = new CustomModelClassFactory( "com.mckn.mms.lds.hl7.zxx.custommodel"); Class c=null; try { c = cfm.getTypeClass("PFG", "2.5"); } catch (HL7Exception e) { return null; } return (PFG)super.getTyped("PFG", c); } I have tried all the recommendations so far, except for the eventmap solution, but with no success. Unfortunately, there is not enough information showing an instance of creating a completely new message type implementation from scratch. Has anyone got a working solution to this problem? ******************************************************************************** This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error. Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters. If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175 or by return email. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced. If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited. Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email. Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government. ********************************************************************************** |
From: Davies, B. <Bri...@Mc...> - 2015-12-23 09:42:46
|
Hi All, I am working with a vendor that needs repeating segments in a message that are not contained in a group. A typical message would look like the following: MSH|^~\&|Vendor||APP_RCV||20151109155046||RDS^R06|671-147754-932|P|2.5 PID|||671-147754-932||Patient_last_name^Patient_first_name^Patient_middle_name^Patient_name_suffix||||||^Address_line_1^Address_line_2^city^State^Zipcode||(000)000-0000 ORC|OK|671-30142746-7 RXD|7|XZ740^BRIEF,PROTECTION PLUS MEDIUM #MSC33005^L|20150728170826|1.0|||30142746|||ZTAD||||||||ZTAD|20160727||||||MSC33005 ZRX|USPS|00067101477540932101|30142746|38.37|1.03|1.79|38.37|1^Atlanta^100 SW CHURCH ST^#56957^ATLANTA^IL^61723-9998 ORC|OK|671-30142750-9 RXD|9|B0424^NUTRITION SUPL BOOST PLUS/MOCHA LIQUID^L|20150728185436|3.0|||30142750|||||||||||B4986255|20160129||||||00212931313 ZRX|USPS|1ZA4043E0328201395|30142750|40.5|1.03|1.25|13.5|1^Atlanta^100 SW CHURCH ST^#56957^ATLANTA^IL^61723-9998 Please note the repeating segments not contained in a group. It is not apparent how to create such a message without defining in a group. Is there a way to simply create this message without it being in a group? Thank you, Brian Davies |
From: Ian V. <Ian...@he...> - 2015-12-22 21:16:50
|
Following up on the example of our ORMIS message I posted earlier, I added an implementation called ORM_Q01. Code basically exactly the same as the ORU_R01 posted earlier (see below) I then added a test case to our test class (see further below), and successfully got an implementation of the custom message. As noted before, the package structure is critical, the message, group and segment packages must have all the relevant bits set up to make this strategy work. Any shortcuts are likely to cause problems. Hope this helps Ian ---- The ORM_Q01 message, which extends our custom ORU--- package au.gov.qld.health.sit.hl7.ormis.message; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.parser.ModelClassFactory; /** * Enable HAPI to generate an ORU^R01 message implementation of ORMIS_ORU * based on the values of MSH-9-1 and MSH-9-2. */ public class ORM_Q01 extends ORMIS_ORU { public ORM_Q01(ModelClassFactory factory) throws HL7Exception { super(factory); } } --- The test case which gets our ORU custom implementation in one test, and the new ORM_Q01 as another example --- package au.gov.qld.health.sit.hl7.ormis; import au.gov.qld.health.sit.hl7.ormis.message.ORU_R01; import au.gov.qld.health.sit.hl7.ormis.message.ORM_Q01; import ca.uhn.hl7v2.DefaultHapiContext; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.HapiContext; import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.model.Varies; import ca.uhn.hl7v2.parser.CustomModelClassFactory; import ca.uhn.hl7v2.parser.GenericParser; import ca.uhn.hl7v2.validation.builder.support.NoValidationBuilder; import java.util.HashMap; import java.util.Map; import org.junit.Test; import static org.junit.Assert.assertTrue; public class CustomMessageParseTest { private static final HapiContext HAPI_CONTEXT = createHapiContext(); private static final String MSH_FOR_ORU_R01 = "MSH|^~\\&|MSH-3|MSH-4|MSH-5.1^MSH-5.2|MSH-6|20130605000036|MSH-8|ORU^R01|MSH-10|P|2.3|MSH-13|MSH-14|MSH-15|MSH-16|MSH-17|MSH-18|MSH-19"; private static final String MSH_FOR_ORM_Q01 = "MSH|^~\\&|MSH-3|MSH-4|MSH-5.1^MSH-5.2|MSH-6|20130605000036|MSH-8|ORM^Q01|MSH-10|P|2.3|MSH-13|MSH-14|MSH-15|MSH-16|MSH-17|MSH-18|MSH-19"; @Test public void testParseCustomORU_R01Message() throws HL7Exception { Message message = new GenericParser(HAPI_CONTEXT).parse(MSH_FOR_ORU_R01); assertTrue("Parse custom ORU_R01 message", message instanceof ORU_R01); } @Test public void testParseCustomORU_Q01Message() throws HL7Exception { Message message = new GenericParser(HAPI_CONTEXT).parse(MSH_FOR_ORM_Q01); assertTrue("Parse custom ORU_Q01 message", message instanceof ORM_Q01); } private static HapiContext createHapiContext() { System.setProperty(Varies.DEFAULT_OBX2_TYPE_PROP, "ST"); System.setProperty(Varies.INVALID_OBX2_TYPE_PROP, "ST"); HapiContext hapiContext = new DefaultHapiContext(); Map<String, String[]> hl7VersionPackageNamesMap = new HashMap<String, String[]>(); String[] packageNames = {"ca.uhn.hl7v2.model.v24", "au.gov.qld.health.sit.hl7.ormis"}; hl7VersionPackageNamesMap.put("2.3", packageNames); hl7VersionPackageNamesMap.put("2.3.1", packageNames); hl7VersionPackageNamesMap.put("2.4", packageNames); hapiContext.setModelClassFactory(new CustomModelClassFactory(hl7VersionPackageNamesMap)); hapiContext.setValidationRuleBuilder(new NoValidationBuilder()); return hapiContext; } } From: Davies, Brian [mailto:Bri...@Mc...] Sent: Wednesday, 23 December 2015 1:39 AM To: hl7...@li... Subject: Re: [HAPI-devel] Custom Model Classes Forgot to include the exception: RDS_R06is called!!!!!!! Exception in thread "main" java.lang.ClassCastException: ca.uhn.hl7v2.model.GenericSegment cannot be cast to com.mckn.mms.lds.hl7.zxx.custommodel.v25.group.PFG at com.mckn.mms.lds.hl7.zxx.custommodelv25.message.RDS_R06.getPFG(RDS_R06.java:67) at com.mpls.lds.hl7.zxx.custommodel.v25.message.TestMessageCreation.testParseCustomRDS_R06Message(TestMessageCreation.java:46) at com.mpls.lds.hl7.zxx.custommodel.v25.message.TestMessageCreation.main(TestMessageCreation.java:88) From: Davies, Brian [mailto:Bri...@Mc...] Sent: Tuesday, December 22, 2015 9:36 AM To: hl7...@li...<mailto:hl7...@li...> Subject: [HAPI-devel] Custom Model Classes Hi All, It seems to me that the custom model classes simply do not recognize the AbstractGroup types even when one tries to forcefully load the group from the custom model. I think Christian is absolutely right that the eventmap is the solution known to work for this issue. The problem for me however is that that solution seems rather extreme. Unfortunately, the message type I am trying to create is not a standard type. Here is a case in point. The code snippet below is actually in a package xxx.xxx.<version>.<type> but it seems only the eventmap is able to recognize all types package com.mckn.mms.lds.hl7.zxx.custommodel.v25.group public class PFG extends AbstractGroup { private static final long serialVersionUID = -5950843839679571210L; public PFG(Group parent, ModelClassFactory factory) { super(parent, factory); try { init(); } catch (HL7Exception e) { log.error("Unexpected error creating PFG.", e); } } ...... package com.mckn.mms.lds.hl7.zxx.custommodel.v25.group public PFG getPFG(){ //An attempt to load ModelClassFactory cfm = new CustomModelClassFactory( "com.mckn.mms.lds.hl7.zxx.custommodel"); Class c=null; try { c = cfm.getTypeClass("PFG", "2.5"); } catch (HL7Exception e) { return null; } return (PFG)super.getTyped("PFG", c); } I have tried all the recommendations so far, except for the eventmap solution, but with no success. Unfortunately, there is not enough information showing an instance of creating a completely new message type implementation from scratch. Has anyone got a working solution to this problem? ******************************************************************************** This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error. Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters. If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175 or by return email. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced. If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited. Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email. Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government. ********************************************************************************** |
From: Davies, B. <Bri...@Mc...> - 2015-12-22 15:39:27
|
Forgot to include the exception: RDS_R06is called!!!!!!! Exception in thread "main" java.lang.ClassCastException: ca.uhn.hl7v2.model.GenericSegment cannot be cast to com.mckn.mms.lds.hl7.zxx.custommodel.v25.group.PFG at com.mckn.mms.lds.hl7.zxx.custommodelv25.message.RDS_R06.getPFG(RDS_R06.java:67) at com.mpls.lds.hl7.zxx.custommodel.v25.message.TestMessageCreation.testParseCustomRDS_R06Message(TestMessageCreation.java:46) at com.mpls.lds.hl7.zxx.custommodel.v25.message.TestMessageCreation.main(TestMessageCreation.java:88) From: Davies, Brian [mailto:Bri...@Mc...] Sent: Tuesday, December 22, 2015 9:36 AM To: hl7...@li... Subject: [HAPI-devel] Custom Model Classes Hi All, It seems to me that the custom model classes simply do not recognize the AbstractGroup types even when one tries to forcefully load the group from the custom model. I think Christian is absolutely right that the eventmap is the solution known to work for this issue. The problem for me however is that that solution seems rather extreme. Unfortunately, the message type I am trying to create is not a standard type. Here is a case in point. The code snippet below is actually in a package xxx.xxx.<version>.<type> but it seems only the eventmap is able to recognize all types package com.mckn.mms.lds.hl7.zxx.custommodel.v25.group public class PFG extends AbstractGroup { private static final long serialVersionUID = -5950843839679571210L; public PFG(Group parent, ModelClassFactory factory) { super(parent, factory); try { init(); } catch (HL7Exception e) { log.error("Unexpected error creating PFG.", e); } } ...... package com.mckn.mms.lds.hl7.zxx.custommodel.v25.group public PFG getPFG(){ //An attempt to load ModelClassFactory cfm = new CustomModelClassFactory( "com.mckn.mms.lds.hl7.zxx.custommodel"); Class c=null; try { c = cfm.getTypeClass("PFG", "2.5"); } catch (HL7Exception e) { return null; } return (PFG)super.getTyped("PFG", c); } I have tried all the recommendations so far, except for the eventmap solution, but with no success. Unfortunately, there is not enough information showing an instance of creating a completely new message type implementation from scratch. Has anyone got a working solution to this problem? |
From: Davies, B. <Bri...@Mc...> - 2015-12-22 15:36:19
|
Hi All, It seems to me that the custom model classes simply do not recognize the AbstractGroup types even when one tries to forcefully load the group from the custom model. I think Christian is absolutely right that the eventmap is the solution known to work for this issue. The problem for me however is that that solution seems rather extreme. Unfortunately, the message type I am trying to create is not a standard type. Here is a case in point. The code snippet below is actually in a package xxx.xxx.<version>.<type> but it seems only the eventmap is able to recognize all types package com.mckn.mms.lds.hl7.zxx.custommodel.v25.group public class PFG extends AbstractGroup { private static final long serialVersionUID = -5950843839679571210L; public PFG(Group parent, ModelClassFactory factory) { super(parent, factory); try { init(); } catch (HL7Exception e) { log.error("Unexpected error creating PFG.", e); } } ...... package com.mckn.mms.lds.hl7.zxx.custommodel.v25.group public PFG getPFG(){ //An attempt to load ModelClassFactory cfm = new CustomModelClassFactory( "com.mckn.mms.lds.hl7.zxx.custommodel"); Class c=null; try { c = cfm.getTypeClass("PFG", "2.5"); } catch (HL7Exception e) { return null; } return (PFG)super.getTyped("PFG", c); } I have tried all the recommendations so far, except for the eventmap solution, but with no success. Unfortunately, there is not enough information showing an instance of creating a completely new message type implementation from scratch. Has anyone got a working solution to this problem? |
From: Davies, B. <Bri...@Mc...> - 2015-12-19 21:53:35
|
After making some changes the RDS_R06 class is loaded but not the PFG custom Group. I tried different package arrangements for the PFG group but it never got loaded. I notice in Ian's example he extends from class ORU_ORMIS, whilst I'm extending from AbstractMessage. I see that as the most significant difference in my approach. Other than extending AbstractMessage I'm not aware of which standard class to extend from. This is the structure of the code : com.lds.hl7.zxx.custommodel.v25.message RDS_R06 , this is the custom message class com.lds.hl7.zxx.custommodel.v25.segment ZR2 , this is a custom segment Other segments etc. are also present in this package but omitted. com.lds.hl7.zxx.custommodel.v25.group PFG package com.lds.hl7.zxx.custommodel.v25.message; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import com..lds.hl7.zxx.custommodel.v25.group.PFG; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.model.AbstractMessage; import ca.uhn.hl7v2.model.v25.segment.MSH; import ca.uhn.hl7v2.parser.DefaultModelClassFactory; import ca.uhn.hl7v2.parser.ModelClassFactory; /////////////////Custom Message////////////////// public class RDS_R06 extends AbstractMessage { private static final long serialVersionUID = -3887972873943927154L; public RDS_R06() { this(new DefaultModelClassFactory()); } public RDS_R06(ModelClassFactory theFactory) { super(theFactory); init(theFactory); } private void init(ModelClassFactory factory) { try { System.out.println("RDS_R06is called!!!!!!!"); this.add(MSH.class, true, false, false); this.add(PFG.class, true, true, false); } catch (HL7Exception e) { log.error("Unexpected error creating PFM - this is probably a bug in " + "the source code generator.", e); } } public MSH getMSH() { return getTyped("MSH", MSH.class); } public java.util.List<PFG> getPFGAll() { try { return getAllAsList("PFG", PFG.class); } catch (HL7Exception e) { return new ArrayList<PFG>(); } } public int getPFGReps() { return getReps("PFG"); } } ///////////////////////Custom Group//////////////////// import com.lds.hl7.zxx.custommodel.v25.segment.ZR2; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.model.AbstractGroup; import ca.uhn.hl7v2.model.Group; import ca.uhn.hl7v2.model.v25.segment.ORC; import ca.uhn.hl7v2.model.v25.segment.PID; import ca.uhn.hl7v2.model.v25.segment.RXD; import ca.uhn.hl7v2.parser.ModelClassFactory; public class PFG extends AbstractGroup { private static final long serialVersionUID = -5950843839679571210L; protected PFG(Group parent, ModelClassFactory factory) { super(parent, factory); try { init(); } catch (HL7Exception e) { log.error("Unexpected error creating PFG.", e); } } private void init() throws HL7Exception { this.add(PID.class, true, false); this.add(ORC.class, true, false); this.add(RXD.class, true, false); this.add(ZR2.class, true, false); System.out.println("PFG!!!!!!"); } public String getVersion() { return "2.5"; } public PID getPID() { return getTyped("PID", PID.class); } public ORC getORC() { return getTyped("ORC", ORC.class); } public RXD getRXD() { return getTyped("RXD", RXD.class); } public ZR2 getZR2() { return getTyped("ZR2", ZR2.class); } @Override public String getName() { return "PFG"; } } ////////////////////Test Class////////////// public void testParseCustomRDS_R06Message() throws HL7Exception { String RDS_R06="MSH|^~\\&|VENDOR NAME ||CDB||20010925202704||RDS^R06|573-013240530-4|P|2.5\r" +"PID|||11111111116 ||WATER^UNDER^^||||||DEEP 6 STREET^^CHARLESTON^SC^29405||(843) 745-4124\r" +"ORC|OK|573-200009492-4\r" +"RXD|1|S0022^SIMVASTATIN 40MG TAB^L|20010822081001|45|||200009492|||||||||||0108064|20020801||||||12345123412^SK567\r" +"ZR2|CTC-USPS|5161145008952133980|200009492|30.40|2.00|4.50|13.20|218^Big West Warehouse^2150 Hecker Pass HWY^^ Gilroy^ CA^95020\r"; Parser p=new GenericParser(); Map<String, String[]> hl7VersionPackageNamesMap = new HashMap<String, String[]>(); String[] packageNames = {"ca.uhn.hl7v2.model.v25","com.mpls.lds.hl7.zxx.custommodel.v25.message","com.mckesson.mms.ecb2b.hl7.zxx.custommodel"}; hl7VersionPackageNamesMap.put("2.3", packageNames); hl7VersionPackageNamesMap.put("2.3.1", packageNames); hl7VersionPackageNamesMap.put("2.4", packageNames); hl7VersionPackageNamesMap.put("2.5", packageNames); ModelClassFactory cfm=new CustomModelClassFactory(hl7VersionPackageNamesMap); HapiContext context=new DefaultHapiContext(cfm); //Get a Parser from the HapiContext created with the CustomModelClassFactory Parser pipeParser = context.getPipeParser(); Message mm=pipeParser.parse(RDS_R06); //Use the Parser created from the createHapiContext() context Message message = new GenericParser(HAPI_CONTEXT).parse(RDS_R06); //This loads the RDS_R06 class System.out.println("Class Message RDS_R06 is instanceof is "+(message instanceof RDS_R06)); //This doesn't load the RDS_R06 class System.out.println("Class Message RDS_R06 is instanceof is "+(mm instanceof RDS_R06)); } ////// Using ths HapiContext This doesn't give me any different results. ////In fact this doesn't even load the RDS_R06 class private static HapiContext createHapiContext() { System.setProperty(Varies.DEFAULT_OBX2_TYPE_PROP, "ST"); System.setProperty(Varies.INVALID_OBX2_TYPE_PROP, "ST"); Map<String, String[]> hl7VersionPackageNamesMap = new HashMap<String, String[]>(); String[] packageNames = {"ca.uhn.hl7v2.model.v25","com.mckesson.mms.ecb2b.hl7.zxx.custommodel","com.mpls.lds.hl7.zxx.custommodel.v25.message"}; hl7VersionPackageNamesMap.put("2.3", packageNames); hl7VersionPackageNamesMap.put("2.3.1", packageNames); hl7VersionPackageNamesMap.put("2.4", packageNames); hl7VersionPackageNamesMap.put("2.5", packageNames); HapiContext hapiContext = new DefaultHapiContext(); hapiContext.setModelClassFactory(new CustomModelClassFactory(hl7VersionPackageNamesMap)); hapiContext.setValidationRuleBuilder(new NoValidationBuilder()); return hapiContext; } Output is : RDS_R06is called!!!!!!! Message is instanceof RDS_R06 is is false Message is instanceof RDS_R06 is is false |
From: Davies, B. <Bri...@Mc...> - 2015-12-19 05:21:24
|
Hi All, Unfortunately, this did not work for me. It may be that I am missing something though: Here's what I have : To keep things simple I put everything in one package, with the view to moving them around once I got it working: com.mpls.lds.hl7.zxx.custommodel.v25.message Then I had the following classes all under the package: package com.mpls.lds.hl7.zxx.custommodel.v25.message; //////////////////////Custom Message Class////////////////////////// import java.util.ArrayList; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.model.AbstractMessage; import ca.uhn.hl7v2.model.v25.segment.MSH; import ca.uhn.hl7v2.parser.DefaultModelClassFactory; import ca.uhn.hl7v2.parser.ModelClassFactory; public class RDS_R06 extends AbstractMessage { private static final long serialVersionUID = -3887972873943927154L; public RDS_R06() { this(new DefaultModelClassFactory()); } public RDS_R06(ModelClassFactory theFactory) { super(theFactory); init(theFactory); } private void init(ModelClassFactory factory) { try { this.add(MSH.class, true, false, false); this.add(PFG.class, true, true, false); } catch (HL7Exception e) { log.error("Unexpected error creating PFM - this is probably a bug in " + "the source code generator.", e); } } public MSH getMSH() { return getTyped("MSH", MSH.class); } public java.util.List<PFG> getPFGAll() { try { return getAllAsList("PFG", PFG.class); } catch (HL7Exception e) { return new ArrayList<PFG>(); } } public int getPFGReps() { return getReps("PFG"); } } ////////////////////////////////Custom AbstractGroup/////////////////////////////// package com.mpls.lds.hl7.zxx.custommodel.v25.message; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.model.AbstractGroup; import ca.uhn.hl7v2.model.Group; import ca.uhn.hl7v2.model.v25.segment.ORC; import ca.uhn.hl7v2.model.v25.segment.PID; import ca.uhn.hl7v2.model.v25.segment.RXD; import ca.uhn.hl7v2.parser.ModelClassFactory; public class PFG extends AbstractGroup { private static final long serialVersionUID = -5950843839679571210L; protected PFG(Group parent, ModelClassFactory factory) { super(parent, factory); try { init(); } catch (HL7Exception e) { log.error("Unexpected error creating PFG.", e); } } private void init() throws HL7Exception { this.add(PID.class, true, false); this.add(ORC.class, true, false); this.add(RXD.class, true, false); this.add(ZR2.class, true, false); System.out.println("It's PFG!!!!!"); System.exit(1); } public String getVersion() { return "2.5"; } public PID getPID() { return getTyped("PID", PID.class); } public ORC getORC() { return getTyped("ORC", ORC.class); } public RXD getRXD() { return getTyped("RXD", RXD.class); } public ZR2 getZR2() { return getTyped("ZR2", ZR2.class); } @Override public String getName() { return "PFG"; } } ///////////////////////Sample of Custom Segment/////////////////////////////// package com.mpls.lds.hl7.zxx.custommodel.v25.message; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.model.AbstractSegment; import ca.uhn.hl7v2.model.Group; import ca.uhn.hl7v2.parser.ModelClassFactory; import ca.uhn.hl7v2.model.v25.datatype.ST; import ca.uhn.hl7v2.model.v25.datatype.MO; public class ZR2 extends AbstractSegment { private static final long serialVersionUID = 7834808545741928104L; public ZR2(Group parent, ModelClassFactory factory) throws HL7Exception { super(parent, factory); add(ST.class, false, 1, 12, new Object[] { getMessage() }, "Carrier"); add(ST.class, false, 1, 256, new Object[]{ getMessage() }, "Package Tracking Number"); add(ST.class, false,1, 20, new Object[] { getMessage() }, "Prescription Number"); add(MO.class, false,1, 20, new Object[] { getMessage() }, "Rx Drug Cost"); add(MO.class, false, 1, 20, new Object[] { getMessage() }, "Dispensing Fee"); add(MO.class, false, 1, 20, new Object[] { getMessage() }, "Mailing Cost"); add(MO.class, false, 1, 20, new Object[] { getMessage() }, "Cost Per Dispense Unit"); add(ST.class, false, 1, 103, new Object[] { getMessage() }, "Dispensing Location"); add(ST.class, false, 0, 500, new Object[] { getMessage() }, "Package Weight"); } public ST getCarrier() throws HL7Exception{ return (ST) super.getField(1,0); } public ST getPackageTrackingNumber() throws HL7Exception{ return (ST) super.getField(2,0); } public ST getPrescriptionNumber() throws HL7Exception{ return (ST) super.getField(3,0); } public MO getRxDrugCost() throws HL7Exception{ return (MO) super.getField(4,0); } public MO getDispensingFee() throws HL7Exception{ return (MO) super.getField(5,0); } public MO getMailingCost() throws HL7Exception{ return (MO) super.getField(6,0); } public MO getCostPerDispenseUnit() throws HL7Exception{ return (MO) super.getField(7,0); } public ST getDispensingLocation() throws HL7Exception{ return (ST) super.getField(8,0); } public ST[] getPackageWeight() throws HL7Exception{ return (ST[]) super.getField(9); } @Override public String getName() { return "ZR2"; } } ////////////////////////////////////Test Class//////////////////////// package com.mpls.lds.hl7.zxx.custommodel.v25.message; import ca.uhn.hl7v2.HL7Exception; import java.util.HashMap; import java.util.Map; import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.DefaultHapiContext; import ca.uhn.hl7v2.HapiContext; import ca.uhn.hl7v2.model.Varies; import ca.uhn.hl7v2.parser.CustomModelClassFactory; import ca.uhn.hl7v2.parser.GenericParser; import ca.uhn.hl7v2.validation.builder.support.NoValidationBuilder; public class TestMessageCreation { private static final HapiContext HAPI_CONTEXT = createHapiContext(); String RDS_R06="MSH|^~\\&|VENDOR NAME ||CDB||20010925202704||RDS^R06|573-013240530-4|P|2.5\r" +"PID|||11111111116 ||WATER^UNDER^^||||||DEEP 6 STREET^^CHARLESTON^SC^29405||(843) 745-4124\r" +"ORC|OK|573-200009492-4\r" +"RXD|1|S0022^SIMVASTATIN 40MG TAB^L|20010822081001|45|||200009492|||||||||||0108064|20020801||||||12345123412^SK567\r" +"ZR2|CTC-USPS|5161145008952133980|200009492|30.40|2.00|4.50|13.20|218^Big West Warehouse^2150 Hecker Pass HWY^^ Gilroy^ CA^95020\r"; public void testParseCustomRDS_R06Message() throws HL7Exception { Message message = new GenericParser(HAPI_CONTEXT).parse(RDS_R06); System.out.println("Class is type "+message.printStructure()); System.out.println("Class Message RDS_R06 is instanceof is "+(message instanceof RDS_R06)); //assertTrue("Parse custom ORU_R01 message", message instanceof ORU_R01); } private static HapiContext createHapiContext() { System.setProperty(Varies.DEFAULT_OBX2_TYPE_PROP, "ST"); System.setProperty(Varies.INVALID_OBX2_TYPE_PROP, "ST"); HapiContext hapiContext = new DefaultHapiContext(); Map<String, String[]> hl7VersionPackageNamesMap = new HashMap<String, String[]>(); String[] packageNames = {"ca.uhn.hl7v2.model.v25","com.mpls.lds.hl7.zxx.custommodel.v25.message"}; hl7VersionPackageNamesMap.put("2.3", packageNames); hl7VersionPackageNamesMap.put("2.3.1", packageNames); hl7VersionPackageNamesMap.put("2.4", packageNames); hl7VersionPackageNamesMap.put("2.5", packageNames); hapiContext.setModelClassFactory(new CustomModelClassFactory(hl7VersionPackageNamesMap)); hapiContext.setValidationRuleBuilder(new NoValidationBuilder()); return hapiContext; } public static void main(String[] args) { try { new TestMessageCreation().testParseCustomRDS_R06Message (); } catch (HL7Exception e) { } } } I'd appreciate any help in pointing out what I might have missed. Many thanks, Brian Davies From: Ian Vowles [mailto:Ian...@he...] Sent: Thursday, December 17, 2015 3:49 PM To: hl7...@li... Subject: Re: [HAPI-devel] Custom Messages If you arrange your custom classes in a package structure for the custom message (let's use our ORMIS sending system as an example) like this: xxx.xxx.ormis.group - contains any custom group definitions OBSERVATION.java ORMIS_ORDER_OBSERVATION.java PATIENT.java VISIT.java xxx.xxx.ormis.segment - contains any custom segments ZTD.java ZWL.java xxx.xxx.ormis.message - contains the custom message structure and classes named after the message type(s) you wish to override from the standard ORMIS_ORU.java ORU_R01.java The ORU_R01.java is coded thus: package au.gov.qld.health.sit.hl7.ormis.message; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.parser.ModelClassFactory; /** * Enable HAPI to generate an ORU^R01 message implementation of ORMIS_ORU * based on the values of MSH-9-1 and MSH-9-2. */ public class ORU_R01 extends ORMIS_ORU { public ORU_R01(ModelClassFactory factory) throws HL7Exception { super(factory); } } To get these picked up when you are throwing messages around you use the strategy shown in this test case: package au.gov.qld.health.sit.hl7.ormis; import au.gov.qld.health.sit.hl7.ormis.message.ORU_R01; import ca.uhn.hl7v2.DefaultHapiContext; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.HapiContext; import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.model.Varies; import ca.uhn.hl7v2.parser.CustomModelClassFactory; import ca.uhn.hl7v2.parser.GenericParser; import ca.uhn.hl7v2.validation.builder.support.NoValidationBuilder; import java.util.HashMap; import java.util.Map; import org.junit.Test; import static org.junit.Assert.assertTrue; public class CustomMessageParseTest { private static final HapiContext HAPI_CONTEXT = createHapiContext(); private static final String MSH_FOR_ORU_R01 = "MSH|^~\\&|MSH-3|MSH-4|MSH-5.1^MSH-5.2|MSH-6|20130605000036|MSH-8|ORU^R01|MSH-10|P|2.3|MSH-13|MSH-14|MSH-15|MSH-16|MSH-17|MSH-18|MSH-19"; @Test public void testParseCustomORU_R01Message() throws HL7Exception { Message message = new GenericParser(HAPI_CONTEXT).parse(MSH_FOR_ORU_R01); assertTrue("Parse custom ORU_R01 message", message instanceof ORU_R01); } private static HapiContext createHapiContext() { System.setProperty(Varies.DEFAULT_OBX2_TYPE_PROP, "ST"); System.setProperty(Varies.INVALID_OBX2_TYPE_PROP, "ST"); HapiContext hapiContext = new DefaultHapiContext(); Map<String, String[]> hl7VersionPackageNamesMap = new HashMap<String, String[]>(); String[] packageNames = {"ca.uhn.hl7v2.model.v24", "au.gov.qld.health.sit.hl7.ormis"}; hl7VersionPackageNamesMap.put("2.3", packageNames); hl7VersionPackageNamesMap.put("2.3.1", packageNames); hl7VersionPackageNamesMap.put("2.4", packageNames); hapiContext.setModelClassFactory(new CustomModelClassFactory(hl7VersionPackageNamesMap)); hapiContext.setValidationRuleBuilder(new NoValidationBuilder()); return hapiContext; } } Note that this isn't exactly 'non intrusive' and if you want to you can just instantiate your custom message class directly and parse the message you have received. However this method works very well where a message stream contains several message types, of which only a few types have custom implementations. All other message types will grab the standard version out of the happy library. Watch for the gotcha when setting the packageNames array. If multiple listed packages contain an implementation of a particular message type it is the implementation contained in the LAST package in the list where that type is found that wins out. NOT the first as we originally assumed when we first tried. Also note that we have 'forced' messages of various HL7 version to be implemented against vs 2.4 of the standard HAPI libraries. Mostly we do this for convenience, and also because senders don't always update the values they send in the messages when they have updated the structure they use. Overall we push everything up to 2.4 because all our senders use versions below that. In your previous posts you look to have been using vs 2.5, so you may not have to go to these lengths. Many thanks to Mike and Damian from our team who deep-dived the HAPI source to work out exactly how this functions. Hope this helps Ian From: Davies, Brian [mailto:Bri...@Mc...] Sent: Friday, 18 December 2015 5:47 AM To: hl7...@li...<mailto:hl7...@li...> Subject: [HAPI-devel] Custom Messages Hi All, I am aware that in order for custom messages to be loaded by a CustomModelFactory they need to be registered in the eventmap. However, I am only able to find the eventmap in ca.uhn.hl7v2.parser.eventmap with the associated 2.5.properties for version 2.5 say. Does it mean that I would have to unpack the jar, make the changes in the properties file and then reassemble the jar? In a nutshell, what is the most non intrusive way of getting HAPI to recognize custom messages? I was able to create custom segments easily by simply putting them in a package name ending in mypackage.v25.segment. Thanks, Brian Davies ******************************************************************************** This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error. Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters. If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175 or by return email. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced. If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited. Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email. Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government. ********************************************************************************** |
From: Davies, B. <Bri...@Mc...> - 2015-12-18 00:02:44
|
It truly does help. I will try this out. My message is of an entirely new type ORM_QO1 from a third party application and so I will be extending the AbstractMessage class. I take it this should be no problem as long as I utilize the HapiContext as you've indicated. Again many thanks for your help. Brian Davies. From: Ian Vowles [mailto:Ian...@he...] Sent: Thursday, December 17, 2015 3:49 PM To: hl7...@li... Subject: Re: [HAPI-devel] Custom Messages If you arrange your custom classes in a package structure for the custom message (let's use our ORMIS sending system as an example) like this: xxx.xxx.ormis.group - contains any custom group definitions OBSERVATION.java ORMIS_ORDER_OBSERVATION.java PATIENT.java VISIT.java xxx.xxx.ormis.segment - contains any custom segments ZTD.java ZWL.java xxx.xxx.ormis.message - contains the custom message structure and classes named after the message type(s) you wish to override from the standard ORMIS_ORU.java ORU_R01.java The ORU_R01.java is coded thus: package au.gov.qld.health.sit.hl7.ormis.message; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.parser.ModelClassFactory; /** * Enable HAPI to generate an ORU^R01 message implementation of ORMIS_ORU * based on the values of MSH-9-1 and MSH-9-2. */ public class ORU_R01 extends ORMIS_ORU { public ORU_R01(ModelClassFactory factory) throws HL7Exception { super(factory); } } To get these picked up when you are throwing messages around you use the strategy shown in this test case: package au.gov.qld.health.sit.hl7.ormis; import au.gov.qld.health.sit.hl7.ormis.message.ORU_R01; import ca.uhn.hl7v2.DefaultHapiContext; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.HapiContext; import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.model.Varies; import ca.uhn.hl7v2.parser.CustomModelClassFactory; import ca.uhn.hl7v2.parser.GenericParser; import ca.uhn.hl7v2.validation.builder.support.NoValidationBuilder; import java.util.HashMap; import java.util.Map; import org.junit.Test; import static org.junit.Assert.assertTrue; public class CustomMessageParseTest { private static final HapiContext HAPI_CONTEXT = createHapiContext(); private static final String MSH_FOR_ORU_R01 = "MSH|^~\\&|MSH-3|MSH-4|MSH-5.1^MSH-5.2|MSH-6|20130605000036|MSH-8|ORU^R01|MSH-10|P|2.3|MSH-13|MSH-14|MSH-15|MSH-16|MSH-17|MSH-18|MSH-19"; @Test public void testParseCustomORU_R01Message() throws HL7Exception { Message message = new GenericParser(HAPI_CONTEXT).parse(MSH_FOR_ORU_R01); assertTrue("Parse custom ORU_R01 message", message instanceof ORU_R01); } private static HapiContext createHapiContext() { System.setProperty(Varies.DEFAULT_OBX2_TYPE_PROP, "ST"); System.setProperty(Varies.INVALID_OBX2_TYPE_PROP, "ST"); HapiContext hapiContext = new DefaultHapiContext(); Map<String, String[]> hl7VersionPackageNamesMap = new HashMap<String, String[]>(); String[] packageNames = {"ca.uhn.hl7v2.model.v24", "au.gov.qld.health.sit.hl7.ormis"}; hl7VersionPackageNamesMap.put("2.3", packageNames); hl7VersionPackageNamesMap.put("2.3.1", packageNames); hl7VersionPackageNamesMap.put("2.4", packageNames); hapiContext.setModelClassFactory(new CustomModelClassFactory(hl7VersionPackageNamesMap)); hapiContext.setValidationRuleBuilder(new NoValidationBuilder()); return hapiContext; } } Note that this isn't exactly 'non intrusive' and if you want to you can just instantiate your custom message class directly and parse the message you have received. However this method works very well where a message stream contains several message types, of which only a few types have custom implementations. All other message types will grab the standard version out of the happy library. Watch for the gotcha when setting the packageNames array. If multiple listed packages contain an implementation of a particular message type it is the implementation contained in the LAST package in the list where that type is found that wins out. NOT the first as we originally assumed when we first tried. Also note that we have 'forced' messages of various HL7 version to be implemented against vs 2.4 of the standard HAPI libraries. Mostly we do this for convenience, and also because senders don't always update the values they send in the messages when they have updated the structure they use. Overall we push everything up to 2.4 because all our senders use versions below that. In your previous posts you look to have been using vs 2.5, so you may not have to go to these lengths. Many thanks to Mike and Damian from our team who deep-dived the HAPI source to work out exactly how this functions. Hope this helps Ian From: Davies, Brian [mailto:Bri...@Mc...] Sent: Friday, 18 December 2015 5:47 AM To: hl7...@li...<mailto:hl7...@li...> Subject: [HAPI-devel] Custom Messages Hi All, I am aware that in order for custom messages to be loaded by a CustomModelFactory they need to be registered in the eventmap. However, I am only able to find the eventmap in ca.uhn.hl7v2.parser.eventmap with the associated 2.5.properties for version 2.5 say. Does it mean that I would have to unpack the jar, make the changes in the properties file and then reassemble the jar? In a nutshell, what is the most non intrusive way of getting HAPI to recognize custom messages? I was able to create custom segments easily by simply putting them in a package name ending in mypackage.v25.segment. Thanks, Brian Davies ******************************************************************************** This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error. Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters. If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175 or by return email. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced. If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited. Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email. Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government. ********************************************************************************** |
From: Ian V. <Ian...@he...> - 2015-12-17 21:49:28
|
If you arrange your custom classes in a package structure for the custom message (let's use our ORMIS sending system as an example) like this: xxx.xxx.ormis.group - contains any custom group definitions OBSERVATION.java ORMIS_ORDER_OBSERVATION.java PATIENT.java VISIT.java xxx.xxx.ormis.segment - contains any custom segments ZTD.java ZWL.java xxx.xxx.ormis.message - contains the custom message structure and classes named after the message type(s) you wish to override from the standard ORMIS_ORU.java ORU_R01.java The ORU_R01.java is coded thus: package au.gov.qld.health.sit.hl7.ormis.message; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.parser.ModelClassFactory; /** * Enable HAPI to generate an ORU^R01 message implementation of ORMIS_ORU * based on the values of MSH-9-1 and MSH-9-2. */ public class ORU_R01 extends ORMIS_ORU { public ORU_R01(ModelClassFactory factory) throws HL7Exception { super(factory); } } To get these picked up when you are throwing messages around you use the strategy shown in this test case: package au.gov.qld.health.sit.hl7.ormis; import au.gov.qld.health.sit.hl7.ormis.message.ORU_R01; import ca.uhn.hl7v2.DefaultHapiContext; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.HapiContext; import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.model.Varies; import ca.uhn.hl7v2.parser.CustomModelClassFactory; import ca.uhn.hl7v2.parser.GenericParser; import ca.uhn.hl7v2.validation.builder.support.NoValidationBuilder; import java.util.HashMap; import java.util.Map; import org.junit.Test; import static org.junit.Assert.assertTrue; public class CustomMessageParseTest { private static final HapiContext HAPI_CONTEXT = createHapiContext(); private static final String MSH_FOR_ORU_R01 = "MSH|^~\\&|MSH-3|MSH-4|MSH-5.1^MSH-5.2|MSH-6|20130605000036|MSH-8|ORU^R01|MSH-10|P|2.3|MSH-13|MSH-14|MSH-15|MSH-16|MSH-17|MSH-18|MSH-19"; @Test public void testParseCustomORU_R01Message() throws HL7Exception { Message message = new GenericParser(HAPI_CONTEXT).parse(MSH_FOR_ORU_R01); assertTrue("Parse custom ORU_R01 message", message instanceof ORU_R01); } private static HapiContext createHapiContext() { System.setProperty(Varies.DEFAULT_OBX2_TYPE_PROP, "ST"); System.setProperty(Varies.INVALID_OBX2_TYPE_PROP, "ST"); HapiContext hapiContext = new DefaultHapiContext(); Map<String, String[]> hl7VersionPackageNamesMap = new HashMap<String, String[]>(); String[] packageNames = {"ca.uhn.hl7v2.model.v24", "au.gov.qld.health.sit.hl7.ormis"}; hl7VersionPackageNamesMap.put("2.3", packageNames); hl7VersionPackageNamesMap.put("2.3.1", packageNames); hl7VersionPackageNamesMap.put("2.4", packageNames); hapiContext.setModelClassFactory(new CustomModelClassFactory(hl7VersionPackageNamesMap)); hapiContext.setValidationRuleBuilder(new NoValidationBuilder()); return hapiContext; } } Note that this isn't exactly 'non intrusive' and if you want to you can just instantiate your custom message class directly and parse the message you have received. However this method works very well where a message stream contains several message types, of which only a few types have custom implementations. All other message types will grab the standard version out of the happy library. Watch for the gotcha when setting the packageNames array. If multiple listed packages contain an implementation of a particular message type it is the implementation contained in the LAST package in the list where that type is found that wins out. NOT the first as we originally assumed when we first tried. Also note that we have 'forced' messages of various HL7 version to be implemented against vs 2.4 of the standard HAPI libraries. Mostly we do this for convenience, and also because senders don't always update the values they send in the messages when they have updated the structure they use. Overall we push everything up to 2.4 because all our senders use versions below that. In your previous posts you look to have been using vs 2.5, so you may not have to go to these lengths. Many thanks to Mike and Damian from our team who deep-dived the HAPI source to work out exactly how this functions. Hope this helps Ian From: Davies, Brian [mailto:Bri...@Mc...] Sent: Friday, 18 December 2015 5:47 AM To: hl7...@li... Subject: [HAPI-devel] Custom Messages Hi All, I am aware that in order for custom messages to be loaded by a CustomModelFactory they need to be registered in the eventmap. However, I am only able to find the eventmap in ca.uhn.hl7v2.parser.eventmap with the associated 2.5.properties for version 2.5 say. Does it mean that I would have to unpack the jar, make the changes in the properties file and then reassemble the jar? In a nutshell, what is the most non intrusive way of getting HAPI to recognize custom messages? I was able to create custom segments easily by simply putting them in a package name ending in mypackage.v25.segment. Thanks, Brian Davies ******************************************************************************** This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error. Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters. If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175 or by return email. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced. If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited. Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email. Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government. ********************************************************************************** |
From: Davies, B. <Bri...@Mc...> - 2015-12-17 19:47:18
|
Hi All, I am aware that in order for custom messages to be loaded by a CustomModelFactory they need to be registered in the eventmap. However, I am only able to find the eventmap in ca.uhn.hl7v2.parser.eventmap with the associated 2.5.properties for version 2.5 say. Does it mean that I would have to unpack the jar, make the changes in the properties file and then reassemble the jar? In a nutshell, what is the most non intrusive way of getting HAPI to recognize custom messages? I was able to create custom segments easily by simply putting them in a package name ending in mypackage.v25.segment. Thanks, Brian Davies |
From: Davies, B. <Bri...@Mc...> - 2015-12-17 14:26:07
|
Thank you very much for your response. Thank you for clarifying my misunderstanding, gratefully appreciated! From: Ian Vowles [mailto:Ian...@he...] Sent: Wednesday, December 16, 2015 5:50 PM To: hl7...@li... Subject: Re: [HAPI-devel] Escaping Encoded characters In HL7 v2.5 the MSH-9 segment is a datatype with 3 fields. HAPI supports this, so it gives you getters and setters for all the components in the datatype. To set up what you want you can do the following: mshSegment.getMsh9_MessageType().getMessageCode().getMsg1_MessageCode().setValue("ORR"); mshSegment.getMsh9_MessageType().getMessageCode().getMsg2_TriggerEvent().setValue("O02"); HAPI also knows all about escaping, and does it's level best to make your life easy. If you want to get data escaped in a field, just use the setValue method with your string in java. So to build an ACK with the MSA-3 containing escaped ~ characters you can do the following: ACK myAck = new ACK(); myAck.initQuickstart("ACK", "", "P"); myAck.getMSA().getMsa1_AcknowledgmentCode().setValue("PD"); myAck.getMSA().getMsa2_MessageControlID().setValue("879-0999-1"); myAck.getMSA().getMsa3_TextMessage().setValue("Text1~Text2~Text3"); System.out.println(myAck.getMSA().encode()); The output of which is: MSA|PD|879-0999-1|Text1\R\Text2\R\Text3 Which is what you have asked for. HAPI does the escaping when you encode your result ready for sending. When you receive a message with escaped delimiter characters and parse it with HAPI, a getValue method will un-escape the characters for you, and give you a java string result. HAPI really knows HL7, and does a lot to help you. We have had a lot of success using it for many years now. Hope this helps Ian Vowles Department of Health Queensland Australia From: Davies, Brian [mailto:Bri...@Mc...] Sent: Thursday, 17 December 2015 7:19 AM To: hl7...@li...<mailto:hl7...@li...> Subject: [HAPI-devel] Escaping Encoded characters I want to be able to escaped the special encoding characters by using \S\ or \R\ but this doesn't seem to work for me. I also tried the code snippet below but it seems that using the quick start init method creates multiple repetitions of the message type, for example: ORR_O02 orr002=new ORR_O02(); MSH mshSegment = orr002.getMSH(); orr002.initQuickstart("ORR", "002", "P"); results in the message below with the message type repeated which is not what I want: MSH|^~\&|CDB||MCK||20010925202704||ORR^002^ORR_O02|1301|P|2.5 Instead I only want MSH|^~\&|CDB||MCK||20010925202704||ORR^002 |1301|P|2.5 I tried setting the message code like so: mshSegment.getMsh9_MessageType().getMessageCode().setValue("ORR\\S\\002"); but this produces MSH - MSH|^~\&|CDB||MCK||20010925202704||ORR\E\S\E\002|||2.5 It's not clear how to accomplish escaping encoding characters. How does one do that, since the above does not work? For example, I want to escaped the tilde in the message below, can this be done and how? I hoped \R\ would work but it didn't. MSA|PD|879-0999-1|Text1~Text2~Text3 ******************************************************************************** This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error. Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters. If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175 or by return email. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced. If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited. Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email. Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government. ********************************************************************************** |
From: Jeremy H. <jer...@ka...> - 2015-12-17 12:14:19
|
I think Brian's confusion here is partially about initQuickstart() adding an unexpected value in MSH-9-3. Similar to your suggestion, Ian, I think what Brian might be looking for is something like this to remove the value afterward: ORR_O02 o02 = new ORR_O02(); o02.initQuickstart("ORR", "O02", "P"); System.out.println(o02.toString().replaceAll("\r", "\n")); o02.getMSH().getMessageType().getMessageStructure().setValue(null); System.out.println(o02.toString().replaceAll("\r", "\n")); Which produces: MSH|^~\&|||||20151217123953.819+0100||ORR^O02^ORR_O02|210835|P|2.5 MSH|^~\&|||||20151217123953.819+0100||ORR^O02|210835|P|2.5 Jeremy Huiskamp | karoshealth Software Engineer 7 Father David Bauer Drive, Suite 201 Waterloo, ON, N2L 0A2, Canada www.karoshealth.com On 17 December 2015 at 00:49, Ian Vowles <Ian...@he...> wrote: > In HL7 v2.5 the MSH-9 segment is a datatype with 3 fields. HAPI supports > this, so it gives you getters and setters for all the components in the > datatype. > > To set up what you want you can do the following: > > > > mshSegment.getMsh9_MessageType().getMessageCode().getMsg1_MessageCode() > .setValue("ORR"); > > mshSegment.getMsh9_MessageType().getMessageCode().getMsg2_TriggerEvent() > .setValue("O02"); > > > > HAPI also knows all about escaping, and does it’s level best to make your > life easy. > > If you want to get data escaped in a field, just use the setValue method > with your string in java. > > > > So to build an ACK with the MSA-3 containing escaped ~ characters you can > do the following: > > > > ACK myAck = new ACK(); > > myAck.initQuickstart("ACK", "", "P"); > > myAck.getMSA().getMsa1_AcknowledgmentCode().setValue("PD"); > > myAck.getMSA().getMsa2_MessageControlID().setValue("879-0999-1"); > > myAck.getMSA().getMsa3_TextMessage().setValue("Text1~Text2~Text3"); > > System.out.println(myAck.getMSA().encode()); > > > > The output of which is: > > > > MSA|PD|879-0999-1|Text1\R\Text2\R\Text3 > > > > Which is what you have asked for. HAPI does the escaping when you encode > your result ready for sending. > > When you receive a message with escaped delimiter characters and parse it > with HAPI, a getValue method will un-escape the characters for you, and > give you a java string result. > > > > HAPI really knows HL7, and does a lot to help you. We have had a lot of > success using it for many years now. > > > > Hope this helps > > Ian Vowles > > Department of Health > > Queensland > > Australia > > > > *From:* Davies, Brian [mailto:Bri...@Mc...] > *Sent:* Thursday, 17 December 2015 7:19 AM > *To:* hl7...@li... > *Subject:* [HAPI-devel] Escaping Encoded characters > > > > I want to be able to escaped the special encoding characters by using \S\ > or \R\ but this doesn’t seem to work for me. > > > > I also tried the code snippet below but it seems that using the quick > start init method creates multiple repetitions of the message type, for > example: > > > > ORR_O02 orr002=*new* ORR_O02(); > > MSH mshSegment = orr002.getMSH(); > > * orr002.initQuickstart("ORR", "002", "P");* results in the > message below with the message type repeated which is not what I want: > > > > > > MSH|^~\&|CDB||MCK||20010925202704||ORR^002^ORR_O02|1301|P|2.5 > > > > Instead I only want > > > > MSH|^~\&|CDB||MCK||20010925202704||ORR^002 |1301|P|2.5 > > > > I tried setting the message code like so: > > mshSegment.getMsh9_MessageType().getMessageCode().setValue("ORR*\\S\\*002"); > but this produces > > MSH - MSH|^~\&|CDB||MCK||20010925202704||ORR\E\S\E\002|||2.5 > > > > It’s not clear how to accomplish escaping encoding characters. How does > one do that, since the above does not work? > > > > For example, I want to escaped the tilde in the message below, can this > be done and how? I hoped *\R\* would work but it didn’t. > > > > > > MSA|PD|879-0999-1|*Text1~Text2~Text3* > > > ******************************************************************************** > > This email, including any attachments sent with it, is confidential and > for the sole use of the intended recipient(s). This confidentiality is not > waived or lost, if you receive it and you are not the intended > recipient(s), or if it is transmitted/received in error. > > Any unauthorised use, alteration, disclosure, distribution or review of > this email is strictly prohibited. The information contained in this email, > including any attachment sent with it, may be subject to a statutory duty > of confidentiality if it relates to health service matters. > > If you are not the intended recipient(s), or if you have received this > email in error, you are asked to immediately notify the sender by telephone > collect on Australia +61 1800 198 175 or by return email. You should also > delete this email, and any copies, from your computer system network and > destroy any hard copies produced. > > If not an intended recipient of this email, you must not copy, distribute > or take any action(s) that relies on it; any form of disclosure, > modification, distribution and/or publication of this email is also > prohibited. > > Although Queensland Health takes all reasonable steps to ensure this email > does not contain malicious software, Queensland Health does not accept > responsibility for the consequences if any person's computer inadvertently > suffers any disruption to services, loss of information, harm or is > infected with a virus, other malicious computer programme or code that may > occur as a consequence of receiving this email. > > Unless stated otherwise, this email represents only the views of the > sender and not the views of the Queensland Government. > > > ********************************************************************************** > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > |
From: Ian V. <Ian...@he...> - 2015-12-16 23:50:10
|
In HL7 v2.5 the MSH-9 segment is a datatype with 3 fields. HAPI supports this, so it gives you getters and setters for all the components in the datatype. To set up what you want you can do the following: mshSegment.getMsh9_MessageType().getMessageCode().getMsg1_MessageCode().setValue("ORR"); mshSegment.getMsh9_MessageType().getMessageCode().getMsg2_TriggerEvent().setValue("O02"); HAPI also knows all about escaping, and does it's level best to make your life easy. If you want to get data escaped in a field, just use the setValue method with your string in java. So to build an ACK with the MSA-3 containing escaped ~ characters you can do the following: ACK myAck = new ACK(); myAck.initQuickstart("ACK", "", "P"); myAck.getMSA().getMsa1_AcknowledgmentCode().setValue("PD"); myAck.getMSA().getMsa2_MessageControlID().setValue("879-0999-1"); myAck.getMSA().getMsa3_TextMessage().setValue("Text1~Text2~Text3"); System.out.println(myAck.getMSA().encode()); The output of which is: MSA|PD|879-0999-1|Text1\R\Text2\R\Text3 Which is what you have asked for. HAPI does the escaping when you encode your result ready for sending. When you receive a message with escaped delimiter characters and parse it with HAPI, a getValue method will un-escape the characters for you, and give you a java string result. HAPI really knows HL7, and does a lot to help you. We have had a lot of success using it for many years now. Hope this helps Ian Vowles Department of Health Queensland Australia From: Davies, Brian [mailto:Bri...@Mc...] Sent: Thursday, 17 December 2015 7:19 AM To: hl7...@li... Subject: [HAPI-devel] Escaping Encoded characters I want to be able to escaped the special encoding characters by using \S\ or \R\ but this doesn't seem to work for me. I also tried the code snippet below but it seems that using the quick start init method creates multiple repetitions of the message type, for example: ORR_O02 orr002=new ORR_O02(); MSH mshSegment = orr002.getMSH(); orr002.initQuickstart("ORR", "002", "P"); results in the message below with the message type repeated which is not what I want: MSH|^~\&|CDB||MCK||20010925202704||ORR^002^ORR_O02|1301|P|2.5 Instead I only want MSH|^~\&|CDB||MCK||20010925202704||ORR^002 |1301|P|2.5 I tried setting the message code like so: mshSegment.getMsh9_MessageType().getMessageCode().setValue("ORR\\S\\002"); but this produces MSH - MSH|^~\&|CDB||MCK||20010925202704||ORR\E\S\E\002|||2.5 It's not clear how to accomplish escaping encoding characters. How does one do that, since the above does not work? For example, I want to escaped the tilde in the message below, can this be done and how? I hoped \R\ would work but it didn't. MSA|PD|879-0999-1|Text1~Text2~Text3 ******************************************************************************** This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error. Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters. If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175 or by return email. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced. If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited. Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email. Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government. ********************************************************************************** |
From: Davies, B. <Bri...@Mc...> - 2015-12-16 21:19:21
|
I want to be able to escaped the special encoding characters by using \S\ or \R\ but this doesn't seem to work for me. I also tried the code snippet below but it seems that using the quick start init method creates multiple repetitions of the message type, for example: ORR_O02 orr002=new ORR_O02(); MSH mshSegment = orr002.getMSH(); orr002.initQuickstart("ORR", "002", "P"); results in the message below with the message type repeated which is not what I want: MSH|^~\&|CDB||MCK||20010925202704||ORR^002^ORR_O02|1301|P|2.5 Instead I only want MSH|^~\&|CDB||MCK||20010925202704||ORR^002 |1301|P|2.5 I tried setting the message code like so: mshSegment.getMsh9_MessageType().getMessageCode().setValue("ORR\\S\\002"); but this produces MSH - MSH|^~\&|CDB||MCK||20010925202704||ORR\E\S\E\002|||2.5 It's not clear how to accomplish escaping encoding characters. How does one do that, since the above does not work? For example, I want to escaped the tilde in the message below, can this be done and how? I hoped \R\ would work but it didn't. MSA|PD|879-0999-1|Text1~Text2~Text3 |
From: Marc D. <mar...@gm...> - 2015-12-15 14:27:29
|
Hello - I have been unable to get any logging from HAPI when HAPI is running inside an OSGI framework (Karaf 3.0.5). I added this line in etc/org.ops4j.pax.logging.cfg: log4j.logger.ca.uhn.hl7v2.app=DEBUG but I still do not get any logging. Is there something else I need to do? I noticed in one of the HAPI pom.xml files that PAX logging should be supported, so I am wondering what I am missing... Thanks! Marc |
From: Ian V. <Ian...@he...> - 2015-12-07 21:19:53
|
Thanks for your reply James. I ran the test you provided, and it passed as you expected. Couple of things. The OBX-5 provided in the example has 9 repeats. You only had code to test 8. If you add the line: assertEquals("", obx.getOBX().getObx5_ObservationValue()[8].encode()); Then the test fails. Alternatively the assertions could be reduced to: assertEquals("Count of OBX-5 repeat is 9", 9, obx.getOBX().getObx5_ObservationValueReps()); Which also fails. To check if this might be something particular to OBX-5 entries, given their variable nature I extended the test to include a check on another repeating field by adding 3 repeat characters to the end of the PID-3 list (making 4 repeats) + "PID|1||10011682^^^CL_MRN Pool^^CD:237968946~~~|60683166^^^DONOTSEND^^CD:237968946|CLABTEST^ONE||19500101120000|F||C|34605 W 12 MILE RD^^FARM MILLS^MN^48331-3263^CD:309221^CD:756^^CD:637908|CD:637908|(248)489-6000^CD:170||CD:151|M|CD:3391461|606831661088^^^DONOTSEND^FIN NBR^CD:237968946||||CD:654655774|||0|||CD:654897458\r" and added another assertion: assertEquals("Count of PID-3 repeat is 4", 4, ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getPATIENT().getPID().getPid3_PatientIdentifierListReps()); This also fails. Any thoughts on what is going on? Thanks Ian From: James Agnew [mailto:jam...@gm...] Sent: Monday, 7 December 2015 11:13 PM To: Ian Vowles Cc: hl7...@li... Subject: Re: [HAPI-devel] Parser dropping 1 empty repeat on an OBX-5 each time you parse Hi Ian, I turned this into a unit test, and it seems to give me the expected results: String msg = "MSH|^~\\&|HNAM|CL|CL_RADNET|CL|20110628095233||ORU^R01|Q2301030099T1904270849|P|2.4\r" + "PID|1||10011682^^^CL_MRN Pool^^CD:237968946|60683166^^^DONOTSEND^^CD:237968946|CLABTEST^ONE||19500101120000|F||C|34605 W 12 MILE RD^^FARM MILLS^MN^48331-3263^CD:309221^CD:756^^CD:637908|CD:637908|(248)489-6000^CD:170||CD:151|M|CD:3391461|606831661088^^^DONOTSEND^FIN NBR^CD:237968946||||CD:654655774|||0|||CD:654897458\r" + "PV1|1|Inpatient|MS^0414^1^CL^^^MMCCN|3|||5332^Rahiman^Abdul|||MED|MS|||1|||5332^Rahiman^Doctor|A||60|||||||||||||||||||CL||Active|||20110329113000\r" + "ORC|NW|3415770735^HNAM_ORDERID|||RL||||20110628095142|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676|||||20110628095231|||CD:2562^Written|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676\r" + "OBR|1|3415770735^HNAM_ORDERID||CL987^MRA Head w and w/o Contrast|||||||||||Rad Type&Rad Type|||||00000MR20110001703^HNA_ACCN~8546871^HNA_ACCNID~7515376^HNA_PACSID|CD:232990825|20110628095231||Magnetic Resonance Imaging|||1^^0^20110628095100^^RT||||^Dizziness\r" + "OBX|1|TX|20725^ROUTINE HEMATOLOGY|H7800-4|This~Is~A~Report~~~~~||||||I|||200704021122\r" + "NTE|1|P|Special Instructions-\r"; Parser p = new GenericParser(); Message hapiMsg; // The parse method performs the actual parsing hapiMsg = p.parse(msg); ORU_R01_OBSERVATION obx = ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0); assertEquals("This", obx.getOBX().getObx5_ObservationValue()[0].encode()); assertEquals("Is", obx.getOBX().getObx5_ObservationValue()[1].encode()); assertEquals("A", obx.getOBX().getObx5_ObservationValue()[2].encode()); assertEquals("Report", obx.getOBX().getObx5_ObservationValue()[3].encode()); assertEquals("", obx.getOBX().getObx5_ObservationValue()[4].encode()); assertEquals("", obx.getOBX().getObx5_ObservationValue()[5].encode()); assertEquals("", obx.getOBX().getObx5_ObservationValue()[6].encode()); assertEquals("", obx.getOBX().getObx5_ObservationValue()[7].encode()); Cheers, James On Mon, Nov 30, 2015 at 10:59 PM, Ian Vowles <Ian...@he...<mailto:Ian...@he...>> wrote: We have been having some trouble with textual OBX-5’s which have repeats used to indicate each line of a report when some empty repeats exist to denote empty lines for formatting. Is there a way to overcome this? The following example demonstrates the problem Thanks Ian package hapiexamples; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.app.ApplicationException; import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.model.v24.message.ORU_R01; import ca.uhn.hl7v2.parser.GenericParser; import ca.uhn.hl7v2.parser.Parser; import java.io.IOException; /** * * @author VowlesI */ public class OruR01RepeatsInObx5 { public static void main(String[] args) throws HL7Exception, ApplicationException, IOException { String msg = "MSH|^~\\&|HNAM|CL|CL_RADNET|CL|20110628095233||ORU^R01|Q2301030099T1904270849|P|2.4\r" + "PID|1||10011682^^^CL_MRN Pool^^CD:237968946|60683166^^^DONOTSEND^^CD:237968946|CLABTEST^ONE||19500101120000|F||C|34605 W 12 MILE RD^^FARM MILLS^MN^48331-3263^CD:309221^CD:756^^CD:637908|CD:637908|(248)489-6000^CD:170||CD:151|M|CD:3391461|606831661088^^^DONOTSEND^FIN NBR^CD:237968946||||CD:654655774|||0|||CD:654897458\r" + "PV1|1|Inpatient|MS^0414^1^CL^^^MMCCN|3|||5332^Rahiman^Abdul|||MED|MS|||1|||5332^Rahiman^Doctor|A||60|||||||||||||||||||CL||Active|||20110329113000\r" + "ORC|NW|3415770735^HNAM_ORDERID|||RL||||20110628095142|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676|||||20110628095231|||CD:2562^Written|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676\r" + "OBR|1|3415770735^HNAM_ORDERID||CL987^MRA Head w and w/o Contrast|||||||||||Rad Type&Rad Type|||||00000MR20110001703^HNA_ACCN~8546871^HNA_ACCNID~7515376^HNA_PACSID|CD:232990825|20110628095231||Magnetic Resonance Imaging|||1^^0^20110628095100^^RT||||^Dizziness\r" + "OBX|1|TX|20725^ROUTINE HEMATOLOGY|H7800-4|This~Is~A~Report~~~~~||||||I|||200704021122\r" + "NTE|1|P|Special Instructions-\r"; Parser p = new GenericParser(); Message hapiMsg; // The parse method performs the actual parsing hapiMsg = p.parse(msg); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); } } ******************************************************************************** This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error. Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters. If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175<tel:%2B61%201800%20198%20175> or by return email. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced. If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited. Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email. Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government. ********************************************************************************** ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 _______________________________________________ Hl7api-devel mailing list Hl7...@li...<mailto:Hl7...@li...> https://lists.sourceforge.net/lists/listinfo/hl7api-devel |
From: James A. <jam...@gm...> - 2015-12-07 13:13:28
|
Hi Ian, I turned this into a unit test, and it seems to give me the expected results: String msg = "MSH|^~\\&|HNAM|CL|CL_RADNET|CL|20110628095233||ORU^R01|Q2301030099T1904270849|P|2.4\r" + "PID|1||10011682^^^CL_MRN Pool^^CD:237968946|60683166^^^DONOTSEND^^CD:237968946|CLABTEST^ONE||19500101120000|F||C|34605 W 12 MILE RD^^FARM MILLS^MN^48331-3263^CD:309221^CD:756^^CD:637908|CD:637908|(248)489-6000^CD:170||CD:151|M|CD:3391461|606831661088^^^DONOTSEND^FIN NBR^CD:237968946||||CD:654655774|||0|||CD:654897458\r" + "PV1|1|Inpatient|MS^0414^1^CL^^^MMCCN|3|||5332^Rahiman^Abdul|||MED|MS|||1|||5332^Rahiman^Doctor|A||60|||||||||||||||||||CL||Active|||20110329113000\r" + "ORC|NW|3415770735^HNAM_ORDERID|||RL||||20110628095142|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676|||||20110628095231|||CD:2562^Written|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676\r" + "OBR|1|3415770735^HNAM_ORDERID||CL987^MRA Head w and w/o Contrast|||||||||||Rad Type&Rad Type|||||00000MR20110001703^HNA_ACCN~8546871^HNA_ACCNID~7515376^HNA_PACSID|CD:232990825|20110628095231||Magnetic Resonance Imaging|||1^^0^20110628095100^^RT||||^Dizziness\r" + "OBX|1|TX|20725^ROUTINE HEMATOLOGY|H7800-4|This~Is~A~Report~~~~~||||||I|||200704021122\r" + "NTE|1|P|Special Instructions-\r"; Parser p = new GenericParser(); Message hapiMsg; // The parse method performs the actual parsing hapiMsg = p.parse(msg); ORU_R01_OBSERVATION obx = ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0); assertEquals("This", obx.getOBX().getObx5_ObservationValue()[0].encode()); assertEquals("Is", obx.getOBX().getObx5_ObservationValue()[1].encode()); assertEquals("A", obx.getOBX().getObx5_ObservationValue()[2].encode()); assertEquals("Report", obx.getOBX().getObx5_ObservationValue()[3].encode()); assertEquals("", obx.getOBX().getObx5_ObservationValue()[4].encode()); assertEquals("", obx.getOBX().getObx5_ObservationValue()[5].encode()); assertEquals("", obx.getOBX().getObx5_ObservationValue()[6].encode()); assertEquals("", obx.getOBX().getObx5_ObservationValue()[7].encode()); Cheers, James On Mon, Nov 30, 2015 at 10:59 PM, Ian Vowles <Ian...@he...> wrote: > We have been having some trouble with textual OBX-5’s which have repeats > used to indicate each line of a report when some empty repeats exist to > denote empty lines for formatting. > > Is there a way to overcome this? > > The following example demonstrates the problem > > > > Thanks > > Ian > > > > package hapiexamples; > > > > import ca.uhn.hl7v2.HL7Exception; > > import ca.uhn.hl7v2.app.ApplicationException; > > import ca.uhn.hl7v2.model.Message; > > import ca.uhn.hl7v2.model.v24.message.ORU_R01; > > import ca.uhn.hl7v2.parser.GenericParser; > > import ca.uhn.hl7v2.parser.Parser; > > import java.io.IOException; > > > > /** > > * > > * @author VowlesI > > */ > > public class OruR01RepeatsInObx5 { > > > > public static void main(String[] args) throws HL7Exception, > ApplicationException, IOException { > > String msg = > "MSH|^~\\&|HNAM|CL|CL_RADNET|CL|20110628095233||ORU^R01|Q2301030099T1904270849|P|2.4\r" > > + "PID|1||10011682^^^CL_MRN > Pool^^CD:237968946|60683166^^^DONOTSEND^^CD:237968946|CLABTEST^ONE||19500101120000|F||C|34605 > W 12 MILE RD^^FARM > MILLS^MN^48331-3263^CD:309221^CD:756^^CD:637908|CD:637908|(248)489-6000^CD:170||CD:151|M|CD:3391461|606831661088^^^DONOTSEND^FIN > NBR^CD:237968946||||CD:654655774|||0|||CD:654897458\r" > > + > "PV1|1|Inpatient|MS^0414^1^CL^^^MMCCN|3|||5332^Rahiman^Abdul|||MED|MS|||1|||5332^Rahiman^Doctor|A||60|||||||||||||||||||CL||Active|||20110329113000\r" > > + > "ORC|NW|3415770735^HNAM_ORDERID|||RL||||20110628095142|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY > DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary > Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External > Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676|||||20110628095231|||CD:2562^Written|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY > DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary > Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External > Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676\r" > > + "OBR|1|3415770735^HNAM_ORDERID||CL987^MRA Head w and w/o > Contrast|||||||||||Rad Type&Rad > Type|||||00000MR20110001703^HNA_ACCN~8546871^HNA_ACCNID~7515376^HNA_PACSID|CD:232990825|20110628095231||Magnetic > Resonance Imaging|||1^^0^20110628095100^^RT||||^Dizziness\r" > > + "OBX|1|TX|20725^ROUTINE > HEMATOLOGY|H7800-4|This~Is~A~Report~~~~~||||||I|||200704021122\r" > > + "NTE|1|P|Special Instructions-\r"; > > > > Parser p = new GenericParser(); > > > > Message hapiMsg; > > // The parse method performs the actual parsing > > hapiMsg = p.parse(msg); > > System.out.println("OBX-5 has " + ((ORU_R01) > hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); > > hapiMsg.parse(hapiMsg.encode()); > > System.out.println("OBX-5 has " + ((ORU_R01) > hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); > > hapiMsg.parse(hapiMsg.encode()); > > System.out.println("OBX-5 has " + ((ORU_R01) > hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); > > hapiMsg.parse(hapiMsg.encode()); > > System.out.println("OBX-5 has " + ((ORU_R01) > hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); > > hapiMsg.parse(hapiMsg.encode()); > > System.out.println("OBX-5 has " + ((ORU_R01) > hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); > > hapiMsg.parse(hapiMsg.encode()); > > System.out.println("OBX-5 has " + ((ORU_R01) > hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); > > hapiMsg.parse(hapiMsg.encode()); > > System.out.println("OBX-5 has " + ((ORU_R01) > hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); > > } > > } > > > ******************************************************************************** > > This email, including any attachments sent with it, is confidential and > for the sole use of the intended recipient(s). This confidentiality is not > waived or lost, if you receive it and you are not the intended > recipient(s), or if it is transmitted/received in error. > > Any unauthorised use, alteration, disclosure, distribution or review of > this email is strictly prohibited. The information contained in this email, > including any attachment sent with it, may be subject to a statutory duty > of confidentiality if it relates to health service matters. > > If you are not the intended recipient(s), or if you have received this > email in error, you are asked to immediately notify the sender by telephone > collect on Australia +61 1800 198 175 or by return email. You should also > delete this email, and any copies, from your computer system network and > destroy any hard copies produced. > > If not an intended recipient of this email, you must not copy, distribute > or take any action(s) that relies on it; any form of disclosure, > modification, distribution and/or publication of this email is also > prohibited. > > Although Queensland Health takes all reasonable steps to ensure this email > does not contain malicious software, Queensland Health does not accept > responsibility for the consequences if any person's computer inadvertently > suffers any disruption to services, loss of information, harm or is > infected with a virus, other malicious computer programme or code that may > occur as a consequence of receiving this email. > > Unless stated otherwise, this email represents only the views of the > sender and not the views of the Queensland Government. > > > ********************************************************************************** > > > ------------------------------------------------------------------------------ > Go from Idea to Many App Stores Faster with Intel(R) XDK > Give your users amazing mobile app experiences with Intel(R) XDK. > Use one codebase in this all-in-one HTML5 development environment. > Design, debug & build mobile apps & 2D/3D high-impact games for multiple > OSs. > http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > |
From: Ian V. <Ian...@he...> - 2015-12-01 04:15:11
|
We have been having some trouble with textual OBX-5's which have repeats used to indicate each line of a report when some empty repeats exist to denote empty lines for formatting. Is there a way to overcome this? The following example demonstrates the problem Thanks Ian package hapiexamples; import ca.uhn.hl7v2.HL7Exception; import ca.uhn.hl7v2.app.ApplicationException; import ca.uhn.hl7v2.model.Message; import ca.uhn.hl7v2.model.v24.message.ORU_R01; import ca.uhn.hl7v2.parser.GenericParser; import ca.uhn.hl7v2.parser.Parser; import java.io.IOException; /** * * @author VowlesI */ public class OruR01RepeatsInObx5 { public static void main(String[] args) throws HL7Exception, ApplicationException, IOException { String msg = "MSH|^~\\&|HNAM|CL|CL_RADNET|CL|20110628095233||ORU^R01|Q2301030099T1904270849|P|2.4\r" + "PID|1||10011682^^^CL_MRN Pool^^CD:237968946|60683166^^^DONOTSEND^^CD:237968946|CLABTEST^ONE||19500101120000|F||C|34605 W 12 MILE RD^^FARM MILLS^MN^48331-3263^CD:309221^CD:756^^CD:637908|CD:637908|(248)489-6000^CD:170||CD:151|M|CD:3391461|606831661088^^^DONOTSEND^FIN NBR^CD:237968946||||CD:654655774|||0|||CD:654897458\r" + "PV1|1|Inpatient|MS^0414^1^CL^^^MMCCN|3|||5332^Rahiman^Abdul|||MED|MS|||1|||5332^Rahiman^Doctor|A||60|||||||||||||||||||CL||Active|||20110329113000\r" + "ORC|NW|3415770735^HNAM_ORDERID|||RL||||20110628095142|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676|||||20110628095231|||CD:2562^Written|71573^Doctor^Janet^D^^^^^DONOTSEND^^^^COMMUNITY DR NBR~70988^Doctor^Janet^D^^^^^DONOTSEND^^^^Personnel Primary Identifier~FHJDB2293^Doctor^Janet^D^^^^^DONOTSEND^^^^External Identifier~T^Doctor^Janet^D^^^^^DONOTSEND^^^^CD:296695676\r" + "OBR|1|3415770735^HNAM_ORDERID||CL987^MRA Head w and w/o Contrast|||||||||||Rad Type&Rad Type|||||00000MR20110001703^HNA_ACCN~8546871^HNA_ACCNID~7515376^HNA_PACSID|CD:232990825|20110628095231||Magnetic Resonance Imaging|||1^^0^20110628095100^^RT||||^Dizziness\r" + "OBX|1|TX|20725^ROUTINE HEMATOLOGY|H7800-4|This~Is~A~Report~~~~~||||||I|||200704021122\r" + "NTE|1|P|Special Instructions-\r"; Parser p = new GenericParser(); Message hapiMsg; // The parse method performs the actual parsing hapiMsg = p.parse(msg); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); hapiMsg.parse(hapiMsg.encode()); System.out.println("OBX-5 has " + ((ORU_R01) hapiMsg).getPATIENT_RESULT(0).getORDER_OBSERVATION(0).getOBSERVATION(0).getOBX().getObx5_ObservationValueReps()); } } ******************************************************************************** This email, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost, if you receive it and you are not the intended recipient(s), or if it is transmitted/received in error. Any unauthorised use, alteration, disclosure, distribution or review of this email is strictly prohibited. The information contained in this email, including any attachment sent with it, may be subject to a statutory duty of confidentiality if it relates to health service matters. If you are not the intended recipient(s), or if you have received this email in error, you are asked to immediately notify the sender by telephone collect on Australia +61 1800 198 175 or by return email. You should also delete this email, and any copies, from your computer system network and destroy any hard copies produced. If not an intended recipient of this email, you must not copy, distribute or take any action(s) that relies on it; any form of disclosure, modification, distribution and/or publication of this email is also prohibited. Although Queensland Health takes all reasonable steps to ensure this email does not contain malicious software, Queensland Health does not accept responsibility for the consequences if any person's computer inadvertently suffers any disruption to services, loss of information, harm or is infected with a virus, other malicious computer programme or code that may occur as a consequence of receiving this email. Unless stated otherwise, this email represents only the views of the sender and not the views of the Queensland Government. ********************************************************************************** |
From: Davies, B. <Bri...@Mc...> - 2015-11-16 20:48:48
|
From: Davies, Brian [mailto:Bri...@Mc...] Sent: Monday, November 16, 2015 2:00 PM To: hl7...@li... Subject: [HAPI-devel] Is there a way to use fields which do not follow a linear sequence? I have a structure which follows the order in a segment MSH ZDD Field Sequence Marital Status 1 Age 3 DOB 4 In the example above there is no field in sequence 2. The field can exist but it is only conditional. I tried overriding the numFields(), getNames(), getTypedField() and even placed a field in sequence position 2, but the values of the fields are out of sync i.e. DOB =Value of Age field etc. |
From: Davies, B. <Bri...@Mc...> - 2015-11-16 20:00:33
|
I have a structure which follows the order in a segment MSH ZDD Field Sequence Marital Status 1 Age 3 DOB 4 In the example above there is no field in sequence 2. The field can exist but it is only conditional. I tried overriding the numFields(), getNames(), getTypedField() and even placed a field in sequence position 2, but the values of the fields are out of sync i.e. DOB =Value of Age field etc. |
From: Davies, B. <Bri...@Mc...> - 2015-11-16 14:28:38
|
Thanks a lot Christian, really appreciated. From: Christian Ohr [mailto:chr...@gm...] Sent: Monday, November 16, 2015 8:23 AM To: Davies, Brian Cc: hl7...@li... Subject: Re: [HAPI-devel] ClassCastException when casting down In your case, nothing tells HAPI to instantiate a "PFM" message when it comes across a message with MFN^M01 in the MSH-9 field. This is the task of the so-called event map. It's a file located in the ca.uhn.hl7v2.parser.eventmap package and called <version>.properties (i.e. in your case "2.5.properties"). The file contains two columns: col 1 specifies the message structure and col 2 specifies the custom class that implements this structure. If there is no match, it falls back to the standard event map, instantiating a instance of ca.uhn.hl7v2.model.v25.message.MFN_M01, which gives you the ClassCastException. Check the existing HAPI structure libraries for these eventmap files. So you have two choices * rename the class com.msh.bgapp.hl7.custommodel.v25.message.PFM class to MFN_M01. You don't need an custom eventmap then. * add an event map file to your project that explicitly maps MFN_M01 to PFM I usually choose option 1 as it keeps the naming convention and also indicates in the class name what is replaced. Also note that you do not necessarily have to extend from the original message structure class. cheers Christian 2015-10-26 20:08 GMT+01:00 Davies, Brian <Bri...@mc...<mailto:Bri...@mc...>>: Related to the previous issue, I get an exception when casting down to my object which extends the MFN_M01 message. I am extending MFN_M01 because this is specified in the message type field, so I’m unable to avoid it. I am using the v25 libraries and JDK1.7 Exception in thread "main" java.lang.ClassCastException: ca.uhn.hl7v2.model.v25.message.MFN_M01 cannot be cast to com.msh.bgapp.hl7.custommodel.v25.message.PFM at com.msh.bgapp.hl7.custommodel.v25.message.PFM.main(PFM.java:106) String HDR="MSH|^~\\&|DSF||Vendor||20150926151426||MFN^M01|610-100672|P|2.5\r" public class PFM extends MFN_M01 { private static final long serialVersionUID = -6182782287494872212L; public PFM(ModelClassFactory theFactory) { super(theFactory); init(theFactory); } private void init(ModelClassFactory factory) { try { this.add(MSH.class, true, false); this.add(MFI.class, false, false); this.add(MFE.class, false, false); } catch(HL7Exception e) { log.error("Unexpected error creating PFM ,e); } } public MSH getMSH() { return getTyped("MSH", MSH.class); } public ZRQ getZRQ() { return (ZRQ)getTyped("ZRQ", ZRQ.class); } public String getVersion() { return "2.5"; } public static void main(String[] args) throws DataTypeException, HL7Exception, IOException { String HDR="MSH|^~\\&|DSF||Vendor||20150926151426||MFN^M01|610-100672|P|2.5\r" +"MFI|ZBM||UPD|20150917172522|20150917172522|AL\r" +"MFE|MAD|610-100672|20150917172522|610-100672|CE\r" ModelClassFactory cmf = new CustomModelClassFactory("com.msh.bgapp.hl7.custommodel"); @SuppressWarnings("resource") HapiContext context=new DefaultHapiContext(cmf); Parser parser = context.getPipeParser(); PFM o=(PFM)parser.parse(HDR); } } ------------------------------------------------------------------------------ _______________________________________________ Hl7api-devel mailing list Hl7...@li...<mailto:Hl7...@li...> https://lists.sourceforge.net/lists/listinfo/hl7api-devel |
From: Christian O. <chr...@gm...> - 2015-11-16 14:25:51
|
I think my previous answer also applies to this question. Of course you can also define groups for custom structure classes. Christian 2015-10-27 15:27 GMT+01:00 Davies, Brian <Bri...@mc...>: > I am extending the MFN_M01 message as this is provided by a 3rd party to > an app that I am working on. I extended the MFN_M01 class for example: > > DCS,RXD and MTN extend AbstractGroup and in a package com.mypackage. > sbs.v25.group. However, none of DCS,RXD or MTN are loaded in the custom > model, even though the custom segments are loaded when encountered by the > parser. I adopted HAPI because I wanted to replace the home grown > implementation being used but unfortunately encountering numerous issues. > Casting the class to TFM also results in a class cast exception because > the message type/trigger, field 9 is MFN_M01. > > > > public class TFM extends MFN_M01 { > > public TFM(ModelClassFactory theFactory) { > > super(theFactory); > > init(theFactory); > > } > > private void init(ModelClassFactory factory) { > > try { > > this.add(DCS.class, > true, false); > > this.add(RXD.class, > true, true,false); > > this.add(MTN.class, > true, true,false); > > } catch(HL7Exception e) { > > log.error("Unexpected > error creating TFM", e); > > } > > } > > > > Best Regards. > > > > > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Hl7api-devel mailing list > Hl7...@li... > https://lists.sourceforge.net/lists/listinfo/hl7api-devel > > |