Working with Databases

Translating Code Sets

The codemap module can be used to translate code sets, this can be useful for any channel not just one using HL7, see the Translating code sets page for more information.

There are two versions of the codemap module: one allows for a default value to be returned if there is no matching code, the second returns nil if there is no match. We generally recommend the second more general module.

Simple list

You can define a list like this:

Code translation table

Looking up unknown code “W” returns nil:

Now we add a default so “other” is returned: