-
Notifications
You must be signed in to change notification settings - Fork 0
Data Operations.R
rachitest edited this page May 12, 2025
·
1 revision
The data_operations.R script automates data fetching, storage, and handling operations using REDCap and DuckDB databases.
duckdbfsREDCapR
-
get_data(token):- Fetches data directly from REDCap API using provided API token. The default token is set as an environment variable (
REDCAP_API_TOKEN).
- Fetches data directly from REDCap API using provided API token. The default token is set as an environment variable (
-
save_data(directory):- Checks and creates the specified directory if it does not exist.
- Connects to DuckDB database.
- Writes the fetched REDCap data into a DuckDB database (
APS-BLtable). - Ensures database connection is safely closed after data storage.
- Data fetched from REDCap API.
- Data stored in DuckDB format in directory
assets/data/. - Messages confirm successful data writing operations.
Run this script regularly (every week) or as needed to update local datasets from REDCap.