Epidemiology & Technology

Understanding Cataract Prevalence and Operated variables in RAAB

There are various ways that cataract can be defined when analysing data from RAAB surveys. Here, I review the RAAB Analysis R scripts to understand how it is being done in the autogenerated tables.

Understanding the case_when syntax

This syntax is used very commonly for creating new variables based on certain conditions being met.

Let us break it down for the BLIND variable

blind = case_when
(
      raab$right_distance_acuity_presenting>=1.8 & 
      raab$left_distance_acuity_presenting>=1.8    
                  ~ 1, 
      TRUE ~ 0
)Code language: R (r)

This Statement says that

  • Define a variable ‘blind’
  • Set the variable ‘blind’ as 1 in case Right Eye PVA >= 1.8 and Left eye PVA >= 1.8 LogMAR values
  • Otherwise it will be 0

Other Visual impairment conditions

raab <- raab %>% mutate(
   blind = case_when(raab$right_distance_acuity_presenting>=1.8 & raab$left_distance_acuity_presenting>=1.8 ~ 1, TRUE ~ 0), 
   severe.vi = case_when(pmin(raab$right_distance_acuity_presenting, raab$left_distance_acuity_presenting)==1.3 ~ 1, TRUE ~ 0),
   moderate.vi = case_when(pmin(raab$right_distance_acuity_presenting, raab$left_distance_acuity_presenting)==1.0 ~ 1, TRUE ~ 0),
   mild.vi = case_when(pmin(raab$right_distance_acuity_presenting, raab$left_distance_acuity_presenting)==0.47 ~ 1, TRUE ~ 0)
  
)Code language: R (r)

Unilateral VI

Lets us take Unilateral Blind Conditions

  blind.unilat = case_when(
           (raab$right_distance_acuity_presenting>=1.8 & raab$left_distance_acuity_presenting==0.3)  |
           (raab$left_distance_acuity_presenting>=1.8 & raab$right_distance_acuity_presenting==0.3)      ~ 1, 
       TRUE ~ 0),Code language: R (r)

Unilateral Blind =

  • Right Eye PVA >= 1.8 and Left eye PVA == 0.3 LogMAR, OR
  • Left Eye PVA >= 1.8 and Right eye PVA == 0.3 LogMAR

Other Unilateral visual impairment conditions

  severe.unilat = case_when((raab$right_distance_acuity_presenting==1.3 & raab$left_distance_acuity_presenting==0.3)  |
                              (raab$left_distance_acuity_presentin==1.3 & raab$right_distance_acuity_presenting==0.3) ~ 1, TRUE ~ 0),
  
  moderate.unilat = case_when((raab$right_distance_acuity_presenting==1.0 & raab$left_distance_acuity_presenting==0.3)  |
                                (raab$left_distance_acuity_presenting==1.0 & raab$right_distance_acuity_presenting==0.3) ~ 1, TRUE ~ 0),
  
  mild.unilat = case_when((raab$right_distance_acuity_presenting==0.47 & raab$left_distance_acuity_presenting==0.3)  |
                            (raab$left_distance_acuity_presenting==0.47 & raab$right_distance_acuity_presenting==0.3) ~ 1, TRUE ~ 0),Code language: R (r)

Cumulative VI Conditions

#Define cumulative visual acuity counts

raab <- raab %>% mutate(
  mild.cumulative = case_when(
            pmin(
                  raab$right_distance_acuity_presenting,
                  raab$left_distance_acuity_presenting
               )>=0.47 ~ 1, 
            TRUE ~ 0),
  moderate.cumulative = case_when(pmin(raab$right_distance_acuity_presenting,raab$left_distance_acuity_presenting)>=1.0 ~ 1, TRUE ~ 0),
  severe.cumulative = case_when(pmin(raab$right_distance_acuity_presenting, raab$left_distance_acuity_presenting)>=1.3 ~ 1, TRUE ~ 0),
  blind.cumulative = case_when(pmin(raab$right_distance_acuity_presenting,raab$left_distance_acuity_presenting)>=1.8 ~ 1, TRUE ~ 0)
)Code language: PHP (php)

