{
  "name": "data_load",
  "title": "Load Data from Catalog",
  "category": "Data Management",
  "slug": "data-load",
  "description": "Load datasets defined in your data catalog (settings/data.yml). Supports\nCSV and RDS formats with automatic integrity verification, encryption,\nand caching.\n",
  "usage": "data_load(name, verify_hash = TRUE, cache = TRUE)",
  "params": [
    {
      "name": "name",
      "type": "character",
      "required": true,
      "description": "Name of the dataset as defined in settings/data.yml (supports dot-notation like \"source.private.my_data\")"
    },
    {
      "name": "verify_hash",
      "type": "logical",
      "default": true,
      "description": "Verify file integrity against stored hash from framework.db"
    },
    {
      "name": "cache",
      "type": "logical",
      "default": true,
      "description": "Cache the loaded data in memory for faster subsequent access"
    }
  ],
  "returns": "The loaded dataset as a data.frame or tibble. Encrypted files are automatically\ndecrypted if sodium package is available.\n",
  "details": "data_load() uses your data catalog to load datasets with the following features:\n\n**Catalog-based loading:**\n- Define datasets once in settings/data.yml\n- Specify path, type (csv/rds), encryption status\n- Use dot-notation for nested organization\n\n**Integrity verification:**\n- Computes file hash and compares to stored value\n- Warns if file has changed since last registration\n- Updates hash in framework.db on load\n\n**Encryption support:**\n- Automatically decrypts .enc files using sodium\n- Requires encryption key in .env file\n- Transparent to user (just works)\n\n**Performance:**\n- In-memory caching for repeated access\n- Smart cache invalidation on file changes\n",
  "examples": [
    {
      "code": "# Load a simple dataset\ndf <- data_load(\"example\")\n",
      "description": "Load dataset named \"example\" from catalog"
    },
    {
      "code": "# Load with dot-notation (nested in catalog)\nprivate_data <- data_load(\"source.private.patient_data\")\n",
      "description": "Load from nested catalog path"
    },
    {
      "code": "# Skip hash verification (faster, less safe)\ndf <- data_load(\"example\", verify_hash = FALSE)\n",
      "description": "Skip integrity check for performance"
    },
    {
      "code": "# Force fresh load (bypass cache)\ndf <- data_load(\"example\", cache = FALSE)\n",
      "description": "Disable caching to force reload from disk"
    }
  ],
  "related": ["data_save", "data_list", "data_encrypt"],
  "see_also": [
    {
      "name": "data_save",
      "description": "Save data to catalog with integrity tracking"
    },
    {
      "name": "data_list",
      "description": "List all datasets in catalog"
    },
    {
      "name": "configure_data",
      "description": "Configure data catalog interactively"
    }
  ],
  "tags": ["data", "loading", "catalog", "encryption", "integrity"],
  "notes": ["Encrypted files require sodium package and KEY in .env", "Hash verification uses digest package (MD5 by default)", "Catalog location defaults to settings/data.yml", "Use data_list() to see all available datasets"]
}
