Stream: implementers
Topic: HL7 message custom validator
Sheetal BhatewaraJain (Apr 03 2020 at 11:03):
I need to write a custom validator for HL7 message
Input:
MSH|^~\&|Sample.GateWay||||202002061359||ORU^R01|5678|D|2.3
PID|1|CPHC0040||789987|Deshmukh^Darshana||20100717|F||
ORC|NW|||||||||||||||||||
OBR|||||||202003051359|||||||||||||||202003051359|||||
OBX||NM|81894-8^CAP||175|dB/m|100-260|||N|F|||202004041359|BN
OBX||NM|77615-3^E|||kPa||||||||202004041359|BN
Validator to check some fields are not empty like,
public class MsgHL7ValidationBuilder extends ValidationRuleBuilder {
private final Logger log = LoggerFactory.getLogger(MsgHL7ValidationBuilder .class); @Override protected void configure() { log.info("Entering MsgHL7ValidationBuilder ..."); super.configure(); forVersion(Version.V23) .message("*", "*") .terser("MSH-10", not(empty())) .terser("/.OBX-2", not(empty())) .terser("/.OBX-3", not(empty())) .terser("/.OBX-5", not(empty())) .terser("/.OBX-11", not(empty())) .terser("/.OBX-14", not(empty())); log.info("Exiting MsgHL7ValidationBuilder ..."); }
}
Now, in this case validator works fine for the first OBX segment, but it dows not work for second or further OBX's.
I need to handle this if there are 'n' number of OBX's.
Any help would be really appreciated.
Thanks,
Sheetal
Grahame Grieve (Apr 03 2020 at 11:15):
you ask this in #V2
Sheetal BhatewaraJain (Apr 03 2020 at 11:58):
Thanks Grahame :)
Last updated: Apr 12 2022 at 19:14 UTC