CKD in diabetics within 5Y of kidney panel

mail@pastecode.io avatar
unknown
yaml
14 days ago
2.4 kB
1
Indexable
Never
description: >-
  This task predicts the onset of new CKD in diabetic patients within 5 years of any laboratory test they
  obtain that includes a kidney panel. Patient events are only eligible if those patients have (a) a standing
  diabetes diagnosis, (b) no prior CKD diagnosis, (c) at least one data point more than 5 years after the
  event, and (d) no events within 90 days prior to the event in which kidney panels will have been measured.

predicates:
  # Plain predicates
  # Diabetes diagnosis
  diabetes_dx: 
    code: { regex: "^DRG.*DIABETES.*" }

  # Biomechanical Definition of Diabetes
  hba1c_high:
    code: LAB//50852//%
    value_min: 6.5 # %

  2hr_oral_glucose:
    code: LAB//51034//mg/dL
    value_min: 200 # mg/dL
  random_glucose:
    code: LAB//50809//mg/dL
    value_min: 200 # mg/dL
  polyuria: 
    code: DIAGNOSIS//ICD//10//R358
  polydipsia:
    code: DIAGNOSIS//ICD//10//R631
  polyphagia:
    code: DIAGNOSIS//ICD//10//R632

  # CKD diagnosis
  ckd_dx: 
    code: DIAGNOSIS//ICD//10//N189

  # Kidney labs
  kidney_labs:
    code: { any: [LAB//50920//UNK, LAB//51770//UNK, LAB//52026//UNK, LAB//53176//UNK] }

  # Derived predicates
  any_classic_symptom:
    expr: or(polyuria, polydipsia, polyphagia)
    
  random_glucose_with_symptoms:
    expr: and(random_glucose, any_classic_symptom)

  # Final diabetes predicate
  diabetes:
    expr: or(diabetes_dx, hba1c_high, 2hr_oral_glucose, random_glucose_with_symptoms)

trigger: kidney_labs

windows:
  new_trigger_only:
    start: end - 90D
    end: trigger
    start_inclusive: True
    end_inclusive: False
    has:
      kidney_labs: (None, 0)
  no_ckd:
    start: null
    end: trigger
    start_inclusive: True
    end_inclusive: True
    has:
      ckd_dx: (None, 0)
  has_diabetes:
    start: null
    end: trigger
    start_inclusive: True
    end_inclusive: True
    has:
      diabetes: (1, None)
  input:
    start: null
    end: trigger
    start_inclusive: True
    end_inclusive: True
    index_timestamp: end
  target:
    start: input.end
    end: start + 1825D
    start_inclusive: False
    end_inclusive: True
    label: ckd_dx
  censoring:
    start: target.end
    end: null
    start_inclusive: False
    end_inclusive: True
    has:
      _ANY_EVENT: (1, None)