Skip to content

Commit

Permalink
Merge pull request #11 from reflejar/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mpvaldez authored Dec 1, 2023
2 parents d96eb03 + 0b32dd4 commit 3fec95e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 6 deletions.
31 changes: 29 additions & 2 deletions apps/testeos/PreProcesamiento.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,17 @@ area_honeycomb_grid = st_sf(area_honeycomb_grid) %>%
int= st_intersects(area_honeycomb_grid, hex_data)

area_honeycomb_grid$Tooltip=NA
area_honeycomb_grid$Popup=NA

for (i in 1:length(int)){

filas=int[[i]]

if(length(filas)>0){
tooltip=paste0( "<span style='font-family: Fira Sans,sans-serif; font-size: 14px; line-height:2;'>","<center><b style='font-size: 16px;'>ANÁLISIS DE ORINA HUMANA</b></center>","<hr style='margin: 0;'>")

largo=ifelse(length(filas)>3,3,length(filas))

for(j in 1:length(filas)){
if(j==1){
tooltip=paste0(tooltip,"<center><b style='font-size: 12px;'>Testeo</b> <b style='font-size: 12px;'>",j,"</b>","</center>",
Expand All @@ -77,21 +81,44 @@ for (i in 1:length(int)){
" <br>","<center>","<b>Laboratorio: </b>",data$LABORATORIO[filas[j]],"</center>",
"<center>","<b>Solicitante: </b>",data$SOLICITANTE[filas[j]],"</center>"
)
}else{
}else if(j<largo){
tooltip=paste0(tooltip,"<hr style='margin: 0 ;'>","<center><b style='font-size: 12px;'>Testeo</b> <b style='font-size: 12px;'>",j,"</b>","</center>",
"<b>Glifosato en Orina: </b>",data$GLIFOSATO.EN.ORINA[filas[j]],
" <br>","<b>Glifosato en Orina (AMPA): </b>",data$`GLIFOSATO.EN.ORINA.(AMPA)`[filas[j]],
" <br>","<b>Fecha de Testeo: </b>",data$FECHA[filas[j]],
" <br>","<center>","<b>Laboratorio: </b>",data$LABORATORIO[filas[j]],"</center>",
"<center>","<b>Solicitante: </b>",data$SOLICITANTE[filas[j]],"</center>")
}else if(j==largo){

popup=paste0(tooltip,"<hr style='margin: 0 ;'>","<center><b style='font-size: 12px;'>Testeo</b> <b style='font-size: 12px;'>",j,"</b>","</center>",
"<b>Glifosato en Orina: </b>",data$GLIFOSATO.EN.ORINA[filas[j]],
" <br>","<b>Glifosato en Orina (AMPA): </b>",data$`GLIFOSATO.EN.ORINA.(AMPA)`[filas[j]],
" <br>","<b>Fecha de Testeo: </b>",data$FECHA[filas[j]],
" <br>","<center>","<b>Laboratorio: </b>",data$LABORATORIO[filas[j]],"</center>",
"<center>","<b>Solicitante: </b>",data$SOLICITANTE[filas[j]],"</center>")
tooltip=paste0(tooltip,"<hr style='margin: 0 ;'>","<center><b style='font-size: 12px;'>Click para ver ",ifelse(length(filas)-2==1, "1 resultado más",paste0(length(filas)-2," más resultados")) ,"</b> <b style='font-size: 12px;'>","</b>","</center>")

}else if(j>largo){

popup=paste0(popup,"<hr style='margin: 0 ;'>","<center><b style='font-size: 12px;'>Testeo</b> <b style='font-size: 12px;'>",j,"</b>","</center>",
"<b>Glifosato en Orina: </b>",data$GLIFOSATO.EN.ORINA[filas[j]],
" <br>","<b>Glifosato en Orina (AMPA): </b>",data$`GLIFOSATO.EN.ORINA.(AMPA)`[filas[j]],
" <br>","<b>Fecha de Testeo: </b>",data$FECHA[filas[j]],
" <br>","<center>","<b>Laboratorio: </b>",data$LABORATORIO[filas[j]],"</center>",
"<center>","<b>Solicitante: </b>",data$SOLICITANTE[filas[j]],"</center>")

}

if(j==length(filas)){
tooltip=paste0(tooltip,"</span>")
popup=paste0(popup,"</span>")

}

}
area_honeycomb_grid$Tooltip[i]=tooltip
area_honeycomb_grid$Popup[i]=popup

}

}
Expand Down Expand Up @@ -212,7 +239,7 @@ for (i in 1:nrow(data)){

if(data$CITA.PAPER[i]=="-"){
tooltip=paste0("<span style='font-family: Fira Sans,sans-serif; font-size: 14px; line-height:2;'>","<center><b style='font-size: 16px;'>",data$SECTOR.AMBIENTAL[i],"</b></center>","<hr style='margin: 0;'>",
" <br>","<b>Fecha de Testeo:</b>",data$FECHA[i])
" <br>","<b>Fecha de Testeo: </b>",data$FECHA[i])

variables_con_data=variables[which(grepl("/",data[i,variables]))]

Expand Down
6 changes: 4 additions & 2 deletions apps/testeos/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ palette <- colorBin('Reds', domain = honeycomb_count$n_colli, bins = 5)
# palette(4)

hover=lapply(honeycomb_count$Tooltip, htmltools::HTML)
hover_popup=lapply(honeycomb_count$Popup, htmltools::HTML)

hover_markers=lapply(amb$Tooltip, htmltools::HTML)


Expand Down Expand Up @@ -167,8 +169,8 @@ server <- function(input, output, session) {
leaflet()%>%setView(lat = lat,lng=long,zoom = initial_zoom)%>%
addMapPane("HexPane",zIndex = 400)%>%
addPolygons(data=honeycomb_count,fillColor = ~palette(n_colli),
label = hover,popup = hover,
popupOptions = popupOptions(maxHeight ="300",minWidth = "250",
label = hover,popup = hover_popup,
popupOptions = popupOptions(maxHeight ="300",minWidth = "300",
closeOnClick = TRUE),
fillOpacity = 0.5,color="black",opacity=1,weight=1,group="Hex",
options = pathOptions(pane = "HexPane"),
Expand Down
Binary file modified apps/testeos/data/hexagonos.parquet
Binary file not shown.
Binary file modified apps/testeos/data/puntos.parquet
Binary file not shown.
5 changes: 3 additions & 2 deletions apps/testeos/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ palette <- colorBin('Reds', domain = honeycomb_count$n_colli, bins = 5)
# palette(4)

hover=lapply(honeycomb_count$Tooltip, htmltools::HTML)
hover_popup=lapply(honeycomb_count$Popup, htmltools::HTML)
hover_markers=lapply(amb$Tooltip, htmltools::HTML)

style <- "
Expand Down Expand Up @@ -155,8 +156,8 @@ shinyServer(function(input, output, session) {
leaflet()%>%setView(lat = lat,lng=long,zoom = 7)%>%
addMapPane("HexPane",zIndex = 400)%>%
addPolygons(data=honeycomb_count,fillColor = ~palette(n_colli),
label = hover,popup = hover,
popupOptions = popupOptions(maxHeight ="300",minWidth = "250",
label = hover,popup = hover_popup,
popupOptions = popupOptions(maxHeight ="300",minWidth = "300",
closeOnClick = TRUE),
fillOpacity = 0.5,color="black",opacity=1,weight=1,group="Hex",
options = pathOptions(pane = "HexPane"),
Expand Down

0 comments on commit 3fec95e

Please sign in to comment.