Click here to Skip to main content
13,446,115 members (38,536 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I want to convert this HL7 message to xml.I am using Hapi.
But it does not work if HL7 message starts from "FHS header".
Also I am getting an error for

Failed validation rule for value "756666": Matches the regular expression (\d{1,2} )?(\(\d{3}\))?\d{3}-\d{4}(X\d{1,5})?(B\d{1,5})?(C.*)?: Segment: PID Field #13

FHS|^~\&|Medical-Objects|Test Message capricorn
BHS|^~\&|Medical-Objects|Test Message capricorn
MSH|^~\&|EQUATORDXTRAY^EQUATORDXTRAY:2.20.2 (Build 4111) [win32-i386] {SVV=62;DBV=62}^L|Test Message capricorn^22B601DF-1415-4ACB-BE13-D7E9C9CCAC41^GUID|AUSHICPR.UP3123000QW^UP3123000QW.PAPERACT SOLUTIONS.UHG^L|PaperAct Solutions On Behalf of Unified Health Group Test^1D618FDB-DB0A-44DC-8B03-8A4C981BD038^GUID|20121121142346+1000|Test Message Capricorn (Equator) <MO882115.>|ORU^R01|TMSCP7427894|P|2.3.1^AUS&&ISO^AS4700.2&&L|||AL||AUS
PID|1||129833^^^Medical-Objects&7C3E3682-91F6-11D2-8F2C-444553540000&GUID^SR^Test Message capricorn&22B601DF-1415-4ACB-BE13-D7E9C9CCAC41&GUID~129833^^^Medical-Objects&7C3E3682-91F6-11D2-8F2C-444553540000&GUID^FI^Test Message capricorn&22B601DF-1415-4ACB-BE13-D7E9C9CCAC41&GUID~408091^^^Medical-Objects&7C3E3682-91F6-11D2-8F2C-444553540000&GUID^FI^Think Positive Psychology Services&53604C05-48FA-4CF0-B398-58790CF638FA&GUID~100338^^^Medical-Objects&7C3E3682-91F6-11D2-8F2C-444553540000&GUID^FI^Toronto Private Hospital&A6E05941-72EE-4D2C-9BAF-17D9D9C9207E&GUID||PATIENT^Test^^^^^L||20010101|M|||||61(07)54506495^PRN^PH^^61^07^54506495|||||||||||||||||N
PV1|1|O||||||UP3123000QW^PAPERACT SOLUTIONS^UHG^^^MR^^^Medical-Objects&7C3E3682-91F6-11D2-8F2C-444553540000&GUID^L^^^UPIN|UP3123000QW^PAPERACT SOLUTIONS^UHG^^^MR^^^Medical-Objects&7C3E3682-91F6-11D2-8F2C-444553540000&GUID^L^^^UPIN|||||||N
ORC|RE||F1705DC3-B14F-4B2D-A0BA-5707D0690CCB^Test Message capricorn^22B601DF-1415-4ACB-BE13-D7E9C9CCAC41^GUID||CM|||||||UP3123000QW^PAPERACT SOLUTIONS^UHG^^^MR^^^Medical-Objects&7C3E3682-91F6-11D2-8F2C-444553540000&GUID^L^^^UPIN
OBR|1||F1705DC3-B14F-4B2D-A0BA-5707D0690CCB^Test Message capricorn^22B601DF-1415-4ACB-BE13-D7E9C9CCAC41^GUID|11488-4^Consultation Note (E BROWN (MOTEST))^LN||20121121+1000|20121121+1000|||||||||UP3123000QW^PAPERACT SOLUTIONS^UHG^^^MR^^^Medical-Objects&7C3E3682-91F6-11D2-8F2C-444553540000&GUID^L^^^UPIN||From Test Message capricorn"XX11211408459-9711.oru" 21.11.2012||LN=F1705DC3-B14F-4B2D-A0BA-5707D0690CCB||20121121140814+1000||PHY|F||^^^20121121+1000|UP3123000QW^PAPERACT SOLUTIONS^UHG^^^MR^^^Medical-Objects&7C3E3682-91F6-11D2-8F2C-444553540000&GUID^L^^^UPIN||||EB4558000PX&BROWN (MOTEST)&ELI&&&Mr.&&&Medical-Objects
OBX|1|FT|11488-4^^LN||Hi there,\.br\ \.br\This is a test message from Medical-Objects to see if your connection is working for delivery of results.\.br\\.br\You may delete this message after 2 days.\.br\\.br\Kind Regards,\.br\\.br\Eli Brown\.br\Medical-Objects\.br\Ph (07) 5456 6000\.br\||||||F
FTS|1|Powered by

[torsten]additional question[/torsten]

I want to fetch the PID segment and show all the details of patient .
Posted 28-Dec-12 20:48pm
Updated 29-Dec-12 20:47pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Failed validation rule for value "756666"

Am I missing something? there is no "756666" in there...

Documentaion on XML-Parsing[^]

Did you follow this? seems to be pretty simple. is there a way to modify the used regex[^]?
foreverlove87 29-Dec-12 5:34am
The link you provided ,I have followed the same.
But it does not work with
FHS|^~\&|Medical-Objects|Test Message capricorn
BHS|^~\&|Medical-Objects|Test Message capricorn

Xml conversion does not show the first two segments
TorstenH. 29-Dec-12 5:45am
Ah, the first 2 lines are not valid to the parser? How did you find out?
Or is it just because the parser fails at the message, which incidentally has those 2 lines in front?

Just to make sure one is not chasing false targets.

The API is open - could be worth a look.

Get involved and extend the API

There is also a bug tracking available - so have a look there.
I have figured in the past that I'm never the first person to find the problem - often a solution is available in such lists.
TorstenH. 29-Dec-12 5:48am
me again - is it possible that you have to rip of the first two lines?
I can't find those File Header and Batch Header lines in any of the examples. Strange...

Edit: Yepp, seems to be an old problem:
support for FHS, FTS segments in HL7 Encoder for batching @ (mailing list archive)

That message is from 2009 - so it's not a new problem.

PLease refer to the author of the API and ask for the Parsing of those Headers. And please let us know what they told you.
TorstenH. 29-Dec-12 5:57am
Also - here: <a href=""<Documentation about HL7 from 05-2010 nothing is written about those header segments.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

ok leave it
Can you help me in retrieving patient details .

Patient name and his address
TorstenH. 30-Dec-12 2:52am
Have you managed to parse a XML from the HL7 ?


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04-2016 | 2.8.180314.2 | Last Updated 30 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100