Word Health Organization (WHO) Tuberculosis budgets by country

See source for description of the data. tb_dictionary describes the column names.
health
Author

DS 150

Published

February 20, 2024

Data details

There are 1,290 rows and 43 columns. The data source1 is used to create our data that is stored in our pins table. You can access this pin from a connection to posit.byui.edu using hathawayj/tb_budget.

This data is available to all.

Variable description

See source for description of the data. tb_dictionary describes the column names.

Variable summary

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
year 0 1.00 2020.50 1.71 2018 2019.00 2020.5 2022.00 2023 ▇▃▃▃▃
tx_dstb 614 0.52 69659.09 250892.78 16 2552.50 8802.5 31644.75 3000000 ▇▁▁▁▁
budget_cpp_dstb 645 0.50 643.59 8635.77 0 33.00 47.0 72.00 174700 ▇▁▁▁▁
tx_mdr 617 0.52 1766.65 6371.22 0 43.00 167.0 675.00 71000 ▇▁▁▁▁
budget_cpp_mdr 648 0.50 4087.16 20505.60 0 962.50 1515.5 2831.00 400000 ▇▁▁▁▁
tx_xdr 688 0.47 198.16 1000.63 0 1.00 5.0 30.00 13200 ▇▁▁▁▁
budget_cpp_xdr 741 0.43 6125.09 13783.66 0 970.00 3344.0 6240.00 250000 ▇▁▁▁▁
tx_tpt 872 0.32 68161.05 271817.86 0 1177.75 4550.0 22528.75 3500000 ▇▁▁▁▁
budget_cpp_tpt 891 0.31 237.49 2326.16 0 8.00 15.0 29.00 30000 ▇▁▁▁▁
budget_lab 662 0.49 9753336.58 30274893.51 0 419989.75 1398003.0 4697217.00 287300684 ▇▁▁▁▁
cf_lab 664 0.49 5662121.99 18667786.67 0 279175.00 984900.5 3100110.50 239009924 ▇▁▁▁▁
budget_staff 669 0.48 16133799.93 91399124.17 0 306430.00 1244338.0 4898652.00 1016896387 ▇▁▁▁▁
cf_staff 673 0.48 15338436.84 91692628.81 0 249608.00 900928.0 3372957.00 1016896387 ▇▁▁▁▁
budget_fld 657 0.49 3225941.60 9197844.49 0 157322.00 575775.0 1970800.00 90000000 ▇▁▁▁▁
cf_fld 664 0.49 2735294.62 8658203.44 0 128596.25 475993.0 1812809.50 90000000 ▇▁▁▁▁
budget_prog 683 0.47 11503133.05 34976133.31 0 320990.50 1526216.0 6807424.00 353362319 ▇▁▁▁▁
cf_prog 682 0.47 8437994.65 32178089.36 0 229563.50 1010580.5 4318173.75 353362319 ▇▁▁▁▁
budget_sld 657 0.49 6377437.99 29096104.66 0 96480.00 456546.0 2491043.00 364076775 ▇▁▁▁▁
cf_sld 665 0.48 4867070.36 21601200.36 0 78856.00 356324.0 1900000.00 254853742 ▇▁▁▁▁
budget_mdrmgt 694 0.46 4040832.74 12347460.85 0 45000.00 249092.0 1749693.00 108058436 ▇▁▁▁▁
cf_mdrmgt 696 0.46 2550534.59 8189149.25 0 29867.25 147968.5 899503.75 67149396 ▇▁▁▁▁
budget_tpt 902 0.30 1274569.95 3909679.43 0 16514.75 88049.0 509261.50 55313515 ▇▁▁▁▁
cf_tpt 912 0.29 1004737.42 3698650.32 0 10000.00 63460.0 397142.25 55313515 ▇▁▁▁▁
budget_tbhiv 695 0.46 1227351.12 3281124.71 0 14836.00 90000.0 750680.00 43045687 ▇▁▁▁▁
cf_tbhiv 702 0.46 620341.79 1620830.09 0 5516.50 47565.5 300000.00 14726090 ▇▁▁▁▁
budget_patsup 689 0.47 2930739.96 11546584.54 0 58600.00 270053.0 1066416.00 131025560 ▇▁▁▁▁
cf_patsup 695 0.46 1837182.07 10343200.90 0 31572.50 144700.0 538306.50 131025560 ▇▁▁▁▁
budget_orsrvy 706 0.45 772642.13 2495889.42 0 23173.50 122415.5 405471.25 34300650 ▇▁▁▁▁
cf_orsrvy 716 0.44 505748.70 2334186.53 0 0.00 55969.0 225536.75 34300650 ▇▁▁▁▁
budget_oth 740 0.43 5798620.23 33611694.20 0 0.00 206263.0 1865642.75 361729048 ▇▁▁▁▁
cf_oth 739 0.43 5138565.11 33308657.39 0 0.00 120686.0 1058771.00 361729048 ▇▁▁▁▁
budget_tot 461 0.64 48172575.87 161890091.34 0 1200100.00 6386754.0 26598888.00 1640128115 ▇▁▁▁▁
cf_tot 641 0.50 45249860.97 169860396.11 614 1842735.00 6901734.0 20500000.00 1640128115 ▇▁▁▁▁
cf_tot_domestic 675 0.48 37523610.87 170402450.84 0 463717.50 2216505.0 9921721.00 1639947864 ▇▁▁▁▁
cf_tot_gf 679 0.47 7719559.97 15388933.04 0 634157.00 2420250.0 6366140.50 159648385 ▇▁▁▁▁
cf_tot_usaid 803 0.38 2152336.05 4978170.38 0 0.00 0.0 547413.50 25000000 ▇▁▁▁▁
cf_tot_grnt 767 0.41 1004398.25 3254798.59 0 0.00 45429.0 602155.50 40000000 ▇▁▁▁▁
cf_tot_sources 637 0.51 44972679.59 169375409.49 0 1821321.00 6828768.0 20390000.00 1640128115 ▇▁▁▁▁

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
country 0 1 4 56 0 215 0
iso2 6 1 2 2 0 214 0
iso3 0 1 3 3 0 215 0
iso_numeric 0 1 3 3 0 215 0
g_whoregion 0 1 3 3 0 6 0
Explore generating code using R
library(tidyverse)
library(pins)
library(connectapi)

