Custom ACKs

Query Response Example

This is a great technique for implementing a query response interface. Say you have an incoming message that looks like:


For which you need to send back an ADR^A19 message giving patients matching the given ID.

Here’s an example. As you can see the principle is simple. The query comes in. It’s parsed and used to generate a SQL query against the database. The data from the SQL query is used to populate the HL7 message that is returned. The logic can be made more elaborate but the principle is the same.

Note: We set live = true to execute SQL queries interactively in the Iguana script editor.

Tip: For a production version it is recommended best practice to escape the Id to avoid a SQL injection attack, see escaping values correctly for SQL.

Here’s the vmd query.vmd and you can get the Query Response ACK code from our code repository.

Leave A Comment?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.