Skip to contents
Coverage
Coverage

A lightweight and robust framework for managing project data in AWS S3 using R and paws library. This package provides a clean, consistent structure for storing, reading, and exploring .rds objects in a datalake-style layout, while remaining simple for common use cases and flexible for complex ones.


πŸš€ Core Principles

  • Simple by default – 80% of entities store a single .rds file.
  • Flexible when needed – Optional tags enable organized multi-object entities.
  • Explicit control – Complex operations are always opt-in, never automatic.
  • Backward compatible – Works with existing untagged data seamlessly.

πŸ—‚οΈ S3 Folder Structure

Each project in S3 is organized into entities, which represent logical data units (e.g., data/srv_main, models/maxdiff).

Layout

# Simplest case
project/entity/.rds

# More complex case with tags
project/entity/tag1=val1/tag2=val2/.../.rds

Examples

bastion/data/srv_main/.rds
bastion/data/srv_main/wave=a/.rds
bastion/data/srv_main/wave=b/type=raw/.rds
bastion/models/maxdiff/name=final/.rds

Rules

  • Each entity + tag combination corresponds to exactly one .rds file.
  • Tags use key=value syntax, separated by /.
  • Tag keys are sorted alphabetically before writing to ensure deterministic paths.
  • Tags are case-sensitive (wave=a β‰  wave=A).
  • Tag names/values may not contain spaces or /.
  • Entities are grouped under project prefixes for scalability.

πŸ’Ύ Read / Write API

Writing

dl_write(x, "data/srv_main")
# -> project/data/srv_main/.rds

dl_write(x, "data/srv_main", wave = "a")
# -> project/data/srv_main/wave=a/.rds

dl_write(x, "data/srv_main", wave = "a", batch = "1")
# -> project/data/srv_main/wave=a/batch=1/.rds

Reading

dl_read("data/srv_main")                     # Reads untagged object

dl_read("data/srv_main", wave = "a")         # Reads wave=a object

dl_read("data/srv_main", return_type = "list") # Returns list of objects
dl_read("data/srv_main", return_type = "bind") # Binds tibbles row-wise

Behavior

  • Default return_type = "single" returns one .rds object.
  • tag = NULL filters to untagged objects only.
  • If multiple matches are found and tags aren’t specified -> error.
  • overwrite = TRUE replaces existing files.
  • S3 versioning manages historical object versions automatically.

🏷️ Tag System

  • Tags are dynamic – you can add or remove them as needed.
  • Common tags: wave, batch, type, version, etc.
  • Tags are extracted automatically into tidy columns when listing entities.

Examples:

# Two waves for same entity
bastion/data/srv_main/wave=a/.rds
bastion/data/srv_main/wave=b/.rds

πŸ“‹ Listing and Exploration

Listing Entities

dl_ls("data/srv_main")

Returns a tidy tibble with one row per stored object and one column per detected tag.

Notes:

  • Missing tag values are represented as NA.
  • Designed to work fast within a project (using prefix filters).
  • Cross-project listing is supported but slower.

βš™οΈ Concurrency and Safety

  • One writer per (entity + tag) combination assumed.
  • Writes are atomic (single PUT per .rds).
  • Temporary .tmp uploads can be used to prevent partial overwrites.

πŸ“˜ Summary of Design Decisions

Area Decision
Entity coexistence tag=NULL = untagged only; explicit tags required
Tag encoding Alphabetical, reversible, case-sensitive
Return types single (default), list, or bind
Metadata Optional, regenerable _meta.rds
Overwrites One .rds per tag folder, atomic PUT
Concurrency Single-writer assumption
Scaling Organized by project prefixes

βœ… Status

This specification is finalized and ready for implementation.

The design prioritizes stability, explicitness, and compatibility while keeping the door open for future extensions like schema validation, automatic metadata, and data contracts.