Problem occurs in HL7 v2.3.1 message validation in accordance with Conformance Profile, where a message contains segments pertaining to a Segment Group, say : OBR, OBX, NTE etc. in ORU_R01, and PR1, PR2, IN1, IN2, IN3 in ADT messages.
The validation fails with following error:
ValidationException - PATIENT_RESULT not found in message ValidationException - The structure PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI appears in the message but not in the profile
:-> where PATIENT_RESULT is segment group name representing the segment group for PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI.
When as a workaround if "PATIENT_RESULT" is replaced with "PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI" as segment group name in conformance profile, then a new exception is thrown by Hapi as shown below :
ca.uhn.hl7v2.conf.ProfileException: Exception parsing message profile: ::::-1:-1:-1:cvc-pattern-valid: Value 'PIDPD1NK1NTEPV1PV2ORCOBRNTEOBXNTECTI' is not facet-valid with respect to pattern '([A-Z]|_)+' for type '#AnonType_NameSegGroupSegGroupOrSegmentGrouping'.
But the problem gets resolved when, change is made in regular expression '([A-Z]|)+' of message_profile.xml file at ca\uhn\hl7v2\conf\parser in hapi-base jar, to '([A-Z0-9]|)+'.