Skip to contents

Performs a single stage of ICD code mapping, either the forward map or the backward map. The forward map takes the source codes and maps to the destination codes using the GEM, while the backward map finds all the codes mapped to the source codes in the GEM of the opposite direction.

Usage

map_stage(
  codes,
  icdVer_dest,
  code_type = c("dg", "pc"),
  direction = c("forward", "backward"),
  match_method = c("exact", "prefix")
)

Arguments

codes

A vector of ICD diagnosis or procedure codes.

icdVer_dest

A number, either 9 or 10, indicating the destination ICD version.

code_type

A string, either "dg" or "pc," indicating the codes are diagnosis or procedure, respectively.

direction

A string, either "forward" or "backward", to indicate the direction of the mapping.

match_method

A string, specifying the method for matching the codes

  • "exact" matches the provided code exactly.

  • "prefix" treats the provided code as a prefix for matching.

Value

A dataframe with the source code, the matching destination code, and additional columns for cases where multiple codes represent a single source code.