Cumulative Mild VI is present if

  • The Minimum of Right Eye PVA and Left Eye PVA is >= 0.47
  • Since increase in LogMAR values means worseing visual acuity, what we are saying is
    • take the value of VA in eye with minimum LogMAR or the best Visual acuity
    • Then check if that value is >= 0.47, which means
      • Better eye VA is 0.47 or worse / Snellens Can see 6/18 or worse, and
      • Better Eye VA is NOT 0.3 LogAMR / Snellens Can see 6/18
      • Respondent has Mild Visual Impairment

Thus it is very easy to see how conditions are being evaluated when defining variables. Now let us look at some cataract related variables being defined and understand those.

Cataract Related Variables

Operable Cataract

right_operable_<strong>612</strong> = case_when(
          ( raab$lens_status_right == "lens_status_opacity" & 
            raab$poor_vision_cause_right == "poor_vision_cause_cataract_untreated" & 
            (raab$right_distance_acuity_pinhole <strong>>= 0.47</strong>)
           ) ~ 1, 
           TRUE ~ 0),
left_operable_612 = case_when(
          ( raab$lens_status_left == "lens_status_opacity"  & 
            raab$poor_vision_cause_left=="poor_vision_cause_cataract_untreated" & 
            (raab$left_distance_acuity_pinhole >= 0.47)
           ) ~ 1, 
           TRUE ~ 0),
 
right_operable_<strong>618</strong> = case_when(
          ( raab$lens_status_right=="lens_status_opacity"  & 
            raab$poor_vision_cause_right=="poor_vision_cause_cataract_untreated" & 
            (raab$right_distance_acuity_pinhole<strong> >= 1.0</strong>)
           ) ~ 1, 
           TRUE ~ 0),
left_operable_618 = case_when(
        (  raab$lens_status_left=="lens_status_opacity" & 
           raab$poor_vision_cause_left=="poor_vision_cause_cataract_untreated"   & 
           (raab$left_distance_acuity_pinhole >= 1.0)
       ) ~ 1, 
      TRUE ~ 0),

right_operable_660 = case_when((raab$lens_status_right=="lens_status_opacity" & raab$poor_vision_cause_right=="poor_vision_cause_cataract_untreated" & (raab$right_distance_acuity_pinhole>=1.3)) ~ 1, TRUE ~ 0),
left_operable_660 = case_when((raab$lens_status_left=="lens_status_opacity" & raab$poor_vision_cause_left=="poor_vision_cause_cataract_untreated" & (raab$left_distance_acuity_pinhole>=1.3)) ~ 1, TRUE ~ 0),

right_operable_360 = case_when((raab$lens_status_right=="lens_status_opacity" & raab$poor_vision_cause_right=="poor_vision_cause_cataract_untreated" & (raab$right_distance_acuity_pinhole>=1.8)) ~ 1, TRUE ~ 0),
left_operable_360 = case_when((raab$lens_status_left=="lens_status_opacity" & raab$poor_vision_cause_left=="poor_vision_cause_cataract_untreated" & (raab$left_distance_acuity_pinhole>=1.8)) ~ 1, TRUE ~ 0),
Code language: R (r)

So Operable cataract at 6/12 Threshold in an Eye is defined as

  • Lens Status in that eye = Obvious Lens Opacity
  • Cause of PVA < 6/12 in that eye is “Cataract Untreated”
  • PinholeVA in that eye is under that eye is LogMAR >= 0.47 / Snellens “Cannot see 6/12, Can see 6/18” or worse

Operated Cataract

This Excludes couched eyes and includes “no view of lens” if cataract surgical complications is recorded as cause of poor vision

  right_operated = case_when(
        ( 
            (   raab$lens_status_right == "lens_status_absent" & 
                raab$surgery_type_right != "surgery_type_couching"
            ) | 
            raab$lens_status_right=="lens_status_pseudophakia_no_pco"    | 
            raab$lens_status_right=="lens_status_pseudophakia_with_pco"  | 
            (    raab$lens_status_right=="lens_status_no_view" & 
                 raab$poor_vision_cause_right=="poor_vision_cause_cataract_surgical_complications")
            ) ~ 1, 
            TRUE ~ 0),
  left_operated = case_when(((raab$lens_status_left=="lens_status_absent" & raab$surgery_type_left!="surgery_type_couching") | raab$lens_status_left=="lens_status_pseudophakia_no_pco" | raab$lens_status_left=="lens_status_pseudophakia_with_pco" | (raab$lens_status_left=="lens_status_no_view" & raab$poor_vision_cause_left=="poor_vision_cause_cataract_surgical_complications")) ~ 1, TRUE ~ 0)

 bilat.operated = case_when(raab$right_operated == 1 & raab$left_operated == 1 ~ 1, TRUE ~ 0)
 unilat.operated = case_when(bilat.operated != 1 & (raab$right_operated == 1 | raab$left_operated == 1) ~ 1, TRUE ~ 0)
