thechimota
Programmer
Hello everyone,
I am trying to write a smal application to parse a text file (HL7 format) and I am having major trouble. The input file looks sort of like:
MSH|^~\&|LIS|RC|HIS||20070405233331||ORU^R01|20021353108535|
PID|||123456||test^patient^||19840515|F||||||||||1234567|
PV1||O|LB^|
ORC|RE|
OBR||8971795|H8632^LIS|MPB^METABOLIC PANEL
OBX|1|NM|XNA^SODIUM|1.1|140|mmol/L|||||F||
MSH|^~\&|LIS|RC|HIS||20070405233331||ORU^R01|20021353108535|
PID|||234567||test^patient2^||19840515|F||||||||||234567|
PV1||O|LB^|
ORC|RE|
OBR||8971795|H8632^LIS|MPB^METABOLIC PANEL
OBX|1|NM|XNA^SODIUM|2.1|140|mmol/L|||||F||
I am trying to parse the file to be read into a MS Access database for further manipulation.
The output needs to look like
123456,04/05/1984,F,LB,H8632,LIS,MPB,METABLOLIC PANEL,
123456,04/05/1984,F,NM,XNA,SODIUM,1.1,140,mmol/L,
234567,04/05/1984,F,LB,H8632,LIS,MPB,METABLOLIC PANEL,
234567,04/05/1984,F,NM,XNA,SODIUM,2.1,140,mmol/L,
This is a very small sample but it is just for the idea. There is one message header then detail several time thoughout the file. Any help on how to read in the file and parse would help. This is my second time writing a parse app for HL7 files but the first only had to parse one patient per file. I am just not sure how to define the code to do more.
Any info will help. Thanks
I am trying to write a smal application to parse a text file (HL7 format) and I am having major trouble. The input file looks sort of like:
MSH|^~\&|LIS|RC|HIS||20070405233331||ORU^R01|20021353108535|
PID|||123456||test^patient^||19840515|F||||||||||1234567|
PV1||O|LB^|
ORC|RE|
OBR||8971795|H8632^LIS|MPB^METABOLIC PANEL
OBX|1|NM|XNA^SODIUM|1.1|140|mmol/L|||||F||
MSH|^~\&|LIS|RC|HIS||20070405233331||ORU^R01|20021353108535|
PID|||234567||test^patient2^||19840515|F||||||||||234567|
PV1||O|LB^|
ORC|RE|
OBR||8971795|H8632^LIS|MPB^METABOLIC PANEL
OBX|1|NM|XNA^SODIUM|2.1|140|mmol/L|||||F||
I am trying to parse the file to be read into a MS Access database for further manipulation.
The output needs to look like
123456,04/05/1984,F,LB,H8632,LIS,MPB,METABLOLIC PANEL,
123456,04/05/1984,F,NM,XNA,SODIUM,1.1,140,mmol/L,
234567,04/05/1984,F,LB,H8632,LIS,MPB,METABLOLIC PANEL,
234567,04/05/1984,F,NM,XNA,SODIUM,2.1,140,mmol/L,
This is a very small sample but it is just for the idea. There is one message header then detail several time thoughout the file. Any help on how to read in the file and parse would help. This is my second time writing a parse app for HL7 files but the first only had to parse one patient per file. I am just not sure how to define the code to do more.
Any info will help. Thanks