Skip to contents

This function downloads survey landings data from Kobotoolbox for multiple assets, processes them into a tidy format, and uploads the processed data to a MongoDB database. The function logs the progress at various stages. Configuration parameters such as the URL, asset IDs, usernames, and passwords are read from a configuration file using read_config().

Usage

ingest_landings(log_threshold = logger::DEBUG)

Arguments

log_threshold

The (standard Apache log4j) log level used as a threshold for the logging infrastructure. See logger::log_levels for more details. Default is logger::DEBUG.

Value

This function performs side effects (downloads data, processes it, and uploads to MongoDB) and does not return a value.

Details

The function performs the following steps:

  1. Sets the logging threshold to the specified level.

  2. Reads configuration parameters using read_config().

  3. Sets up a parallel processing plan using future::plan().

  4. Downloads and processes data for each asset ID using process_asset().

  5. Renames specific columns for consistency across different forms.

  6. Uploads the processed data to a MongoDB collection using mdb_collection_push().

Examples

if (FALSE) { # \dontrun{
# Define asset information
asset_info <- dplyr::tibble(
  asset_id = c("asset1", "asset2"),
  form_name = c("Form A", "Form B")
)

# Ingest survey lnadings
ingest_landings()
} # }