Newer
Older
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
### harmonized_loc.R
### Module pour l'analyse des localisations harmonisées
##################
### Objets de données
##################
date1 <- reactive({
as.Date(paste0(input$HARLOCdates[1],"-01-01"))
})
date2 <- reactive({
as.Date(paste0(input$HARLOCdates[2],"-12-31"))
})
# Préparation des listes de zones pour la Colombie
HARLOC_residencial_area_co <- JSON_area_har %>%
filter(source == "CO") %>%
select(id, name) %>%
arrange(name)
HARLOC_residencial_area_list_co <- with(HARLOC_residencial_area_co, split(id, name))
# Préparation des listes de zones pour le Brésil
HARLOC_residencial_area_br <- JSON_area_har %>%
filter(source == "BR") %>%
select(id, name) %>%
arrange(name)
HARLOC_residencial_area_list_br <- with(HARLOC_residencial_area_br, split(id, name))
# Préparation des centres de santé pour la Colombie
HARLOC_health_center_co <- JSON_healthcenter_har %>%
filter(source == "CO") %>%
select(id_center, name) %>%
arrange(name)
HARLOC_health_center_list_co <- with(HARLOC_health_center_co, split(id_center, name))
# Préparation des centres de santé pour le Brésil
HARLOC_health_center_br <- JSON_healthcenter_har %>%
filter(source == "BR") %>%
select(id_center, name) %>%
arrange(name)
HARLOC_health_center_list_br <- with(HARLOC_health_center_br, split(id_center, name))
# Interface utilisateur réactive pour la sélection des localisations
output$HARLOClocation_co <- renderUI({
switch(input$HARLOCtype,
"residence_area" = selectInput("HARLOCselection_co", tr("CO"),
HARLOC_residencial_area_list_co,
multiple = TRUE),
"center" = selectInput("HARLOCselection_co", tr("CO"),
HARLOC_health_center_list_co,
multiple = TRUE),
"infection_place" = selectInput("HARLOCselection_co", tr("CO"),
HARLOC_residencial_area_list_co,
multiple = TRUE)
)
})
# Interface pour la sélection des localisations brésiliennes (inchangée)
output$HARLOClocation_br <- renderUI({
switch(input$HARLOCtype,
"residence_area" = selectInput("HARLOCselection_br", tr("BR"),
HARLOC_residencial_area_list_br,
multiple = TRUE),
"center" = selectInput("HARLOCselection_br", tr("BR"),
HARLOC_health_center_list_br,
multiple = TRUE),
"infection_place" = selectInput("HARLOCselection_br", tr("BR"),
HARLOC_residencial_area_list_br,
multiple = TRUE)
)
})
# Filtrage des données pour la Colombie
HARLOC_sub_co <- reactive({
df <- consultation_har_filter(JSON_cons_har,
source = "CO",
new_attack = input$HARLOCnew_attack,
diagn = input$HARLOCdiagn,
sex = input$HARLOCsex,
minAge = input$HARLOCage[1],
maxAge = input$HARLOCage[2]
) %>%
filter(consultation_date >= date1() & consultation_date <= date2())
if(input$HARLOCtype == "center"){
df <- df %>% filter(id_center %in% input$HARLOCselection_co)
} else if(input$HARLOCtype == "residence_area"){
df <- df %>% filter(residence_place %in% input$HARLOCselection_co)
} else if(input$HARLOCtype == "infection_place"){
df <- df %>% filter(infection_place %in% input$HARLOCselection_co)
}
return(df)
})
# Filtrage des données pour le Brésil (similaire au code existant)
HARLOC_sub_br <- reactive({
df <- consultation_har_filter(JSON_cons_har,
source = "BR",
new_attack = input$HARLOCnew_attack,
diagn = input$HARLOCdiagn,
sex = input$HARLOCsex,
minAge = input$HARLOCage[1],
maxAge = input$HARLOCage[2]
) %>%
filter(consultation_date >= date1() & consultation_date <= date2())
if(input$HARLOCtype == "center"){
df <- df %>% filter(id_center %in% input$HARLOCselection_br)
} else if(input$HARLOCtype == "residence_area"){
df <- df %>% filter(residence_place %in% input$HARLOCselection_br)
} else if(input$HARLOCtype == "infection_place"){
df <- df %>% filter(infection_place %in% input$HARLOCselection_br)
}
return(df)
})
# Qualité de l'information pour la Colombie
HARLOC_sub_infqual_co <- reactive({
df <- consultation_har_filter(JSON_cons_har,
source = "CO",
new_attack = input$HARLOCnew_attack,
diagn = input$HARLOCdiagn,
sex = input$HARLOCsex,
minAge = input$HARLOCage[1],
maxAge = input$HARLOCage[2]
) %>%
filter(consultation_date >= date1() & consultation_date <= date2()) %>%
is.na() %>%
colMeans() * 100
df <- replace(df, is.nan(df), 100)
return(df)
})
# Qualité de l'information pour le Brésil
HARLOC_sub_infqual_br <- reactive({
# [Code existant inchangé]
})
# Tableaux par jour de la semaine
HARLOC_co_tab_day_week <- reactive({
if(nrow(HARLOC_sub_co()) > 0){
as.data.frame(incidence(HARLOC_sub_co()$consultation_date, interval = 1))
}
})
HARLOC_br_tab_day_week <- reactive({
# [Code existant inchangé]
})
##################
### Graphiques
##################
# Graphique d'incidence
output$HARLOC_plot_incidence <- renderPlotly({
# [Suite du code avec les adaptations nécessaires]
})
# [Autres graphiques et visualisations avec adaptations similaires]