While the {tidyndr} package focuses on generating line-list of common PEPFAR indicators and providing summaries for these, a few indicators are derived from mathematical calculation of existing indicators. These indicators include:
TX_NET_NEW
Continuity of Treatment (Retention) Proxy
Viral Load Testing Coverage
Viral Load Suppression Coverage
Duration of ARV Dispensed
library(tidyndr)
library(dplyr)
This indicator measures the increase (or decrease) in the number of clients on ART over a period of time. It is calculated by subtracting the number of active clients in a previous period from the number of active clients from the current period.
\(tx\_net\_new\ =\ tx\_curr\ current\ period - tx\_curr\ previous\ period\)
To create this in R, we will:
Import the line-list of the previous NDR data and the current NDR data.
Generate the line-list of the tx_curr
for each of the imported data.
Summarize our line-list at the desired level (“ip”, “state” or “facility”) using the summarise_ndr()
.
Subtract the value of the previous tx_curr from the current tx_curr
.
## import both previous and current NDR line-lists
<- "https://raw.githubusercontent.com/stephenbalogun/example_files/main/ndr_example.csv"
file_path
<- read_ndr(file_path,
prev_data time_stamp = "2020-12-31")
<- read_ndr(file_path,
current_data time_stamp = "2020-02-28")
## generate the tx_curr for each of the imported line-lists
<- tx_curr(prev_data)
tx_curr_prev
<- tx_curr(current_data)
tx_curr_now
## summarise the treatment currents at state level
<- summarise_ndr(tx_curr_prev,
tx_currs
tx_curr_now,level = "state",
names = c("tx_curr_prev", "tx_curr_now"))
## create a new column that calculates the tx_net_new
<- tx_currs %>%
tx_net_new mutate(tx_net_new = tx_curr_now - tx_curr_prev)
print(tx_net_new)
#> # A tibble: 4 x 5
#> ip state tx_curr_prev tx_curr_now tx_net_new
#> <chr> <chr> <int> <int> <int>
#> 1 IP_name State 1 5645 5645 0
#> 2 IP_name State 2 7929 7929 0
#> 3 IP_name State 3 13446 13446 0
#> 4 Total - 27020 27020 0
Previously called “Retention Proxy”. It measures how many of the clients who started the period of interest remained on treatment at the end of that period. It is generally calculated using two different formulas:
\(Continuity\ of\ Treatment\ Proxy\ = \frac{tx\_curr\ at\ end\ of\ reporting\ period}{tx\_curr\ at\ beginning\ of\ period\ +\ tx\_new\ during\ period}\)
or using the standard PEPFAR formula -
\(Continuity\ of\ Treatment\ Proxy\ = 1\ +\ \frac{(tx\_net\_new\ *\ 4)\ -\ (tx\_new\ *\ 4)}{[tx\_curr\ -\ tx\_net\_new\ +\ (tx\_new\ *\ 4)]}\)
To calculate the Continuity of Treatment Proxy using the second approach, we will:
continue with the summary table calculated under tx_net_new
above.
generate and summarise the new clients within the reporting period.
join the first two tables together using another {dplyr} function left_join()
.
create a new column that calculates the continuity of treatment proxy using the formula above.
## calculate the tx_new between the two periods
<- tx_new(current_data, from = "2021-01-01", to = "2021-02-28") %>%
tx_new summarise_ndr(level = "state", names = "tx_new")
## add the tx_new summary to the initial table and calculate the tx_net_new
%>%
tx_net_new left_join(tx_new, by = c("ip", "state")) %>%
mutate(cot_proxy = 1 + (
* 4) - (tx_new) * 4 ) /
((tx_net_new - tx_net_new + (tx_new * 4)))
(tx_curr_now
)#> # A tibble: 4 x 7
#> ip state tx_curr_prev tx_curr_now tx_net_new tx_new cot_proxy
#> <chr> <chr> <int> <int> <int> <int> <dbl>
#> 1 IP_name State 1 5645 5645 0 272 0.838
#> 2 IP_name State 2 7929 7929 0 300 0.869
#> 3 IP_name State 3 13446 13446 0 984 0.774
#> 4 Total - 27020 27020 0 1556 0.813
The months of ARV dispensed is sometimes disaggregated into “<3 months”, “3 - 5 months”, “6+ months”. To calculate these we execute a similar line of code as below:
<- tx_mmd(ndr_example, months = c(0, 1, 2))
less_than_three
<- tx_mmd(ndr_example, months = c(3, 4, 5))
three_to_five
<- tx_mmd(ndr_example, months = c(6:12))
six_plus
summarise_ndr(less_than_three,
three_to_five,
six_plus,level = "state",
names = c(
"< 3months",
"3-5months",
"6+ months"
))#> # A tibble: 5 x 5
#> ip state `< 3months` `3-5months` `6+ months`
#> <chr> <chr> <int> <int> <int>
#> 1 NGOHealth Okun 5 196 440
#> 2 NGOHealth Abaji 43 986 2167
#> 3 NGOHealth Arewa 54 1316 2718
#> 4 NGOHealth Ayetoro 32 821 1868
#> # ... with 1 more row