Browse Source

Pas de limitation de lignes pour les requêtes bdd

master
Maxime Wack 7 years ago
parent
commit
178bb65391
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      donnees.R

+ 4
- 4
donnees.R View File

@@ -69,7 +69,7 @@ src_mysql("pmsi_dim", "localhost", user = user, password = password) %>%
tbl(sql("SELECT finess, idhosp, idrss, idrum, date_entree, date_sortie, cmd, um FROM fix116
UNION
SELECT finess, idhosp, idrss, idrum, date_entree, date_sortie, cmd, um FROM fix117")) %>%
collect %>%
collect(n = Inf) %>%
mutate(date_entree = date_entree %>% as.Date,
date_sortie = date_sortie %>% as.Date) %>%
left_join(src_mysql("pmsi_dim_nom", "localhost", user = user, password = password) %>%
@@ -78,7 +78,7 @@ src_mysql("pmsi_dim", "localhost", user = user, password = password) %>%
select(uf_date_ferm, um, service_libelle, pole_libelle) %>%
arrange(um, uf_date_ferm) %>%
distinct %>%
collect %>%
collect(n = Inf) %>%
add_rownames(var = "dummy") %>% # Dédoublonnage : 1 um -> 1 couple libellés
group_by(um) %>%
filter(dummy == last(dummy)) %>%
@@ -119,7 +119,7 @@ src_mysql("pmsi_dim", "localhost", user = user, password = password) %>%
filter(pass_typ != "EXT",
type_resp == "M") %>%
distinct %>%
collect %>%
collect(n = Inf) %>%
mutate(date_entree = as.Date(date_entree),
date_sortie = as.Date(date_sortie)) %>%
anti_join(filter(., is.na(date_sortie) | date_sortie >= as.Date(str_c(annee, mois, "01", sep = "-")) + period(1, "month")),
@@ -131,7 +131,7 @@ src_mysql("pmsi_dim", "localhost", user = user, password = password) %>%
filter(um != "") %>%
select(uf, service, service_libelle, pole, pole_libelle) %>%
distinct %>%
collect, by = "uf") %>%
collect(n = Inf), by = "uf") %>%
anti_join(rum, by="idhosp") %>% # supprimer séjours codés
arrange(idhosp, date_sortie) %>%
filter(!(service %in% c("5110", "5140", "1700", "1170", "1600", "2350")),


Loading…
Cancel
Save