-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathwithout.R
128 lines (76 loc) · 3.58 KB
/
without.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
source("dmrun.R")
#########################################################################
### finding out how many patients don't have specific health variables.##
#########################################################################
if (CDM %in% c("PCORNET3","PCORNET31")) {
##gender
#define the only wanted values
gender <- c("M","F")
without_gender <- withoutdem(table = demographic, col = "sex", ref_date2 = "2014-01-01" ,list = gender)
##race -- make sure we understand what values are in accepted list!
race <- c("05","03","07","02","01","04","06","OT")
without_race <- withoutdem(table = demographic, col = "race", ref_date2 = "2014-01-01" ,list = race)
#ethnicity
ethnicity <- c("Y")
without_ethnicity <- withoutdem(table = demographic, col = "hispanic", ref_date2 = "2014-01-01" ,list = ethnicity)
##################
##################
######### Using Function "WITHOUT"
####################
####################
# medication
#define the uwanted values in addition to NULLs...
medication <- c("","%","$","#","@","NI")
#
without_medication <-
without(table = "PRESCRIBING", col = "prescribingid", ref_date2 = "2014-01-01" ,list = medication)
#Dx -------------
#define the uwanted values in addition to NULLs...
diagnosis <- c("","%","$","#","@","NI")
#
without_diagnosis <-
without(table = "DIAGNOSIS", col = "dx", ref_date2 = "2014-01-01" ,list = diagnosis)
#Encounter -------------
#define the uwanted values in addition to NULLs...
encounter <- c("","%","$","#","@","NI")
#
without_encounter <-
without(table = "ENCOUNTER", col = "enc_type", ref_date2 = "2014-01-01" ,list = encounter)
#Weight -------------
#define the uwanted values in addition to NULLs...
weight <- c("","%","$","#","@","NI")
#
without_weight <-
without(table = "VITAL", col = "wt", ref_date2 = "2014-01-01" ,list = weight)
#Height -------------
#define the uwanted values in addition to NULLs...
height <- c("","%","$","#","@","NI","NI")
#
without_height <-
without(table = "VITAL", col = "ht", ref_date2 = "2014-01-01" ,list = height)
#blood_pressure -------------
#define the uwanted values in addition to NULLs...
blood_pressure <- c("","%","$","#","@","NI")
#
without_BP_sys <-
without(table = "VITAL", col = "systolic", ref_date2 = "2014-01-01" ,list = blood_pressure)
without_BP_dias <-
without(table = "VITAL", col = "diastolic", ref_date2 = "2014-01-01" ,list = blood_pressure)
# without_BP <- rbind(without_BP_sys,without_BP_dias)
without_BP <- without_BP_sys
#smoking -------------
#define the uwanted values in addition to NULLs...
smoking <- c("","%","$","#","@","NI")
#
without_smoking <-
without(table = "VITAL", col = "smoking", ref_date2 = "2014-01-01" ,list = smoking)
withouts <- rbind(without_encounter,without_diagnosis,without_medication,without_ethnicity,without_race,without_gender,without_weight,
without_height,without_BP,without_smoking)
withouts$perc <- percent(withouts$missing.percentage)
withouts$organization <- org
withouts$test_date <- as.character(format(Sys.Date(),"%m-%d-%Y"))
withouts$CDM <- CDM
write.csv(withouts, file = paste("reports/withouts_",CDM,"_",org,"_",as.character(format(Sys.Date(),"%d-%m-%Y")),".csv", sep=""))
## make another copy in the comparison directory for comparison
# write.csv(withouts, file = paste("PATH/withouts_",CDM,"_",org,"_",as.character(format(Sys.Date(),"%d-%m-%Y")),".csv", sep=""))
}