Class FileCodeMapper

java.lang.Object
ca.uhn.hl7v2.util.CodeMapper
ca.uhn.hl7v2.util.FileCodeMapper

public class FileCodeMapper extends CodeMapper

Implements CodeMapper using files to store code values. Files are arranged in the following directory structure. The base directory is called "codemap". This should be created under the hapi.home directory (see Home class; defaults to .). Under the base directory, there should be one directory for each interface, and each of these directories should be named after the interface. For example if you had interfaces to pharmacy and lab systems you might have the following directories:

<hapi.home>/codemap/pharmacy
<hapi.home>/codemap/lab

Each directory should contain two files per HL7 table, named after the table numbers as follows: "hl7nnnn.li" and "hl7nnnn.il", where nnnn is the 4 digit table number. The .il file contains maps from interface codes to local codes, and the .li file contains maps from local codes to interface codes (these unfortunately may not be symmetrical).

Each line of a file contains a single code map, with the "from" value and the "to" value separated by a tab. For example, the file <hapi.home>/lab/HL70001.li (to map local codes to interface codes for the HL7 admnistrative sex table in your lab system interface) might contain the following line:

male&tab;M

This means that the local code "male" maps to the interface code "M".

Lines that start with "//" are treated as comments.

Author:
Bryan Tripp
  • Constructor Details

    • FileCodeMapper

      public FileCodeMapper() throws HL7Exception
      Creates a new instance of FileCodeMapper. You should probably not construct a FileCodeMapper directly. Use CodeMapper.getInstance() instead ... this will ensure that only a single instance is created, which is important for performance because code maps are loaded from disk every time this constructor is called.
      Throws:
      HL7Exception
  • Method Details