Database to HL7

NHCCVIS Test Data

We need to put some test data into the NHCCVIS table. This table is use to queue messages that have been updated (status “W” = written), and therefore need to be processed. In this case we will insert a single record only, though you could easily add more.

I did not have any SQL tools handy so I used the Translator, since it was convenient. The following code executes the SQL statemtent to insert a row in the NHCCVIS table. I used the SQLite REPLACE keyword to ensure that we cannot insert duplicate rows by accident (if a row already exists with the same key it will simply be updated). You can also use tools like the SQLite Administrator or SQLite Manager to add records.

This code is “plug and play” and it will automatically create the SQLite database database if it does not exist. The test database file will be created in the Iguana install directory.

Note: This code is “single use” and will be overwritten in the next step.

The SELECT query confirms that the test data has been created.

The queries you use in your environment may be a little different depending on the the database you use and the required name, user and password. Here’s the above code in a format which can be copy pasted:

local conn = db.connect{
   api=db.SQLITE,
   name='test', 
   live=true
}

function main(Data)
   conn:execute{
      sql="REPLACE INTO NHCCVIS VALUES(1, 'W')",
      live=true
   }
end

Next Step?

Now we have inserted some test data into the queuing table NHCCVIS. The next step is to write the From Translator script to poll the table and push message IDs onto the Iguana queue.