raab$total.operated <- (raab$bilat.operated == 1 | raab$unilat.operated == 1) + 0
Code language: R (r)

Right Eye status is Operated Cataract if

  • Right Eye Lens status is Aphakia And Surgery Type is Not Couching , OR
  • Right Eye Lens status is Pseudophakia without PCO, OR
  • Right Eye Lens status is Pseudophakia with PCO, OR
  • Right Eye Lens status is No View of Lens and Right Eye Cause is “Cataract Surgcial Complications”

Similar Logic is used for Left eye

Bilateral operated is when Both Eye are operated

Unilateral is when Only one eye is operated

Total Operated is when Any eye is operated

eCSC and CSC component variables

Let us take exmaple of Piunhold VA < 6/18 threshold of cataract surgery and and PVA 6/12 as good outcome.

R Code
x_case_618 = case_when(
      (
        (raab$right_operated != 1 & 
        raab$right_distance_acuity_pinhole >= 1.0 & 
        raab$left_operated == 1 
        )  | # OR 
        (raab$right_operated == 1 & 
        raab$left_operated != 1 & 
        raab$left_distance_acuity_pinhole >= 1.0  
        ) 
        ) ~ 1, 
        TRUE ~ 0  ),

y_case_618 = case_when(
      (  raab$right_operated == 1 & 
         raab$left_operated == 1
      ) ~ 1, 
      TRUE ~ 0),
    
    
 z_case_618 = case_when(
      (  raab$right_distance_acuity_pinhole > 0.47 & 
         raab$left_distance_acuity_pinhole > 0.47 
      ) & 
      (  raab$right_operated != 1 & 
         raab$left_operated != 1
      ) & 
      (  raab$right_operable_618 == 1 | 
         raab$left_operable_618 == 1
      ) ~ 1, 
      TRUE ~ 0),

 old_z_case_618 = case_when(
      (  raab$right_operable_618 == 1 & 
         raab$left_operable_618 == 1
      ) ~ 1, TRUE ~ 0),
  
 a_case_612_618 = case_when(
      (  
         (  raab$right_operated == 1 & 
            raab$right_distance_acuity_presenting <= 0.3
         ) & 
           raab$left_operated != 1 & 
           raab$left_distance_acuity_pinhole >= 1.0
      ) | 
      (
         (  raab$left_operated == 1 & 
            raab$left_distance_acuity_presenting <= 0.3
         ) & 
            raab$right_operated != 1 & 
            raab$right_distance_acuity_pinhole >= 1.0
      ) ~ 1, 
      TRUE ~ 0),



 b_case_612 = case_when(
      (  raab$right_operated == 1 & 
         raab$left_operated == 1 & 
         pmin(raab$right_distance_acuity_presenting, raab$left_distance_acuity_presenting) < 0.47
      ) ~ 1, 
      TRUE ~ 0),
 Code language: R (r)

Component X: Individuals with unilateral operated cataract (regardless of visual acuity in the operated eye), who have BCVA worse than the specified threshold in the other eye (irrespective of cause)

  • Right Eye
    • Right Eye Is not Opetrated, AND
    • Right Eye PinholeVA is “Cannot See 6/18” / >= 1.0 LogMAR, AND
    • Left Eye is Operated
  • OR, Left eye
    • Left eye is not operated
    • Left Eye PinholeVA is “Cannot See 6/18” / >= 1.0 LogMAR, AND
    • Right Eye is Operated

Component Y: Individuals with bilateral operated cataract, regardless of visual acuity

  • Right eye is Operated, AND
  • Left Eye is Operated

Remember, the status “Operated Cataract” was just defined above based on Lens stauts, absence of couching and no view ith cataract sugical complciations in that eye

Component Z: Individuals who have BCVA worse than the specified threshold in both eyes with cataract as the main cause of vision impairment or blindness in one or both eyes.

  • Right PinholeVA is > 0.47 LogMAR / >= 1.0 LogMAR / “Cannot see 6/18”, AND
  • Right is Not operated, AND
  • Left PinholeVA is > 0.47 LogMAR / >= 1.0 LogMAR / “Cannot see 6/18”, AND
  • Left is Not Operated, AND
  • Either of
    • Right Eye is Operable cataract , OR
    • Left Eye is Operable Cataract

