Skip to content

Commit

Permalink
added CCGcodes to downloadable template csv
Browse files Browse the repository at this point in the history
  • Loading branch information
W-Mohammed committed Apr 2, 2024
1 parent 590dc27 commit 92d94d4
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion inst/app/elements/server/inputs/expenditure.R
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,36 @@ output[["nhs_orgs"]] <- shiny::downloadHandler(
write.csv(
file = file,
x = {
inputs_rv[["expenditure_df"]] |>
# Get nhs_orgs codes:
orgs_codes_df <- UnmetNeeds::CCG_IMD_population_2019 |>
base::subset(
select = c(
grep(
pattern = "CDH",
x = colnames(CCG_IMD_population_2019)
),
grep(
pattern = "NM",
x = colnames(CCG_IMD_population_2019)
)
)
)

colnames(orgs_codes_df)[2] <- inputs_rv[["entity"]]

selected_orgs_df <- inputs_rv[["expenditure_df"]] |>
base::subset(
select = c(inputs_rv[["entity"]], "Expenditure change (%)")
)

merge(
x = orgs_codes_df,
y = selected_orgs_df,
by = inputs_rv[["entity"]],
all.x = FALSE,
all.y = TRUE
) |>
_[, c(colnames(orgs_codes_df)[1], colnames(selected_orgs_df))]
}
)
}
Expand Down

0 comments on commit 92d94d4

Please sign in to comment.