mrc-ide / naomi

Naomi model for subnational HIV estimation
https://mrc-ide.github.io/naomi
Other
9 stars 9 forks source link

add function to read Spectrum KP table #410

Closed jeffeaton closed 9 months ago

jeffeaton commented 1 year ago

This PR adds a function to read the key population summary data saved in the Spectrum Program Statistics tab for key populations.

It reads the KP data saved in the below Spectrum visualization. It does not include the "remaining population" bars (which are calculated separately in Spectrum and not saved with the KP workbook summaries). Those can be calculated from the other Spectrum results read from the PJNZ.

image

Here is an example of what the output currently is, using Malawi 2023 Spectrum file as an example:

> pjnz <- "~/Downloads/Malawi_2023_National_HIV_estimates_Spectrum_AIM_model.pjnz"
> dp <- naomi:::read_dp(pjnz)
> naomi:::read_dp_keypop_summary(dp)
     key_population year population_size hiv_prevalence art_coverage infections
Data            FSW 2021           39004          0.499        0.910       1460
X               MSM 2021           35391          0.128        0.925        151
X.1              TG 2021            8369          0.270        0.000         72
X.2            PWID 2021            4876          0.138        0.000         21
                       workbook_file
Data MWI_workbook_OS_2022_03_28.xlsx
X    MWI_workbook_OS_2022_03_28.xlsx
X.1  MWI_workbook_OS_2022_03_28.xlsx
X.2  MWI_workbook_OS_2022_03_28.xlsx

If no KP workbook was uploaded, the table will return with all NA values.

It will be useful to know exactly what is needed for Oli / Katie scaling to figure out what further processing of this will be needed and where to insert in Naomi workflow.

vimc-robot commented 1 year ago

Thanks. Corresponding hintr PR at https://github.com/mrc-ide/hintr/pull/473

rtesra commented 9 months ago

Closed and pulled into https://github.com/mrc-ide/naomi/pull/426 in this commit

rtesra commented 9 months ago

Closed and pulled into https://github.com/mrc-ide/naomi/pull/426 in this commit