Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEPFAR Datapack 2025 -- national outputs #464

Merged
merged 9 commits into from
Jan 6, 2025
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: naomi
Title: Naomi Model for Subnational HIV Estimates
Version: 2.10.7
Version: 2.10.8
Authors@R:
person(given = "Jeff",
family = "Eaton",
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# naomi 2.10.7
# naomi 2.10.8

* Add national level aggregate to PEPFAR Target Setting Tool CSV.
* Remove two-year ahead projection (`*.T2`) indicators from PEPFAR Target Setting Tool output.

# naomi 2.10.7
* Add example datasets for 28 district, dropping the `District + Metro` level.
Datasets are saved in `extdata/demo-district28`.

Expand Down
16 changes: 11 additions & 5 deletions R/pepfar-datapack.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ build_datapack_output <- function(naomi_output, psnu_level, dmppt2_output) {
warning("PSNU level ", psnu_level, " not included in model outputs.")
}

## PEPFAR Target Setting Tool 2025: select both PSNU level and national aggregates
## Assume that national aggregate is level 0
datapack_output_levels <- c(0L, psnu_level)

datapack_indicator_map$calendar_quarter <- naomi_output$meta_period$calendar_quarter[datapack_indicator_map$time]

datapack_indicator_map <- datapack_indicator_map %>%
Expand Down Expand Up @@ -120,9 +124,10 @@ build_datapack_output <- function(naomi_output, psnu_level, dmppt2_output) {

dat <- indicators %>%
dplyr::rename(sex_naomi = sex) %>%
dplyr::semi_join(
dplyr::inner_join(
naomi_output$meta_area %>%
dplyr::filter(area_level == psnu_level),
dplyr::filter(area_level %in% datapack_output_levels) %>%
dplyr::select(area_id, area_level),
by = "area_id"
) %>%
dplyr::left_join(
Expand All @@ -142,6 +147,7 @@ build_datapack_output <- function(naomi_output, psnu_level, dmppt2_output) {
) %>%
dplyr::transmute(
area_id,
area_level,
indicator,
indicator_sort_order,
sex_naomi,
Expand All @@ -156,7 +162,7 @@ build_datapack_output <- function(naomi_output, psnu_level, dmppt2_output) {
dplyr::rename(age_sex_rse = rse) %>%
dplyr::left_join(
dplyr::filter(dat, age_group %in% c("Y000_999", "Y015_049")) %>%
dplyr::select(-indicator_sort_order, -age_group, -sex_naomi, -value) %>%
dplyr::select(-area_level, -indicator_sort_order, -age_group, -sex_naomi, -value) %>%
dplyr::rename(district_rse = rse),
by = c("area_id", "indicator", "calendar_quarter")
) %>%
Expand All @@ -165,7 +171,7 @@ build_datapack_output <- function(naomi_output, psnu_level, dmppt2_output) {
dplyr::select(area_name, area_id),
by = "area_id"
) %>%
dplyr::arrange(calendar_quarter, indicator_sort_order, area_id, sex_naomi, age_group)
dplyr::arrange(calendar_quarter, indicator_sort_order, area_level, area_id, sex_naomi, age_group)


dat$district_rse[is.na(dat$district_rse) & dat$indicator %in% c("circ_new", "circ_ever")] <- 0.0
Expand Down Expand Up @@ -249,7 +255,7 @@ datapack_aggregate_1to9 <- function(indicators) {


indicators_keep <- c("plhiv", "plhiv_attend", "untreated_plhiv_attend", "infections",
"population", "art_current", "art_current_residents", "aware_plhiv_num")
"population", "art_current", "art_current_residents", "aware_plhiv_num", "aware_plhiv_attend")

indicators1to9 <- indicators %>%
dplyr::filter(
Expand Down
3 changes: 0 additions & 3 deletions inst/datapack/datapack_indicator_mapping.csv
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,5 @@ incidence,Incidence_SUBNAT.Rt.T,Incidence_SUBNAT.Rt.T,,FALSE,4
infections,NEW_INFECTIONS_SUBNAT.T,NEW_INFECTIONS_SUBNAT.T,,TRUE,4
plhiv,PLHIV_Residents.T,PLHIV_Residents.T,,TRUE,4
plhiv_attend,PLHIV_Attend.T,PLHIV_Attend.T,,TRUE,4
infections,NEW_INFECTIONS_SUBNAT.T2,NEW_INFECTIONS_SUBNAT.T2,,TRUE,5
plhiv,PLHIV_Residents.T2,PLHIV_Residents.T2,,TRUE,5
plhiv_attend,PLHIV_Attend.T2,PLHIV_Attend.T2,,TRUE,5
circ_ever,ZayJeEa6pCa,VMMC_TOTALCIRC_SUBNAT.T_1,,TRUE,3
circ_new,SSun4i7nHlV,VMMC_CIRC_SUBNAT.T_1,,TRUE,3
Loading