Skip to content

Phase 4: analytics, cleanup, and cheatsheet#2

Merged
PrigasG merged 1 commit into
masterfrom
claude/charming-chatelet
Apr 11, 2026
Merged

Phase 4: analytics, cleanup, and cheatsheet#2
PrigasG merged 1 commit into
masterfrom
claude/charming-chatelet

Conversation

@PrigasG
Copy link
Copy Markdown
Owner

@PrigasG PrigasG commented Apr 11, 2026

New functions (R/analytics.R):

  • twb_calc_complexity(): classify calcs as lod/table_calc/aggregate/raw, extract lod_type (fixed/include/exclude), compute dep_depth (longest calc-on-calc chain via DP on dependency DAG), n_deps token count
  • twb_field_usage(): cross-workbook field x sheet matrix; long or wide form; context = shelf:rows / shelf:color / filter / etc.
  • twb_replication_brief(): assembles all 11 intelligence sections into a named list or formatted text; dashboard-scoped; include_sql / include_formulas

All three wired into TwbParser as get_*() methods and active bindings.

Consistency fixes:

  • twb_custom_sql(), twb_initial_sql(), twb_published_refs() now accept a TwbParser OR an xml2 document (via .twb_resolve_xml); full roxygen docs added
  • .normalize_token() in dependency_graph.R: fixed strsplit(".?") -> "." (was splitting field names into individual characters, breaking dep_depth)
  • unname() applied to .dep_depths() vapply result to prevent named vector propagating into tibble columns

Testing:

  • tests/testthat/test-analytics.R: 30 new assertions covering LOD/table_calc/ aggregate/raw classification, dep_depth chain lengths (0/1/2), field_usage long/wide/scoped forms, replication_brief structure and format="text"

Cheatsheet:

  • inst/cheatsheet/twbparser-cheatsheet.tex: 3-column landscape LaTeX cheatsheet covering all 44 exported functions with signatures and runnable examples

R CMD check: 0 errors | 0 warnings | 0 notes

New functions (R/analytics.R):
- twb_calc_complexity(): classify calcs as lod/table_calc/aggregate/raw,
  extract lod_type (fixed/include/exclude), compute dep_depth (longest
  calc-on-calc chain via DP on dependency DAG), n_deps token count
- twb_field_usage(): cross-workbook field x sheet matrix; long or wide form;
  context = shelf:rows / shelf:color / filter / etc.
- twb_replication_brief(): assembles all 11 intelligence sections into a
  named list or formatted text; dashboard-scoped; include_sql / include_formulas

All three wired into TwbParser as get_*() methods and active bindings.

Consistency fixes:
- twb_custom_sql(), twb_initial_sql(), twb_published_refs() now accept a
  TwbParser OR an xml2 document (via .twb_resolve_xml); full roxygen docs added
- .normalize_token() in dependency_graph.R: fixed strsplit("\.?") -> "\."
  (was splitting field names into individual characters, breaking dep_depth)
- unname() applied to .dep_depths() vapply result to prevent named vector
  propagating into tibble columns

Testing:
- tests/testthat/test-analytics.R: 30 new assertions covering LOD/table_calc/
  aggregate/raw classification, dep_depth chain lengths (0/1/2), field_usage
  long/wide/scoped forms, replication_brief structure and format="text"

Cheatsheet:
- inst/cheatsheet/twbparser-cheatsheet.tex: 3-column landscape LaTeX cheatsheet
  covering all 44 exported functions with signatures and runnable examples

R CMD check: 0 errors | 0 warnings | 0 notes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@PrigasG PrigasG merged commit 9c67502 into master Apr 11, 2026
6 checks passed
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 93.16239% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
R/analytics.R 93.54% 20 Missing ⚠️
R/published.R 63.63% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants