HapiTestPanel, ORU-R01 message

773 views Asked by At

I'm trying to create a HL7 message over IHE standard (ORU-R01 message type) using the HapiTestPanel and I've got an unexpected null word at the beginning of the OBX field, but I don't know where is the mistake..

Sending this message:

MSH|^~\&|LiFETouch17|LiFETouch17Facility|AnesthesiaApp|AnesthesiaAppFacility|20141112144500||ORU^R01^ORU_R01|Q123456789T123456789X123456|P|2.6|||||||||IHE PCD ORU-R01 PID|||123456789|012345678 9^AA^^JP|BROS^MARIO||19850101000000|M|||123 FAKE STREET^MARIO LUIGI BROS PLACE^TOADSTOOL KINGDOM^NES^A1B2C3^JP^HOME^^1234|1234 PV1||O|ABCD^EFGH||||123456^DINO^YOSHI^^^^^^MSRM^CURRENT^^^NEIGHBOURHOOD DR NBR|^DOG^DUCKH UNT^^^^^^^CURRENT|||||||||123456^DINO^YOSHI^^^^^^MSRM^CURRENT^^^NEIGHBOURHOOD DR NBR||0123456789|||||||||||||||||||||||||20010101000000 OBR|1|080019FFFF4F6AFE20081211144657^AwareGateway^080019FFFF4F6AC0^EUI-64|080019FFFF4F6AC020081211144657^AwareGateway^080019FFFF4F6AC0^EUI-64|126.169.95.2^2000^MDC|||20081211144500 OBX|1|NM|147842^MDC_ECG_HEART_RATE^MDC|1.1.1.1|60|264864^/min^UCUM|||||R OBX|2|NM|150324^MDC_SAT_O2_ART^MDC|1.2.1.1|98|262688^MDC_DIM_PERCENT^MDC|||||R OBX|3|NM|150021^MDC_PRESS_BLD_NONINV_SYS^MDC|1.3.1.1|120|266016^MDC_DIM_MMHG^MDC|||||R OBX|4|NM|150022^MDC_PRESS_BLD_NONINV_DIA^MDC|1.6.1.1|80|266016^MDC_DIM_MMHG^MDC|||||R OBX|5|NM|150023^MDC_PRESS_BLD_NONINV_MEAN^MDC|1.6.1.1|100|266016^MDC_DIM_MMHG^MDC|||||R OBX|6|NM|150037^MDC_PRESS_BLD_ART_ABP_SYS^MDC|1.6.1.1|126|266016^MDC_DIM_MMHG^MDC|||||R OBX|7|NM|150038^MDC_PRESS_BLD_ART_ABP_DIA^MDC|1.6.1.1|76|266016^MDC_DIM_MMHG^MDC|||||R OBX|8|NM|150039^MDC_PRESS_BLD_ART_ABP_MEAN^MDC|1.6.1.1|92|266016^MDC_DIM_MMHG^MDC|||||R OBX|9|NM|151728^MDC_AWAY_CO2_ET^MDC|1.6.1.1|60|266016^MDC_DIM_MMHG^MDC|||||R OBX|10|NM|151562^MDC_RESP_RATE^MDC|1.6.1.1|60|264928^MDC_DIM_RESP_PER_MIN^MDC|||||R||||||||| OBX|11|NM|150364^MDC_TEMP_BODY^MDC|1.0.0.9|37|268192^MDC_DIM_DEGC^MDC|||||R OBX|12|NM|150364^MDC_EEG_BISPECTRAL_INDEX^MDC|1.0.0.9|37|262656^MDC_DIM_DIMLESS^MDC|||||R OBX|13|NM|131840^MDC_ECG_AMPL_ST|1.0.0.9|37|266418^MDC_DIM_MILLI_VOLT^MDC|||||R

I get this in the receptor:

MSH|^~\&|LiFETouch17|LiFETouch17Facility|AnesthesiaApp|AnesthesiaAppFacility|20141112144500||ORU^R01^ORU_R01|Q123456789T123456789X123456|P|2.6|||||||||IHE PCD ORU-R01

PID|||123456789|012345678 9^AA^^JP|BROS^MARIO||19850101000000|M|||123 FAKE STREET^MARIO LUIGI BROS PLACE^TOADSTOOL KINGDOM^NES^A1B2C3^JP^HOME^^1234|1234

PV1||O|ABCD^EFGH||||123456^DINO^YOSHI^^^^^^MSRM^CURRENT^^^NEIGHBOURHOOD DR NBR|^DOG^DUCKH UNT^^^^^^^CURRENT|||||||||123456^DINO^YOSHI^^^^^^MSRM^CURRENT^^^NEIGHBOURHOOD DR NBR||0123456789|||||||||||||||||||||||||20010101000000

OBR|1|080019FFFF4F6AFE20081211144657^AwareGateway^080019FFFF4F6AC0^EUI-64|080019FFFF4F6AC020081211144657^AwareGateway^080019FFFF4F6AC0^EUI-64|126.169.95.2^2000^MDC|||20081211144500

nullOBX|1|NM|147842^MDC_ECG_HEART_RATE^MDC|1.1.1.1|60|264864^/min^UCUM|||||ROBX|2|NM|150324^MDC_SAT_O2_ART^MDC|1.2.1.1|98|262688^MDC_DIM_PERCENT^MDC|||||ROBX|3|NM|150021^MDC_PRESS_BLD_NONINV_SYS^MDC|1.3.1.1|120|266016^MDC_DIM_MMHG^MDC|||||ROBX|4|NM|150022^MDC_PRESS_BLD_NONINV_DIA^MDC|1.6.1.1|80|266016^MDC_DIM_MMHG^MDC|||||ROBX|5|NM|150023^MDC_PRESS_BLD_NONINV_MEAN^MDC|1.6.1.1|100|266016^MDC_DIM_MMHG^MDC|||||ROBX|6|NM|150037^MDC_PRESS_BLD_ART_ABP_SYS^MDC|1.6.1.1|126|266016^MDC_DIM_MMHG^MDC|||||ROBX|7|NM|150038^MDC_PRESS_BLD_ART_ABP_DIA^MDC|1.6.1.1|76|266016^MDC_DIM_MMHG^MDC|||||ROBX|8|NM|150039^MDC_PRESS_BLD_ART_ABP_MEAN^MDC|1.6.1.1|92|266016^MDC_DIM_MMHG^MDC|||||ROBX|9|NM|151728^MDC_AWAY_CO2_ET^MDC|1.6.1.1|60|266016^MDC_DIM_MMHG^MDC|||||ROBX|10|NM|151562^MDC_RESP_RATE^MDC|1.6.1.1|60|264928^MDC_DIM_RESP_PER_MIN^MDC|||||R||||||||| OBX|11|NM|150364^MDC_TEMP_BODY^MDC|1.0.0.9|37|268192^MDC_DIM_DEGC^MDC|||||ROBX|12|NM|150364^MDC_EEG_BISPECTRAL_INDEX^MDC|1.0.0.9|37|262656^MDC_DIM_DIMLESS^MDC|||||R

public void onCreate() {
super.onCreate();
serverThread = new Thread(new Runnable() { public void run() { try{ Looper.prepare(); socket = new ServerSocket(8080); socket.setReuseAddress(true); socket.setPerformancePreferences(100, 100, 1);

                while (!stop){
                  Socket accept = socket.accept();
                  accept.setPerformancePreferences(10, 100, 1);
                  accept.setKeepAlive(true);

                      try
                        {             

/here I get the message with 16 lines/ /Every line ends with a \n to differenciate segments in the receptor/

                          in = new BufferedReader(new InputStreamReader(accept.getInputStream())); 

                          int cont=0;
                          for (cont=0;cont<16;cont++){
                              if (cont==0){
                                   aux = in.readLine();
                                   aux=aux.substring(1);
                                   if (aux.contains(inicio)){
                                      hl7Message=aux+separator2;
                                   }
                                   else{
                                       Log.v("Fail", "Error, the received data does not " +"follow the HL7 protocol");
                                       break;  

                                       }
                                   }

                            hl7Message+=in.readLine()+separator2;

                            }

                         }catch (IOException e2){
                              e2.printStackTrace();
                          }

/I call the parser with the entire message/

                        hl7Parser(hl7Message);

                }
             } catch (Throwable e){
                e.printStackTrace();
                Log.e(getClass().getSimpleName(), "Error in Listener",e);
                }

            try
            {   
             socket.close();
            }
            catch (IOException e)
            {
            Log.e(getClass().getSimpleName(), "keep it simple");
             }
           }
         },"Server thread");
       serverThread.start();
      }

/here I parse the message, first of all I separate every line by the \n and I have: MSH, PID, PV1, OBR and OBX (from 1 to 13)/

public void hl7Parser(String hl7Message){

        String[]  fieldsOfMessage= null;
        fieldsOfMessage=hl7Message.split(separator2);

        MSH=fieldsOfMessage[0];
        PID=fieldsOfMessage[1];       
        PV1=fieldsOfMessage[2];
        OBR=fieldsOfMessage[3];

        for (int x=4; x<16;x++){
            OBX+=fieldsOfMessage[x];

        }      

/Here I get the index of the first segment to be able to search the desired field inside the segment/

        int[] indice;

        //MSH SEGMENT
        indice=get_indice(MSH);

/Those are the desired fields/

        String sending_application, sending_facility, receiving_application, 
        receiving_facility, date, message_type, 
        message_control_id, processing_ID, version, sequence_number, 
        accept_ack_type, app_ack_type, country_code, principle_language, message_profile_id;


        sending_application=MSH.substring(indice[1]+1,indice[2]);

        sending_facility=MSH.substring(indice[2]+1,indice[3]);

        receiving_application=MSH.substring(indice[3]+1,indice[4]);


        receiving_facility=MSH.substring(indice[4]+1,indice[5]);


        date=MSH.substring(indice[5]+1,indice[6]);


        message_type=MSH.substring(indice[7]+1,indice[8]);

        int tr=message_type.indexOf("^");
        String type=message_type.substring(tr+1);

        message_control_id=MSH.substring(indice[8]+1,indice[9]);


        processing_ID=MSH.substring(indice[9]+1,indice[10]);


        version=MSH.substring(indice[10]+1,indice[11]);


        message_profile_id=MSH.substring(indice[19]+1);


        Date now = new Date();
        String standard_date = new SimpleDateFormat("yyyyMMddHHmmss.SSSZ").format(now);

/I exactly get the error before the OBX field getting nullOBX... instead of OBX../

1

There are 1 answers

0
colibriii On BEST ANSWER

It was a problem inside the message, I was missing the first three parameters related with containment:

OBX|1||69965^MDC_DEV_MON_PHYSIO_MULTI_PARAM_MDS^MDC|1.0.0.0|||||||X OBX|2||69966^MDC_DEV_MON_PHYSIO_MULTI_PARAM_VMD^MDC|1.1.0.0|||||||X OBX|3||69967^MDC_DEV_MON_PHYSIO_MULTI_PARAM_CHAN^MDC|1.1.1.0|||||||X