This function is useful for verifying that raw or residual phenotype risk scores of diagnosed individuals (cases) tend to be higher than scores of undiagnosed individuals (controls).

## Usage

getDxStatus(
demos,
icdOccurrences,
minUniqueDates = 2L,
diseaseDxIcdMap = phers::diseaseDxIcdMap
)

## Arguments

demos

A data.table having one row per person in the cohort. Must have a column person_id.

icdOccurrences

A data.table of occurrences of ICD codes for each person in the cohort. Must have columns person_id, icd, flag, and entry_date.

minUniqueDates

Integer indicating the minimum number of unique ICD code entry dates required to classify a person as a case. Persons with at least one, but fewer than minUniqueDates entry dates, are assigned as neither cases nor controls.

diseaseDxIcdMap

A data.table of the mapping between diseases and the corresponding ICD codes that indicate a diagnosis. Must have columns disease_id, icd, and flag. Default is diseaseDxIcdMap.

## Value

A data.table with columns person_id, disease_id, and dx_status

(1 indicates a case, 0 indicates a control, -1 indicates neither).

phers()
library('data.table')