Skip to content

R Reporting - API Scripts - functions to create loops for batched import of records  #1

@sarahollis

Description

@sarahollis

To avoid API timeouts, need to adapt scripts to loop through records according to pre-defined chunk sizes.
Example below of rationale:

chunk_size = 10000
data_instance <- pull_data_func()
base_url <- "url"
chunk_num <- 0
dat_out <- data_instance

while (nrow(data_instance) == chunk_size) {

temp_url <- paste0(base_url, "$skip=chunk_num$limit=", chunk_size)
data_instance <- get(temp_url)
data_out <- bind_rows(data_out, data_instance)
chunk_num <- chunk_num + chunk_size

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions