codematch: Select ICD10, OPCS or Read codes matching a particular...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/codematch.R

Description

Selects ICD10, OPCS or Read codes matching a particular pattern together with mapped terms in other dictionaries. Returns a selection object. This can be combined with the output from functions such as termhas to generate a complex query for selecting terms of interest.

Usage

1
2
codematch(regexpr, dictionary = ifelse(length(getdictionary()) == 1,
    getdictionary(), ""), mapStatus = NULL, exact = FALSE)

Arguments

regexpr

Read, ICD-9, ICD-10 or OPCS code(s) to match. This can be a regular expression if EXACT = FALSE, otherwise it should be the exact code. If regexpr is a vector, the results are combined using OR. This is an easy way to match a list of codes.

dictionary

One of 'icd10', 'icd9', 'opcs' or 'read'. If not given, and if only one dictionary is in use, this dictionary is taken as the set of codes to match.

mapStatus

This applies to maps to/from Read only. Character vector stating which terms are acceptable to include according to the match characteristics. D is the default map, A is the alternative map, E is an exact match, and G is a map where the OPCS or ICD-10 term is more general than the Read term. T is not supplied by the NHS but is a mapping between identical terms (non-case-sensitive). R is for a term which must be ruled out before allocating a specified ICD-10 term, for example myocardial infarction must be ruled out in order to code to the ICD-10 term for essential hypertension, but myocardial infarction is not a map for essential hypertension. The default mapStatus is A, D, E or T when searching Read codes, and A, D, G, E or T when searching ICD-10 or OPCS codes.

exact

Whether the regexpr should be treated as a code for exact matching or a regular expression.

Details

The maps to/from Read are provided in the NHS Read Clinical Terms Version 3, and are in the CALIBER_DICTMAPS table. The mapping between ICD-9 and ICD-10 is provided by the U.S. national Center for health Statistics and is in the CALIBER_GEM table.

Value

A selection object.

Author(s)

Anoop Shah

References

UK Terminology Centre, National Center for Health Statistics (NCHS/CDC)

See Also

medcodeis, assigncat, dictis, explode, decode, getdictionary, setdictionary, termhas

To convert codelists from one dictionary to another: convert

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Selecting Read terms linked to ICD-10 terms for myocardial infarction
setdictionary('read')
print(codematch('I2[123]', 'icd10'))

# Look for `exact' matches and identical terms only.
print(codematch('I2[123]', 'icd10', mapStatus=c('E', 'T')))

# Selecting ICD-9 terms and linked ICD-10 terms
setdictionary('icd9', 'icd10')
print(codematch('^41', 'icd9'))
print(codematch('I20', 'icd10'))

CALIBERcodelists documentation built on Feb. 28, 2020, 3:01 a.m.