Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Identify tests/ participants adherent to VL testing protocol

    Hi all, I would like to test adherence to Viral load testing protocol for pregnant women in our study:

    If woman has an old HIV diagnosis she will have her VL test done immediately and if the levels are below 1000copies/ml the repeat test is done after 6 months
    If above levels are 1000 and above then repeat test can be earlier at 3 months.

    If guidelines adherent they should have at least 2 VL tests within 7 months of enrolment

    If woman has a new HIV diagnosis, she starts her ART drugs immediately and her first VL test is done at 6 months post-enrolment. Timing of HIV diagnosis is defined by variable KP2.
    KP2==0 should have at least 1 VL test within 7 months of enrolment.


    Please give me a command to identify tests (VL_copies) done within 7 months of enrolment into our study (ENROLMENT DATE)

    If a participant is old diagnosis (KP2==1) they should have at least 2 tests within that period which are at least 3 months apart
    Second test only qualifies if the result previous one was 1000 copies (VL_copies) or more and should be at least 3 months or more

    This will not apply if participant has no VL test ( defined by variable, Truemisses==1) or if they only have only one test during follow-up ( defined by variable, ntestVL==1)

    See data sample below

    ----------------------- copy starting from the next line -----------------------
    Code:
    * Example generated by -dataex-. To install: ssc install dataex clear input str13 PatientID float(Collected VL_copies KP2) int(ntestVL ENROLLMENTDATE) float(Test_number1 Truemisses) "002729598-3" 21006 0 1 2 20507 1 0 "002729598-3" 21361 67 1 2 20507 2 0 "035374152-3" 20712 0 1 3 20523 1 0 "035374152-3" 21035 0 1 3 20523 2 0 "035374152-3" 21381 0 1 3 20523 3 0 "050657801-2" 20808 0 0 2 20628 1 0 "050657801-2" 21370 0 0 2 20628 2 0 "061047053-6" 20832 38 0 1 20599 1 0 "10020KT-0" 20572 1560 1 4 20600 1 0 "10020KT-0" 20685 0 1 4 20600 2 0 "10020KT-0" 21026 0 1 4 20600 3 0 "10020KT-0" 21559 0 1 4 20600 4 0 "10444-KT-2" 21066 0 1 1 20493 1 0 "10656KT-1" 20699 58 1 3 20535 1 0 "10656KT-1" 20979 58 1 3 20535 2 0 "10656KT-1" 21098 143 1 3 20535 3 0 "1065CH-0" . . 1 1 20471 . 1 "11258-29414" 20839 0 1 4 20605 1 0 "11258-29414" 21103 0 1 4 20605 2 0 "11258-29414" 21426 0 1 4 20605 3 0 end format %td Collected format %td ENROLLMENTDATE label values KP2 KP2_label label def KP2_label 0 "NewCase", modify label def KP2_label 1 "OldCase", modify
    ------------------ copy up to and including the previous line ------------------


    Thank you!


  • #2
    Somehow your -dataex- output got mangled in posting. I think I have reconstructed it properly here.

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str13 PatientID float(Collected VL_copies KP2) int(ntestVL ENROLLMENTDATE) float(Test_number1 Truemisses)
    "002729598-3" 21006 0 1 2 20507 1 0
    "002729598-3" 21361 67 1 2 20507 2 0
    "035374152-3" 20712 0 1 3 20523 1 0
    "035374152-3" 21035 0 1 3 20523 2 0
    "035374152-3" 21381 0 1 3 20523 3 0
    "050657801-2" 20808 0 0 2 20628 1 0
    "050657801-2" 21370 0 0 2 20628 2 0
    "061047053-6" 20832 38 0 1 20599 1 0
    "10020KT-0" 20572 1560 1 4 20600 1 0
    "10020KT-0" 20685 0 1 4 20600 2 0
    "10020KT-0" 21026 0 1 4 20600 3 0
    "10020KT-0" 21559 0 1 4 20600 4 0
    "10444-KT-2" 21066 0 1 1 20493 1 0
    "10656KT-1" 20699 58 1 3 20535 1 0
    "10656KT-1" 20979 58 1 3 20535 2 0
    "10656KT-1" 21098 143 1 3 20535 3 0
    "1065CH-0" . . 1 1 20471 . 1
    "11258-29414" 20839 0 1 4 20605 1 0
    "11258-29414" 21103 0 1 4 20605 2 0
    "11258-29414" 21426 0 1 4 20605 3 0
    end
    format %td Collected
    format %td ENROLLMENTDATE
    label values KP2 KP2_label
    label def KP2_label 0 "NewCase", modify
    label def KP2_label 1 "OldCase", modify
    
    local 7_months 213
    local 3_months 91
    assert inlist(KP2, 0, 1)
    
    gen byte in_window = inrange(Collected - ENROLLMENTDATE, 0, `7_months')
    
    by PatientID (Collected), sort: egen tests_within_7_months = total(in_window)
    by PatientID (Collected): egen earliest = min(cond(in_window, Collected, .))
    by PatientID (Collected): egen latest = max(cond(in_window, Collected, .))
    format earliest latest %td
    gen byte spaced_3_months = (latest - earliest >= `3_months') & !missing(latest)
        
    gen byte compliant = tests_within_7_months >= 2 & spaced_3_months if KP2
    replace compliant = tests_within_7_months >= 1 if !KP2
    replace compliant = . if Truemisses
    Notes:

    1. There is one person, 10020KT-0, who has a test done one month prior to enrollment. I chose not to count that as being within 7 months: I only counted tests done on the date of, or after, enrollment. You can modify that if you wish.

    2. Calculating an exact 7 calendar month threshold is messy, and it is clinically pointless, as it is a different amount of time depending on the enrollment date. So I have used 213 days as a surrogate for 7 months. Similarly, I have used 91 days as a surrogate for 3 months.

    Comment


    • #3
      Hi Clyde, Thank you for reconstructing data so that it makes sense.

      Thank also for the code. It worked !!

      Am also asking you another question:
      Am using the Stata command below for subgroup analysis. It works well and gives me a forest plot but it does not generate p values. (attached Figure 2) How do I generate and add a the column for p values.

      ipdover, over( age_binary FacilityxVL2 sinceHIVDxtime_cat marital_binary education_binary hours_cat2 phone_own3 phoneownshare ///
      PregnancyOutcome Gestcat previousHIVDx Year_ENROLLMENTDATE2) ///
      irr forestplot( (null xlabel( 0.10 (1) 10, force) boxsca(100) textsize(150) ) ///
      favours("<---------------------" "Favours Control group" # "--------------------->" "Favours SMS group" ) fp(6)) ///
      : poisson gap33_binary arm2 if gap33b==1




      . dataex clinic_id age_binary FacilityxVL2 sinceHIVDxtime_cat marital_binary education_binary hours_cat2 phone_own3 phoneownshare PregnancyOu
      > tcome Gestcat previousHIVDx Year_ENROLLMENTDATE2 gap33_binary gap33b in 1/20

      ----------------------- copy starting from the next line -----------------------
      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str14 clinic_id float(age_binary FacilityxVL2 sinceHIVDxtime_cat marital_binary education_binary hours_cat2 phone_own3 phoneownshare PregnancyOutcome Gestcat previousHIVDx Year_ENROLLMENTDATE2 gap33_binary gap33b)
      "K2123" 0 3 2 1 0 1 1 2 0 2 1 0 0 1
      "K2123" 0 3 2 1 0 1 1 2 0 2 1 0 0 .
      "K2140" 0 3 3 1 0 0 1 1 0 2 1 0 1 1
      "K2140" 0 3 3 1 0 0 1 1 0 2 1 0 1 .
      "K2140" 0 3 3 1 0 0 1 1 0 2 1 0 1 .
      "K2200" 1 3 1 1 0 1 1 2 0 3 0 0 0 1
      "K2200" 1 3 1 1 0 1 1 2 0 3 0 0 0 .
      "K2183" 1 3 1 1 1 1 1 2 0 2 0 0 0 1
      "K2185" 1 3 3 0 1 1 1 1 0 2 1 0 1 .
      "K2185" 1 3 3 0 1 1 1 1 0 2 1 0 1 1
      "K2185" 1 3 3 0 1 1 1 1 0 2 1 0 1 .
      "K2185" 1 3 3 0 1 1 1 1 0 2 1 0 1 .
      "K2111" 1 3 2 1 0 1 1 2 0 2 1 0 0 1
      "K2150" 1 3 3 1 1 1 1 1 0 2 1 0 1 1
      "K2150" 1 3 3 1 1 1 1 1 0 2 1 0 1 .
      "K2150" 1 3 3 1 1 1 1 1 0 2 1 0 1 .
      "C3044" 1 1 2 1 0 1 1 2 1 2 1 0 0 1
      "M5166" 1 2 1 0 1 1 1 1 0 1 1 0 1 1
      "M5166" 1 2 1 0 1 1 1 1 0 1 1 0 1 .
      "M5166" 1 2 1 0 1 1 1 1 0 1 1 0 1 .
      end
      label values age_binary age_binary_label
      label def age_binary_label 0 "≥30 years", modify
      label def age_binary_label 1 "<30 years", modify
      label values FacilityxVL2 FacilityxVL2_label
      label def FacilityxVL2_label 1 "Chulaimbo/Matayos", modify
      label def FacilityxVL2_label 2 "MTRH", modify
      label def FacilityxVL2_label 3 "Kitale", modify
      label values sinceHIVDxtime_cat sinceHIVDxtime_cat_label
      label def sinceHIVDxtime_cat_label 1 "<1 year", modify
      label def sinceHIVDxtime_cat_label 2 "1-5 years", modify
      label def sinceHIVDxtime_cat_label 3 ">5 years", modify
      label values marital_binary marital_binary_label
      label def marital_binary_label 0 "Not in union", modify
      label def marital_binary_label 1 "Married", modify
      label values education_binary education_binary_label
      label def education_binary_label 0 "No", modify
      label def education_binary_label 1 "Yes", modify
      label values hours_cat2 hours_cat2_label
      label def hours_cat2_label 0 ">1hr", modify
      label def hours_cat2_label 1 "≤1hr", modify
      label values phone_own3 phone_own3_label
      label def phone_own3_label 1 "Yes", modify
      label values phoneownshare phoneownshare_label
      label def phoneownshare_label 1 "Owns and doesn't share", modify
      label def phoneownshare_label 2 "Owns and shares", modify
      label values PregnancyOutcome PregnancyOutcome_label
      label def PregnancyOutcome_label 0 "Live birth", modify
      label def PregnancyOutcome_label 1 "loss/unknown", modify
      label values Gestcat Gestcat_label
      label def Gestcat_label 1 "First", modify
      label def Gestcat_label 2 "Second", modify
      label def Gestcat_label 3 "Third", modify
      label values previousHIVDx previousHIVDx_label
      label def previousHIVDx_label 0 "No", modify
      label def previousHIVDx_label 1 "Yes", modify
      label values Year_ENROLLMENTDATE2 Year_ENROLLMENTDATE2_label
      label def Year_ENROLLMENTDATE2_label 0 "2016", modify
      -

      Thanks a lot!

      Attached Files

      Comment


      • #4
        I'm afraid I can't help you with your new question. -ipdover- is not part of official Stata and I am unfamiliar with it. -findit ipdover- tells me that it is about metanalysis, a technique I stopped using three decades ago, and which has evolved considerably since then, so my knowledge of it is obsolete anyway. Perhaps somebody else following this thread will know the answer. If you do not get a timely reply from somebody, I suggest you repost the question in a new thread, and mention -ipdover- in the title so it will attract attention from people who are familiar with it.

        Comment


        • #5
          Thank you. I will do that!

          Comment

          Working...
          X