Skip to content

Commit

Permalink
Push init version
Browse files Browse the repository at this point in the history
  • Loading branch information
tvroylandt committed Jun 4, 2024
1 parent 4072304 commit f412dfe
Show file tree
Hide file tree
Showing 26 changed files with 31,840 additions and 112 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
data/
/.quarto/
*.html
main_files/
.venv/
.vscode/
74 changes: 74 additions & 0 deletions R/export_data_ojs.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# ---------------- #
# OJS file from ISD
# ---------------- #

library(tidyverse)

# Import ------------------------------------------------------------------
df_isd_assemble <-
read_rds(here::here("../../clients/drees/drees_isd/data/isd_assemble.rds"))

# Cleaning ----------------------------------------------------------------
# national value
df_isd_filter_ojs_nat <- df_isd_assemble |>
mutate(value = round(value, 2)) |>
filter(niv_geo %in% c("fr_ent") &
annee >= 2009 &
is_isd == TRUE &
isd %in% c("C22", "C23", "C24")) |>
select(-is_isd, -niv_geo, -code_geo) |>
rename(value_nat = value)

# build diff with national value
df_isd_filter_ojs <- df_isd_assemble |>
mutate(
value = round(value, 1),
value = if_else(
annee == 2022 &
code_geo == "972" &
indicator == "part_accouch_20_24",
16.8,
value
)
) |>
filter(niv_geo %in% c("dep") &
annee >= 2009 &
is_isd == TRUE &
isd %in% c("C22", "C23", "C24")) |>
select(-is_isd, -niv_geo) |>
left_join(df_isd_filter_ojs_nat, by = join_by(annee, isd, indicator)) |>
mutate(
diff = value - value_nat,
indicator = fct_recode(
indicator,
"Before 28 weeks" = "tx_tr_gde_prema_av28sa",
"Before 32 weeks" = "tx_gde_prema_av32sa",
"Before 37 weeks" = "tx_prema_av37sa",
"Less than 1.5kg" = "part_nais_moins_1500g",
"Less than 2.5kg" = "part_nais_moins_2500g",
"Under 20 years old" = "part_accouch_m20",
"20-24 years old" = "part_accouch_20_24",
"25-29 years old" = "part_accouch_25_29",
"30-34 years old" = "part_accouch_30_34",
"35-39 years old" = "part_accouch_35_39",
"40 years old and above" = "part_accouch_40p"
),
isd = fct_recode(
isd,
"Premature births by week of amenorrhea" = "C22",
"Births according to child weight" = "C23",
"Births according to mother age" = "C24"
)
)

# grid OJS
facet_data <- geofacet::fr_departements_grid1 |>
as_tibble() |>
left_join(df_isd_filter_ojs |>
filter(annee == 2022), by = join_by(code == code_geo))

# Export ------------------------------------------------------------------
# only init version that need transpose
ojs_define(data_init = df_isd_filter_ojs)

ojs_define(data_grid_init = facet_data)
44 changes: 44 additions & 0 deletions custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*-- scss:defaults --*/


/*-- scss:rules --*/
h1, h2, h3, h4, h5, h6 {
text-shadow: -1px -1px 0 rgba(0, 0, 0, .3);
}

/* style value boxes */
.quarto-dashboard .bslib-value-box .value-box-value {
font-size: clamp(.1em, 8cqw, 4em) !important;
}

.quarto-dashboard .bslib-value-box .value-box-title {
display: none;
}

.quarto-dashboard .bslib-value-box .value-box-showcase .bi {
font-size: clamp(.1em,max(8cqw,3.2cqh),4em) !important;
}

/* sidebar note */
.sidebar-note{
position: absolute;
bottom: 0;
color: grey;
font-size: 9pt;
}

.sidebar-note > p > a {
color: grey;
}

.sidebar-note-right{
position: absolute;
right: 0;
color: grey;
font-size: 9pt;
max-width: 3cm;
}

.sidebar-note-right > p > a {
color: grey;
}
1,022 changes: 1,022 additions & 0 deletions main.html

Large diffs are not rendered by default.

Loading

0 comments on commit f412dfe

Please sign in to comment.