tb_budget <- read_csv("https://extranet.who.int/tme/generateCSV.asp?ds=budget")

# Publish the data to the server with Bro. Hathaway as the owner.
board <- board_connect()
pin_write(board, tb_budget, type = "parquet")

pin_name <- "tb_budget"
meta <- pin_meta(board, paste0("hathawayj/", pin_name))
client <- connect()
my_app <- content_item(client, meta$local$content_id)
set_vanity_url(my_app, paste0("data/", pin_name))

Access data

This data is available to all.

Direct Download: tb_budget.parquet

R and Python Download:

URL Connections:

For public data, any user can connect and read the data using pins::board_connect_url() in R.

library(pins)
url_data <- "https://posit.byui.edu/data/tb_budget/"
board_url <- board_connect_url(c("dat" = url_data))
dat <- pin_read(board_url, "dat")

Use this custom function in Python to have the data in a Pandas DataFrame.

import pandas as pd
import requests
from io import BytesIO

def read_url_pin(name):
  url = "https://posit.byui.edu/data/" + name + "/" + name + ".parquet"
  response = requests.get(url)
  if response.status_code == 200:
    parquet_content = BytesIO(response.content)
    pandas_dataframe = pd.read_parquet(parquet_content)
    return pandas_dataframe
  else:
    print(f"Failed to retrieve data. Status code: {response.status_code}")
    return None

# Example usage:
pandas_df = read_url_pin("tb_budget")

Authenticated Connection:

Our connect server is https://posit.byui.edu which you assign to your CONNECT_SERVER environment variable. You must create an API key and store it in your environment under CONNECT_API_KEY.

Read more about environment variables and the pins package to understand how these environment variables are stored and accessed in R and Python with pins.

library(pins)
board <- board_connect(auth = "auto")
dat <- pin_read(board, "hathawayj/tb_budget")
import os
from pins import board_rsconnect
from dotenv import load_dotenv
load_dotenv()
API_KEY = os.getenv('CONNECT_API_KEY')
SERVER = os.getenv('CONNECT_SERVER')

board = board_rsconnect(server_url=SERVER, api_key=API_KEY)
dat = board.pin_read("hathawayj/tb_budget")