Skip to content

Commit

Permalink
Update metadata to include new input comparison indicators, export fu…
Browse files Browse the repository at this point in the history
…nction and format output
  • Loading branch information
r-ash committed Nov 5, 2024
1 parent 3793e32 commit f75a2bb
Show file tree
Hide file tree
Showing 18 changed files with 347 additions and 330 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export(hintr_prepare_comparison_report_download)
export(hintr_prepare_spectrum_download)
export(hintr_prepare_summary_report_download)
export(hintr_run_model)
export(hintr_validate_programme_data)
export(interpolate_population_agesex)
export(log_linear_interp)
export(map_outputs)
Expand All @@ -61,6 +62,7 @@ export(output_package)
export(pop_pyramid_outputs)
export(prepare_input_time_series_anc)
export(prepare_input_time_series_art)
export(prepare_spectrum_naomi_comparison)
export(prepare_tmb_inputs)
export(quarter_id_to_calendar_quarter)
export(quarter_labels)
Expand Down
15 changes: 9 additions & 6 deletions R/input-comparison.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
##' @keywords internal
prepare_art_spectrum_comparison <- function(art, shape, pjnz) {


## Check if shape is object or file path
if(!inherits(shape, "sf")) {
shape <- read_area_merged(shape) }
Expand Down Expand Up @@ -132,8 +131,7 @@ prepare_anc_spectrum_comparison <- function(anc, shape, pjnz) {
##' @param anc Path to file containing ART data or ART data object
##' @param shape Path to file containing geojson areas data or areas data object
##' @param pjnz Path to zip file containing spectrum pjnz file/s
##' @keywords internal

##' @export
prepare_spectrum_naomi_comparison <- function(art, anc, shape, pjnz){

null_df <- setNames(data.frame(matrix(ncol = 7, nrow = 0)),
Expand Down Expand Up @@ -171,7 +169,12 @@ prepare_spectrum_naomi_comparison <- function(art, anc, shape, pjnz){
comparison_df <- rbind(art_comparison, anc_comparison)
}

comparison_df

comparison_df |>
dplyr::select(indicator, area_name, year, group,
spectrum = value_spectrum, naomi = value_naomi, difference) |>
tidyr::pivot_longer(
c(spectrum, naomi, difference),
names_to = "data_source"
) |>
tidyr::drop_na(value)
}

374 changes: 188 additions & 186 deletions inst/metadata/colour_scales.csv

Large diffs are not rendered by default.

76 changes: 39 additions & 37 deletions inst/metadata/meta_indicator.csv
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
indicator,indicator_label,description,parameter,indicator_sort_order,anc_indicator,format,scale
population,t_(POPULATION),t_(INDICATOR_LABEL_POPULATION),population_out,1,FALSE,,
prevalence,t_(HIV_PREVALENCE),t_(INDICATOR_LABEL_PREVALENCE),rho_out,2,FALSE,,
plhiv,t_(PLHIV),t_(INDICATOR_LABEL_PLHIV),plhiv_out,3,FALSE,,
art_coverage,t_(ART_COVERAGE),t_(INDICATOR_LABEL_ART_COVERAGE),alpha_out,4,FALSE,,
art_current_residents,t_(ART_NUMBER_RESIDENTS),t_(INDICATOR_LABEL_ART_NUM_RESIDENTS),artnum_out,5,FALSE,,
art_current,t_(ART_NUMBER_ATTENDING),t_(INDICATOR_LABEL_ART_NUM_ATTENDING),artattend_out,6,FALSE,,
untreated_plhiv_num,t_(UNTREATED_PLHIV_NUM),t_(INDICATOR_LABEL_UNTREATED_PLHIV_NUM),untreated_plhiv_num_out,7,FALSE,,
aware_plhiv_prop,t_(AWARE_PLHIV_PROP),t_(INDICATOR_LABEL_AWARE_PLHIV_PROP),aware_plhiv_prop_out,8,FALSE,,
unaware_plhiv_num,t_(UNAWARE_PLHIV_NUM),t_(INDICATOR_LABEL_UNAWARE_PLHIV_NUM),unaware_plhiv_num_out,9,FALSE,,
aware_plhiv_num,t_(AWARE_PLHIV_NUM),t_(INDICATOR_LABEL_AWARE_PLHIV_NUM),aware_plhiv_num_out,10,FALSE,,
plhiv_attend,t_(PLHIV_ATTEND),t_(INDICATOR_LABEL_PLHIV_ATTEND),plhiv_attend_out,11,FALSE,,
untreated_plhiv_attend,t_(UNTREATED_PLHIV_ATTEND),t_(INDICATOR_LABEL_UNTREATED_PLHIV_ATTEND),untreated_plhiv_attend_out,12,FALSE,,
aware_plhiv_attend,t_(AWARE_PLHIV_ATTEND),t_(INDICATOR_LABEL_AWARE_PLHIV_ATTEND),aware_plhiv_attend_out,13,FALSE,,
unaware_plhiv_attend,t_(UNAWARE_PLHIV_ATTEND),t_(INDICATOR_LABEL_UNAWARE_PLHIV_ATTEND),unaware_plhiv_attend_out,14,FALSE,,
incidence,t_(INCIDENCE),t_(INDICATOR_LABEL_INCIDENCE),lambda_out,15,FALSE,,
infections,t_(NEW_INFECTIONS),t_(INDICATOR_LABEL_INFECTIONS),infections_out,16,FALSE,,
anc_prevalence,t_(ANC_HIV_PREVALENCE),t_(INDICATOR_LABEL_ANC_PREVALENCE),anc_rho_out,17,TRUE,,
anc_art_coverage,t_(ANC_PRIOR_ART_COVERAGE),t_(INDICATOR_LABEL_ANC_ART_COVERAGE),anc_alpha_out,18,TRUE,,
anc_clients,t_(ANC_CLIENTS),t_(INDICATOR_LABEL_ANC_CLIENTS),anc_clients_out,19,TRUE,,
anc_plhiv,t_(ANC_PLHIV),t_(INDICATOR_LABEL_ANC_PLHIV),anc_plhiv_out,20,TRUE,,
anc_already_art,t_(ANC_ALREADY_ART),t_(INDICATOR_LABEL_ANC_ALREADY_ART),anc_already_art_out,21,TRUE,,
anc_art_new,t_(ANC_ART_NEW),t_(INDICATOR_LABEL_ANC_ART_NEW),anc_art_new_out,22,TRUE,,
anc_known_pos,t_(ANC_KNOWN_POS),t_(INDICATOR_LABEL_ANC_KNOWN_POS),anc_known_pos_out,23,TRUE,,
anc_tested_pos,t_(ANC_TESTED_POS),t_(INDICATOR_LABEL_ANC_TESTED_POS),anc_tested_pos_out,24,TRUE,,
anc_tested_neg,t_(ANC_TESTED_NEG),t_(INDICATOR_LABEL_ANC_TESTED_NEG),anc_tested_neg_out,25,TRUE,,
population_ratio,t_(POPULATION_RATIO),,,26,FALSE,,
plhiv_ratio,t_(PLHIV_RATIO),,,27,FALSE,,
infections_ratio,t_(NEW_INFECTIONS_RATIO),,,28,FALSE,,
art_current_ratio,t_(ART_NUMBER_ATTENDING_RATIO),,,29,FALSE,,
unaware_plhiv_num_ratio,t_(UNAWARE_PLHIV_NUM_RATIO),,,30,FALSE,,
prevalence_ratio,t_(HIV_PREVALENCE_RATIO),,,31,FALSE,,
art_coverage_ratio,t_(ART_COVERAGE_RATIO),,,32,FALSE,,
aware_plhiv_prop_ratio,t_(AWARE_PLHIV_PROP_RATIO),,,33,FALSE,,
incidence_ratio,t_(INCIDENCE_RATIO),,,34,FALSE,,
anc_prevalence_age_matched,t_(ANC_PREVALENCE_AGE_MATCHED),,,35,TRUE,,
anc_art_coverage_age_matched,t_(ANC_ART_COVERAGE_AGE_MATCHED),,,36,TRUE,,
indicator,indicator_label,description,parameter,indicator_sort_order,anc_indicator,format,scale
population,t_(POPULATION),t_(INDICATOR_LABEL_POPULATION),population_out,1,FALSE,,
prevalence,t_(HIV_PREVALENCE),t_(INDICATOR_LABEL_PREVALENCE),rho_out,2,FALSE,,
plhiv,t_(PLHIV),t_(INDICATOR_LABEL_PLHIV),plhiv_out,3,FALSE,,
art_coverage,t_(ART_COVERAGE),t_(INDICATOR_LABEL_ART_COVERAGE),alpha_out,4,FALSE,,
art_current_residents,t_(ART_NUMBER_RESIDENTS),t_(INDICATOR_LABEL_ART_NUM_RESIDENTS),artnum_out,5,FALSE,,
art_current,t_(ART_NUMBER_ATTENDING),t_(INDICATOR_LABEL_ART_NUM_ATTENDING),artattend_out,6,FALSE,,
untreated_plhiv_num,t_(UNTREATED_PLHIV_NUM),t_(INDICATOR_LABEL_UNTREATED_PLHIV_NUM),untreated_plhiv_num_out,7,FALSE,,
aware_plhiv_prop,t_(AWARE_PLHIV_PROP),t_(INDICATOR_LABEL_AWARE_PLHIV_PROP),aware_plhiv_prop_out,8,FALSE,,
unaware_plhiv_num,t_(UNAWARE_PLHIV_NUM),t_(INDICATOR_LABEL_UNAWARE_PLHIV_NUM),unaware_plhiv_num_out,9,FALSE,,
aware_plhiv_num,t_(AWARE_PLHIV_NUM),t_(INDICATOR_LABEL_AWARE_PLHIV_NUM),aware_plhiv_num_out,10,FALSE,,
plhiv_attend,t_(PLHIV_ATTEND),t_(INDICATOR_LABEL_PLHIV_ATTEND),plhiv_attend_out,11,FALSE,,
untreated_plhiv_attend,t_(UNTREATED_PLHIV_ATTEND),t_(INDICATOR_LABEL_UNTREATED_PLHIV_ATTEND),untreated_plhiv_attend_out,12,FALSE,,
aware_plhiv_attend,t_(AWARE_PLHIV_ATTEND),t_(INDICATOR_LABEL_AWARE_PLHIV_ATTEND),aware_plhiv_attend_out,13,FALSE,,
unaware_plhiv_attend,t_(UNAWARE_PLHIV_ATTEND),t_(INDICATOR_LABEL_UNAWARE_PLHIV_ATTEND),unaware_plhiv_attend_out,14,FALSE,,
incidence,t_(INCIDENCE),t_(INDICATOR_LABEL_INCIDENCE),lambda_out,15,FALSE,,
infections,t_(NEW_INFECTIONS),t_(INDICATOR_LABEL_INFECTIONS),infections_out,16,FALSE,,
anc_prevalence,t_(ANC_HIV_PREVALENCE),t_(INDICATOR_LABEL_ANC_PREVALENCE),anc_rho_out,17,TRUE,,
anc_art_coverage,t_(ANC_PRIOR_ART_COVERAGE),t_(INDICATOR_LABEL_ANC_ART_COVERAGE),anc_alpha_out,18,TRUE,,
anc_clients,t_(ANC_CLIENTS),t_(INDICATOR_LABEL_ANC_CLIENTS),anc_clients_out,19,TRUE,,
anc_plhiv,t_(ANC_PLHIV),t_(INDICATOR_LABEL_ANC_PLHIV),anc_plhiv_out,20,TRUE,,
anc_already_art,t_(ANC_ALREADY_ART),t_(INDICATOR_LABEL_ANC_ALREADY_ART),anc_already_art_out,21,TRUE,,
anc_art_new,t_(ANC_ART_NEW),t_(INDICATOR_LABEL_ANC_ART_NEW),anc_art_new_out,22,TRUE,,
anc_known_pos,t_(ANC_KNOWN_POS),t_(INDICATOR_LABEL_ANC_KNOWN_POS),anc_known_pos_out,23,TRUE,,
anc_tested_pos,t_(ANC_TESTED_POS),t_(INDICATOR_LABEL_ANC_TESTED_POS),anc_tested_pos_out,24,TRUE,,
anc_tested_neg,t_(ANC_TESTED_NEG),t_(INDICATOR_LABEL_ANC_TESTED_NEG),anc_tested_neg_out,25,TRUE,,
population_ratio,t_(POPULATION_RATIO),,,26,FALSE,,
plhiv_ratio,t_(PLHIV_RATIO),,,27,FALSE,,
infections_ratio,t_(NEW_INFECTIONS_RATIO),,,28,FALSE,,
art_current_ratio,t_(ART_NUMBER_ATTENDING_RATIO),,,29,FALSE,,
unaware_plhiv_num_ratio,t_(UNAWARE_PLHIV_NUM_RATIO),,,30,FALSE,,
prevalence_ratio,t_(HIV_PREVALENCE_RATIO),,,31,FALSE,,
art_coverage_ratio,t_(ART_COVERAGE_RATIO),,,32,FALSE,,
aware_plhiv_prop_ratio,t_(AWARE_PLHIV_PROP_RATIO),,,33,FALSE,,
incidence_ratio,t_(INCIDENCE_RATIO),,,34,FALSE,,
anc_prevalence_age_matched,t_(ANC_PREVALENCE_AGE_MATCHED),,,35,TRUE,,
anc_art_coverage_age_matched,t_(ANC_ART_COVERAGE_AGE_MATCHED),,,36,TRUE,,
number_on_art,t_(NUMBER_ON_ART),t_(NUMBER_ON_ART_DESC),,37,TRUE,,
anc_tested,t_(ANC_TESTED),t_(ANC_TESTED_DESC),,38,TRUE,,
6 changes: 6 additions & 0 deletions inst/metadata/metadata.csv
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,9 @@ comparison,barchart,art_coverage,mean,lower,upper,indicator,art_coverage,t_(ART_
comparison,barchart,art_current,mean,lower,upper,indicator,art_current,t_(ART_NUMBER_ATTENDING),1,100,"""0,0"""
comparison,barchart,anc_prevalence_age_matched,mean,lower,upper,indicator,anc_prevalence_age_matched,t_(ANC_PREVALENCE_AGE_MATCHED),1,,"""0.0%"""
comparison,barchart,anc_art_coverage_age_matched,mean,lower,upper,indicator,anc_art_coverage_age_matched,t_(ANC_ART_COVERAGE_AGE_MATCHED),1,,"""0.0%"""
input_comparison,barchart,number_on_art,value,,,,number_on_art,t_(NUMBER_ON_ART),1,,"""0,0"""
input_comparison,barchart,anc_already_art,value,,,,anc_already_art,t_(ANC_ALREADY_ART),1,10,"""0,0"""
input_comparison,barchart,anc_clients,value,,,,anc_clients,t_(ANC_CLIENTS),1,10,"""0,0"""
input_comparison,barchart,anc_known_pos,value,,,,anc_known_pos,t_(ANC_KNOWN_POS),1,10,"""0,0"""
input_comparison,barchart,anc_tested,value,,,,anc_tested,t_(ANC_TESTED),1,10,"""0,0"""
input_comparison,barchart,anc_tested_pos,value,,,,anc_tested_pos,t_(ANC_TESTED_POS),1,10,"""0,0"""
4 changes: 3 additions & 1 deletion inst/traduire/en-translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,7 @@
"DOWNLOAD_OUTPUT_DESCRIPTION": "Naomi output uploaded from Naomi web app",
"DOWNLOAD_SUMMARY_DESCRIPTION": "Naomi summary report uploaded from Naomi web app",
"DOWNLOAD_COMPARISON_DESCRIPTION": "Naomi comparison report uploaded from Naomi web app",
"DOWNLOAD_AGYW_DESCRIPTION": "Naomi AGYW tool uploaded from Naomi web app"
"DOWNLOAD_AGYW_DESCRIPTION": "Naomi AGYW tool uploaded from Naomi web app",
"NUMBER_ON_ART": "Number on ART",
"NUMBER_ON_ART_DESC": "Number on ART description"
}
4 changes: 3 additions & 1 deletion inst/traduire/fr-translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,7 @@
"BIRTHS_FACILITY_DESC": "Nombre de naissances dans les établissements de santé",
"DOWNLOAD_OUTPUT_DESCRIPTION": "Paquet Naomi téléchargée depuis l'application web Naomi",
"DOWNLOAD_SUMMARY_DESCRIPTION": "Rapport de synthèse Naomi téléchargé depuis l'application web Naomi",
"DOWNLOAD_COMPARISON_DESCRIPTION": "Rapport de comparaison Naomi téléchargé à partir de l'application web Naomi"
"DOWNLOAD_COMPARISON_DESCRIPTION": "Rapport de comparaison Naomi téléchargé à partir de l'application web Naomi",
"NUMBER_ON_ART": "Nombre de personnes sous TARV",
"NUMBER_ON_ART_DESC": "Number on ART description"
}
4 changes: 3 additions & 1 deletion inst/traduire/pt-translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,7 @@
"BIRTHS_FACILITY_DESC": "Número de nascimentos em estabelecimentos de saúde",
"DOWNLOAD_OUTPUT_DESCRIPTION": "Pacote Naomi descarregado a partir da aplicação web Naomi",
"DOWNLOAD_SUMMARY_DESCRIPTION": "Relatório de síntese da Naomi carregado da aplicação web Naomi",
"DOWNLOAD_COMPARISON_DESCRIPTION": "Relatório de comparação Naomi carregado a partir da aplicação web Naomi"
"DOWNLOAD_COMPARISON_DESCRIPTION": "Relatório de comparação Naomi carregado a partir da aplicação web Naomi",
"NUMBER_ON_ART": "Nombre de personnes sous TARV",
"NUMBER_ON_ART_DESC": "Number on ART description"
}
19 changes: 0 additions & 19 deletions man/anc_spectrum_warning.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/art_spectrum_warning.Rd

This file was deleted.

22 changes: 0 additions & 22 deletions man/format_spectrum_total_warning.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/hintr_validate_anc.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/hintr_validate_art.Rd

This file was deleted.

17 changes: 17 additions & 0 deletions man/hintr_validate_programme_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions man/prepare_anc_spectrum_comparison.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/prepare_art_spectrum_comparison.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions man/prepare_spectrum_naomi_comparison.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions man/programme_data_warning.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f75a2bb

Please sign in to comment.