Skip to contents

The age_at_index function calculates the age at an already defined index date of all patients in a cohort.

Usage

age_at_index(database, index_date)

Arguments

database

database name to use

index_date

user defined table with two columns

  • patient id

  • index_date

Value

a spark dataframe with two columns

  • patient_id

  • age_at_index: defined as the year of the date in the index_date column of the index_date input minus year_of_birth from the database patient table

    • if patients don’t have an index date or a year_of_birth, return null for that patient_id

Details

age_at_index = tnx.age_at_index(database=db, index_date=index_date)