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:
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
male&tab;M
This means that the local code "male" maps to the interface code "M".
Lines that start with "//" are treated as comments.
Constructor and Description |
---|
FileCodeMapper()
Creates a new instance of FileCodeMapper.
|
Modifier and Type | Method and Description |
---|---|
String |
getInterfaceCode(String interfaceName,
int hl7Table,
String localCode)
Returns the interface code for the given local code, for use in the context
of the given interface.
|
String |
getLocalCode(String interfaceName,
int hl7Table,
String interfaceCode)
Returns the local code for the given interface code as it appears in
the given interface.
|
static void |
main(String[] args)
Test harness.
|
void |
refreshCache()
If values are cached in such a way that they are not guaranteed to be current, a call
to this method refreshes the values.
|
void |
throwExceptionIfNoMatch(boolean throwException)
Determines what happens if no matching code is found during a lookup.
|
getInstance, getInt, getLocal
public FileCodeMapper() throws HL7Exception
HL7Exception
public void refreshCache() throws HL7Exception
refreshCache
in class CodeMapper
HL7Exception
public String getLocalCode(String interfaceName, int hl7Table, String interfaceCode) throws HL7Exception
getLocalCode
in class CodeMapper
HL7Exception
public String getInterfaceCode(String interfaceName, int hl7Table, String localCode) throws HL7Exception
getInterfaceCode
in class CodeMapper
HL7Exception
public void throwExceptionIfNoMatch(boolean throwException)
throwExceptionIfNoMatch
in class CodeMapper
Copyright © 2001–2017 University Health Network. All rights reserved.