ed_db_download: Download EIDITH data to local storage

View source: R/database.R

ed_db_downloadR Documentation

Download EIDITH data to local storage

Description

This function fetches all available tables from the EIDITH database and caches the data locally for further use with the table functions. The database persists between R sessions, so you only need to run this when you want to update data. You should also run it when updating to new versions of the eidith package.

Usage

ed_db_download(
  p2_tables = p2_api_endpoints(),
  country = NULL,
  p1_data = FALSE,
  verbose = interactive()
)

Arguments

p2_tables

which PREDICT-2 tables to download

verbose

Show messages while in progress?

Details

This function does a few things:

  • Fetches all tables from both EIDITH PREDICT-1 and PREDICT-2 databases.

  • Cleans and pre-processes the data with ed_process().

  • Stores the data in an SQLite database in your user data directory.

Each time this function is run it checks for updated metadata about database tables, then downloads each table into a temporary database and makes sure that the structure of these tables is as expected. Only well-formed tables will be copied into the user's permanent database. If a downloaded table is missing fields, has extra fields, or is otherwise corrupted, the user will receive an error message. In the future, we will allow for updating only with new and changed records.

The function will prompt for username and password unless you have cached your credentials.

See Also

ed_db_status(), ed_db_updates(), ed_db_export()


ecohealthalliance/eidith documentation built on Aug. 30, 2022, 7:45 a.m.