-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsome_charts.R
69 lines (57 loc) · 2.11 KB
/
some_charts.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
# plotting
library(ggplot2)
library(RColorBrewer)
# QUERYING DATa
person_data_query <- querySql(connection, 'SELECT * FROM PERSON')
condition_occurrence_data_query <- querySql(connection, 'SELECT * FROM CONDITION_OCCURRENCE')
observation_data_query <- querySql(connection, 'SELECT * FROM OBSERVATION')
visit_occurrence_data_query <- querySql(connection, 'SELECT * FROM VISIT_OCCURRENCE')
procedure_occurrence_data_query <- querySql(connection, 'SELECT * FROM PROCEDURE_OCCURRENCE')
ggplot(person_data_query, aes(x = as.factor(ETHNICITY_CONCEPT_ID))) +
geom_bar() +
labs(title = "ETHNICAL GROUPS",
x = "Ethnicity Concept ID",
y = "COUNTS") +
theme_minimal()
ggplot(person_data_query, aes(x = as.factor(GENDER_CONCEPT_ID))) +
geom_bar() +
labs(title = "GENDER DISTRIBUTION",
x = "GENDER CONCEPT ID",
y = "COUNTS") +
theme_minimal()
ggplot(person_data_query, aes(x =as.factor(RACE_CONCEPT_ID))) +
geom_bar() +
labs(title = "RACE CONCEPTS",
x = "RACE CONCEPT IDS",
y = "COUNTS") +
theme_minimal()
observation
ggplot(condition_occurrence_data_query, aes(x =as.factor(CONDITION_TYPE_CONCEPT_ID))) +
geom_bar() +
labs(title = "CONDITION TYPES",
x = "CONDITION TYPES CONCEPT IDS",
y = "COUNTS") +
theme_minimal()
ggplot(observation, aes(x =as.factor(observation_concept_id))) +
geom_bar() +
labs(title = "CONDITION TYPES",
x = "CONDITION TYPES CONCEPT IDS",
y = "COUNTS") +
theme_minimal()
observation
ggplot(visit_occurrence_data_query, aes(x =as.factor(VISIT_CONCEPT_ID))) +
geom_bar() +
labs(title = "VISIT CONCEPT",
x = "VISIT CONCEPT IDS",
y = "COUNTS") +
theme_minimal()
observation
colors <- brewer.pal(n = length(unique(procedure_occurrence_data_query$procedure_concept_id)), name = "Set3")
ggplot(procedure_occurrence_data_query, aes(x =as.factor(PROCEDURE_CONCEPT_ID)), fill = factor(PROCEDURE_CONCEPT_ID)) +
geom_bar() +
labs(title = "PROCEDURE CONCEPT",
x = "PROCEDURE CONCEPT IDS",
y = "COUNTS",
fill = 'PROCEDURE_CONCEPT_ID') +
theme_minimal() +
scale_fill_manual(values = colors)