Operable Cataract – defined above on basis of Lens opacity, cataract as Cause and PinholeVA >= 1.0 / > 0.47 / Cannot see 6/18

Cataract VI / Blind at person level

# New vars for cataract VI at the person level (aligned with new eCSC definition denominator = unmet need for cataract surgery)
raab$cataract.blind <- (raab$z_case_360) + 0
raab$cataract.severe.vi <- (raab$z_case_660) + 0
raab$cataract.moderate.vi <- (raab$z_case_618) + 0
raab$cataract.mild.vi <- (raab$z_case_612) + 0Code language: PHP (php)

These are the same as Component Z of eCSC. Eg at 6/18 threshold

  • Right PinholeVA is > 0.47 LogMAR / >= 1.0 LogMAR / “Cannot see 6/18”, AND
  • Left PinholeVA is > 0.47 LogMAR / >= 1.0 LogMAR / “Cannot see 6/18”, AND
  • Right is Not Opetated, AND
  • Left is Not Operated, AND
  • Either of
    • Right Eye is Operable cataract , OR
    • Left Eye is Operable Cataract

Operable Cataract – defined above on basis of Lens opacity, cataract as Cause and PinholeVA >= 1.0 / > 0.47 / Cannot see 6/18

Bilateral Cataract Cases

raab$vi.denom <- case_when(raab$exam_status == "exam_status_examined" ~ 1, TRUE ~ 0)

#bilateral cataract cases - Taking 6/18 as example / MOd VI
old_z_case_618 = case_when(      
     (  raab$right_operable_618 == 1 &          
        raab$left_operable_618 == 1      
     ) ~ 1, 
    TRUE ~ 0),

asa7bil$total.n[asa7bil$vi.level=="moderate.vi"]  <- sum(raab$old_z_case_618,na.rm=T)
asa7bil$total.pct[asa7bil$vi.level=="moderate.vi"] <-sum(raab$old_z_case_618,na.rm=T) / sum(raab$vi.denom,na.rm=T)
asa7bil$total.adj.pct[asa7bil$vi.level=="moderate.vi"] <- prop.age.sex.adjust(popfives,raab,raab$old_z_case_618,raab$vi.denom)Code language: PHP (php)

A person has Bilateral Cataract at 6/18 PinVA theshold if

  • Right Eye has Operable Cataract: Lens Opacity and casue cataract and Pinhole VA < 6/18 in that eye, AND
  • Left Eye has Operable Cataract: Lens Opacity and casue cataract and Pinhole VA < 6/18 in that eye, AND

The Percentage is derived by dividing the numbers having operable cataract with the denominator for VI estimation [all respondents with vision data]

Bilateral Operable Cataract is used for bariers to Cataract Surgery at 6/60 threshold

# Bilateral operable cataract cases used to report barriers to cataract surgery
raab$bilateral_operable_cataract <- (raab$right_operable_660 == 1 & raab$left_operable_660) + 0Code language: PHP (php)

Unilateral Cataract

 old_z_case_618 = case_when(
      (  raab$right_operable_618 == 1 & 
         raab$left_operable_618 == 1
      ) ~ 1, TRUE ~ 0),

#unilateral cataract cases
raab$denom.618.unicat <- (
   (raab$right_operable_618==1 | raab$left_operable_618==1) & 
   ! (raab$old_z_case_618)
   ) + 0

asa7uni$total.n[asa7uni$vi.level=="moderate.vi"] <- sum(raab$denom.618.unicat,na.rm=T) 
asa7uni$total.pct[asa7uni$vi.level=="moderate.vi"] <- sum(raab$denom.618.unicat,na.rm=T) / sum(raab$vi.denom,na.rm=T)

asa7uni$total.adj.pct[asa7uni$vi.level=="moderate.vi"]<-prop.age.sex.adjust(popfives,raab,raab$denom.618.unicat,raab$vi.denom)Code language: PHP (php)

A participant has unilateral cataract at 6/18 threshold if

  • Either
    • Right eye has operable cataract at pinVA <6/18, OR
    • Left eye has operable cataract at PinVA <6/18
  • AND Both Eyes do not have operable cataract

Related Posts