Hello Team ,
I am currently working on a project where I am using HAPI HL7 to parse HL7v2.7 segments. I have added the following dependencies in my pom.xml :
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>7.4.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi</groupId>
<artifactId>hapi-structures-v27</artifactId>
<version>2.4</version>
</dependency>
This is the junit I used for testing
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.model.Message;
import ca.uhn.hl7v2.parser.PipeParser;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class PIDSegmentTest {
@Test
public void testHl7Parser() throws HL7Exception {
String hl7Message =
"MSH|^~\\&|HIS|RIH|EKG|EKG|202310190830||ORU^R01|MSG00001|P|2.7\n" +
"PID|||12345^^^Hospital^MR||Doe^John||19700101|M";
// Parse the HL7 message using HAPI HL7v2
PipeParser parser = new PipeParser();
Message message = parser.parse(hl7Message);
assertThat(message).isNotNull();
}
}
However, I am encountering the following exception when trying to parse a message:
The HL7 version 2.7PID is not recognized
ca.uhn.hl7v2.HL7Exception: The HL7 version 2.7PID is not recognized
at ca.uhn.hl7v2.parser.Parser.assertVersionExists(Parser.java:527)
at ca.uhn.hl7v2.parser.Parser.parse(Parser.java:208)
at ca.uhn.hl7v2.parser.PipeParser.parse(PipeParser.java:1028)
Upon checking the Parser.java file in hapi jar, I noticed that the supported versions listed are only up to 2.6. Could you please guide me on whether HAPI supports HL7v2.7 and, if so, which dependency I should use?
Thank you for your assistance.
Thanks,
Shreeja
--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/e541884e-1e10-4d27-88f9-3313ec0db10bn%40googlegroups.com.