Word Health Organization (WHO) Tuberculosis expenditures and utilization 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 46 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_utilization.

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 2019.50 1.71 2017 2018.00 2019.5 2021.00 2022 ▇▃▃▃▃
exp_cpp_dstb 678 0.47 21219.12 508182.72 0 33.00 48.5 75.00 12569725 ▇▁▁▁▁
exp_cpp_mdr 682 0.47 14215.41 274754.33 0 969.75 1603.0 2845.50 6772522 ▇▁▁▁▁
exp_cpp_xdr 753 0.42 4611.15 7389.34 0 0.00 2795.0 5550.00 60000 ▇▁▁▁▁
exp_cpp_tpt 920 0.29 3942.90 70527.40 0 6.00 15.0 29.00 1355915 ▇▁▁▁▁
exp_lab 702 0.46 3573537.98 10985483.53 0 208282.50 879741.5 2502682.50 180483721 ▇▁▁▁▁
rcvd_lab 697 0.46 3860201.18 11339133.03 0 236483.00 949664.0 2620168.00 181076092 ▇▁▁▁▁
exp_staff 701 0.46 15034094.85 93384505.21 0 229476.00 952178.0 3300000.00 1016896387 ▇▁▁▁▁
rcvd_staff 699 0.46 15054035.53 93223978.48 0 248187.50 990000.0 3332827.50 1016896387 ▇▁▁▁▁
exp_fld 684 0.47 2564671.10 7640814.64 0 112871.25 416199.0 1569555.00 66929665 ▇▁▁▁▁
rcvd_fld 682 0.47 2677060.57 7688010.89 0 129443.75 470803.0 1701426.00 66929665 ▇▁▁▁▁
exp_prog 720 0.44 6828636.18 28374938.58 0 157377.25 720462.5 3005581.50 278830435 ▇▁▁▁▁
rcvd_prog 715 0.45 7070253.99 28366451.76 0 191444.00 818992.0 3551684.00 278830435 ▇▁▁▁▁
exp_sld 694 0.46 4207231.19 20813750.22 0 46315.50 223525.0 1219858.50 254853742 ▇▁▁▁▁
rcvd_sld 690 0.47 4308761.64 20756867.61 0 54998.00 275190.5 1320881.50 254853742 ▇▁▁▁▁
exp_mdrmgt 727 0.44 2292846.08 7575005.41 0 25000.00 100000.0 711067.00 67311806 ▇▁▁▁▁
rcvd_mdrmgt 722 0.44 2376884.61 7643832.78 0 28734.00 120512.5 770000.00 68529630 ▇▁▁▁▁
exp_tpt 948 0.27 467010.01 1445188.26 0 2412.75 32683.5 166657.25 14716050 ▇▁▁▁▁
rcvd_tpt 947 0.27 490297.42 1453107.16 0 4120.00 40526.0 189760.00 14716050 ▇▁▁▁▁
exp_tbhiv 729 0.43 491772.41 1637700.63 0 4359.00 33120.0 215273.00 26557836 ▇▁▁▁▁
rcvd_tbhiv 727 0.44 520546.94 1651500.47 0 6000.00 44907.0 255469.50 26557836 ▇▁▁▁▁
exp_patsup 724 0.44 1237104.69 6721632.56 0 22805.25 110947.5 391249.50 93289514 ▇▁▁▁▁
rcvd_patsup 718 0.44 1334060.44 6769765.64 0 29087.00 152514.0 473476.50 93289514 ▇▁▁▁▁
exp_orsrvy 745 0.42 428983.59 2095964.02 0 0.00 24632.0 167800.00 26287324 ▇▁▁▁▁
rcvd_orsrvy 740 0.43 475733.03 2237618.49 0 0.00 40741.0 180538.50 30224531 ▇▁▁▁▁
exp_oth 753 0.42 5298490.61 34017791.43 0 0.00 153519.0 1188150.00 361729048 ▇▁▁▁▁
rcvd_oth 753 0.42 5419602.09 34027474.28 0 0.00 187380.0 1317994.00 361729048 ▇▁▁▁▁
exp_tot 488 0.62 32556100.01 145123578.26 0 818711.50 3740606.0 15135836.25 1640128115 ▇▁▁▁▁
rcvd_tot 664 0.49 40272703.85 163321764.08 0 1733300.25 6507484.5 18342278.25 1640128115 ▇▁▁▁▁
rcvd_tot_domestic 706 0.45 33716022.50 166314046.66 0 416443.50 2076509.0 8468765.25 1639947864 ▇▁▁▁▁
rcvd_tot_gf 700 0.46 7283515.91 16721471.53 0 670387.00 2322866.0 6407967.75 199434217 ▇▁▁▁▁
rcvd_tot_usaid 833 0.35 1706664.67 3905154.83 0 0.00 0.0 603520.00 22000000 ▇▁▁▁▁
rcvd_tot_grnt 795 0.38 895626.93 3039710.36 0 0.00 47872.0 690256.00 55761662 ▇▁▁▁▁
rcvd_tot_sources 660 0.49 40017004.15 162833102.45 0 1724026.50 6422911.0 18269741.00 1640128115 ▇▁▁▁▁
hcfvisit_dstb 294 0.77 70.51 410.30 0 8.00 24.0 78.25 12532 ▇▁▁▁▁
hcfvisit_mdr 349 0.73 168.03 215.78 0 15.00 64.0 270.00 2700 ▇▁▁▁▁
hospd_dstb_prct 279 0.78 38.42 35.79 0 5.00 25.0 73.00 100 ▇▂▂▂▂
hospd_mdr_prct 304 0.76 59.78 41.09 0 15.00 80.0 100.00 100 ▅▂▁▂▇
hospd_dstb_dur 291 0.77 23.07 23.90 0 10.00 15.0 30.00 404 ▇▁▁▁▁
hospd_mdr_dur 341 0.74 75.94 76.44 0 20.00 60.0 120.00 720 ▇▁▁▁▁
hosp_type_mdr 174 0.87 125.82 44.00 2 141.00 142.0 142.00 142 ▁▁▁▁▇

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_utilization <- read_csv("https://extranet.who.int/tme/generateCSV.asp?ds=expenditure_utilisation")


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

pin_name <- "tb_utilization"
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_utilization.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_utilization/"
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_utilization")

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_utilization")
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_utilization")