Skip to contents

Scans the datafindr cache directory within a metawoRld project, reads all valid cached JSON files (assessment, extraction, metadata), parses them, and returns them organized in a nested list.

Usage

read_all_from_cache(
  type = c("assessment", "extraction", "metadata"),
  metawoRld_path
)

Arguments

metawoRld_path

The path to the metawoRld project directory, which contains the datafindr cache subdirectory.

Value

A named list. The top-level names are the sanitized identifiers found in the cache. Each element is itself a list containing the parsed data, named by the type ("assessment", "extraction", "metadata"). Returns an empty list (list()) if the cache directory doesn't exist or no valid cache files are found.

Details

The function identifies files matching the pattern <sanitized_id>_<type>.json within the assessment, extraction, and metadata subdirectories of the datafindr cache. It attempts to parse each valid file as JSON. Files that cannot be parsed or do not match the naming convention are skipped with a warning.