Phase 4: analytics, cleanup, and cheatsheet#2
Merged
Conversation
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>
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New functions (R/analytics.R):
All three wired into TwbParser as get_*() methods and active bindings.
Consistency fixes:
Testing:
Cheatsheet:
R CMD check: 0 errors | 0 warnings | 0 notes