first_case: First Case selection

Description Usage Arguments Details Value Examples

View source: R/first_case_selection.R

Description

Selects the first case stays of electronic medical records (EMRs) dataset and exclude patients with stays containing exclusion criteria within two years.

Usage

1
2
first_case(data, diagnoses_case, diagnoses_exclusion, exclude_in_case_stay,
  n_of_stays_max)

Arguments

data

A data.table of electronic medical records (EMRs).

diagnoses_case

A character vector containing codes to identify primary outcome diagnoses in stays.

diagnoses_exclusion

A character vector containing codes to identify exclusion diagnoses in stays.

exclude_in_case_stay

A Boolean. If TRUE, a case stay containing an exclusion criteria is discarded. If FALSE, case stays are not sought for exclusion criteria.

n_of_stays_max

A scalar giving the maximum number of stays allowed in the whole database for a unique patient.

Details

A case is defined as a patient who has experienced the primary outcome for the first time. Patients are excluded if they had a medical history defined by a list of one or more exclusion criteria. Stays containing one or more exclusion criteria are sought within a two year period before case. Any patient exceeding maximum number of stays is discarded.

Value

A data.table with selected first case stays.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
data(ep)
obj0 <- ep

obj1 <- first_case(
  data = obj0,
  diagnoses_case =  'PE',
  diagnoses_exclusion = 'EXCLUSION',
  exclude_in_case_stay = FALSE,
  n_of_stays_max = 20
)

obj1 

obj2 <- age_study_period_restrictions(
  data = obj0,
  cases = obj1,
  starting_year = 2007,
  final_year = 2013,
  age_min = 0,
  age_max = 120
)

obj2

obj3 <- case_crossover(
  case_stay = obj2,
  data = obj0,
  exposure_diagnoses = '',
  exposure_procedures = 'THR',
  screening_index_stay = FALSE,
  unique_exposure = TRUE,
  interval_length = 42,
  number_of_interval = 8,
  wash_out = 365,
  los_max = 42
)
obj3 
obj3$graph

jomuller/ITCARES documentation built on May 19, 2019, 7:26 p.m.