I see. I tried to take a representative sample from the actual data I'm working with:
library(stringr)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
sample <- data.frame(
stringsAsFactors = FALSE,
var = c("var1","var2","var3","var4",
"var5","var6","var7","var8","var9","var10","var11",
"var12","var13","var14","var15","var16","var17",
"var18","var19","var20","var21"),
relevant = c("/data/a_is_eligible != 1",
"/data/a_is_eligible = 1",
"/data/a_is_eligible = 1 and /data/audit_above_20 != 1",
"/data/app_app_language/a_pre_speak_study_languages = '0'",
"/data/app_app_language/language_code = 'tsn' or /data/app_app_language/language_code = 'sot' or /data/app_app_language/language_code = 'en' or /data/app_app_language/language_code = 'zul'",
"/data/app_app_language/language_code = 'zul'",
"/data/consented_to_rct != 1 and /data/a_is_eligible = 1",
"/data/copy-1-of-pre-treatment_smear_results/b_nr_results_month3 != '0'",
"/data/mi_visit/participant_arrived_crf_3 = '1'",
"/data/question1/attempt_1_m1_1/attempt_1_crf_3_responed = '1' or /data/question1/attempt_1_m1_1/attempt_1_crf_3_responed = '2'",
"/data/question1/attempt_1_m1_1/attempt_1_reschedule_crf_6 = '1' or /data/question1/copy-1-of-attempt_1/attempt_2_reschedule_crf_6 = '1' or /data/question1/copy-2-of-attempt_1/attempt_3_reschedule_crf_6 = '1'",
"/data/question1/attempts/attempt_3_made_crf_6 = '1'",
"/data/question1/copy-1-of-attempt_1/attempt_2_crf_3_sms = '1'",
"/data/question1/copy-1-of-month_follow-up/a_date_6_month_follow_up >= (/data/question1/default_date_6_month_follow_up + 14) or /data/question1/copy-1-of-month_follow-up/a_date_6_month_follow_up <= (/data/question1/default_date_6_month_follow_up - 14)",
"/data/question2/mi_2/a_date_time_mi_2 >= (/data/question2/default_date_time_mi_2 + 14) or /data/question2/mi_2/a_date_time_mi_2 <= (/data/question2/default_date_time_mi_2 - 14)",
"/data/screening_consent/consent_information/a_literate = '0' and /data/screening_consent/consent_information/verbal_consent_participate/a_verbal_consent_participate = '1'",
"/data/screening_consent/consent_information/consent_to_examine_patients_medical_record/a_consent_medical_record = '1' or /data/screening_consent/consent_information/verbal_consent_to_examine_medical_records/a_verbal_consent_medical_record = '1'",
"/data/screening_tool/a_reported_age >= 18",
"/data/screening_tool/some_history/a_smoked_past_month = '1' or /data/screening_tool/some_history/a_smoked_past_month = '2' or /data/screening_tool/some_history/a_smoked_past_month = '0' or /data/screening_tool/some_history/a_drink_12_months = '0' or /data/screening_tool/some_history/a_drink_12_months = '1'",
"if(/data/month_6_9_tb_ourcomes_completed_yes_no = 'Yes', 'Yes', 'No')",
"instance('casedb')/casedb/case[@case_id = instance('session')/session/data/case_id]/a_is_eligible = 1 and instance('casedb')/casedb/case[@case_id = instance('session')/session/data/case_id]/bojanala_participant = 1 and instance('casedb')/casedb/case[@case_id = instance('session')/session/data/case_id]/a_bojanala_clinic = \"B01\"")
)
sample %>% mutate(relevant = str_remove_all(string = relevant, pattern = "/.+?/.+?/"))
#> var
#> 1 var1
#> 2 var2
#> 3 var3
#> 4 var4
#> 5 var5
#> 6 var6
#> 7 var7
#> 8 var8
#> 9 var9
#> 10 var10
#> 11 var11
#> 12 var12
#> 13 var13
#> 14 var14
#> 15 var15
#> 16 var16
#> 17 var17
#> 18 var18
#> 19 var19
#> 20 var20
#> 21 var21
#> relevant
#> 1 /data/a_is_eligible != 1
#> 2 /data/a_is_eligible = 1
#> 3 data/audit_above_20 != 1
#> 4 a_pre_speak_study_languages = '0'
#> 5 language_code = 'tsn' or language_code = 'sot' or language_code = 'en' or language_code = 'zul'
#> 6 language_code = 'zul'
#> 7 data/a_is_eligible = 1
#> 8 b_nr_results_month3 != '0'
#> 9 participant_arrived_crf_3 = '1'
#> 10 attempt_1_m1_1question1/attempt_1_m1_1/attempt_1_crf_3_responed = '2'
#> 11 attempt_1_m1_1question1dataattempt_3_reschedule_crf_6 = '1'
#> 12 attempts/attempt_3_made_crf_6 = '1'
#> 13 copy-1-of-attempt_1/attempt_2_crf_3_sms = '1'
#> 14 copy-1-of-month_follow-upquestion1question1data/question1/default_date_6_month_follow_up - 14)
#> 15 mi_2question2question2data/question2/default_date_time_mi_2 - 14)
#> 16 consent_informationscreening_consenta_verbal_consent_participate = '1'
#> 17 consent_informationdataverbal_consent_to_examine_medical_records/a_verbal_consent_medical_record = '1'
#> 18 a_reported_age >= 18
#> 19 some_historyscreening_tooldataa_smoked_past_month = '0' or some_historyscreening_tool/some_history/a_drink_12_months = '1'
#> 20 if(/data/month_6_9_tb_ourcomes_completed_yes_no = 'Yes', 'Yes', 'No')
#> 21 instance('casedb')sessiona_is_eligible = 1 and instance('casedb')sessionbojanala_participant = 1 and instance('casedb')sessiona_bojanala_clinic = "B01"
Created on 2020-06-21 by the reprex package (v0.3.0)