I am having trouble building some iterating OBX segments from a single OBX segment. I have a large clump of data for a report coming in on a single OBX5 and I need to take every break (coming in as .br ) and move that to it’s own iteration of OBX5.
Now I am decent with manipulating the iterations but I cannot find a way to look for the next .br since they will vary in length. How can I search for a a specific combination and grab what’s between the current one and the next one and create and OBX, and repeat.
Here is a small sample of what’s coming inbound:
1(0).1(0).1(0).OBX(0).#5(0).[0] :>Service Location: Hospital Medicine.brDATE OF ADMISSION: 04/05/2013. .br\.brDATE OF DISCHARGE: 04/09/2013..br\.brADMISSION DIAGNOSIS:.br1. Intrauterine pregnancy, postdates..br\.brDISCHARGE DIAGNOSES:.br
I need it to look like:
2(0).OBX(0).#1(0).[0] : >1< 2(0).OBX(0).#2(0).[0] : >TX< 2(0).OBX(0).#5(0).[0] : >DATE OF ADMISSION: 04/05/2013. < 2(0).OBX(0).#11(0).[0] : >P< 2(0).OBX(1).#1(0).[0] : >2< 2(0).OBX(1).#2(0).[0] : >TX< 2(0).OBX(1).#11(0).[0] : >P< 2(0).OBX(2).#1(0).[0] : >3< 2(0).OBX(2).#2(0).[0] : >TX< 2(0).OBX(2).#5(0).[0] : >DATE OF DISCHARGE: 04/09/2013.< 2(0).OBX(2).#11(0).[0] : >P< 2(0).OBX(3).#1(0).[0] : >4< 2(0).OBX(3).#2(0).[0] : >TX< 2(0).OBX(3).#11(0).[0] : >P< 2(0).OBX(4).#1(0).[0] : >5< 2(0).OBX(4).#2(0).[0] : >TX< 2(0).OBX(4).#5(0).[0] : >ADMISSION DIAGNOSIS:< 2(0).OBX(4).#11(0).[0] : >P< 2(0).OBX(5).#1(0).[0] : >6< 2(0).OBX(5).#2(0).[0] : >TX< 2(0).OBX(5).#5(0).[0] : >1. Intrauterine pregnancy, postdates.< 2(0).OBX(5).#11(0).[0] : >P< 2(0).OBX(6).#1(0).[0] : >7< 2(0).OBX(6).#2(0).[0] : >TX< Thank you in advance, Jon