Combine and Process Multi-Year XPATH Reports
process_xpaths.RdThe process_xpaths() function automates the full workflow of generating,
combining, and summarizing XPATH usage reports across multiple DuckDB databases.
It can process multiple tax years, merge the resulting reports, summarize
schema versions, and add derived metadata such as first/last year and
current version indicators.
Arguments
- years
Numeric vector of tax years to process.
- base_path
Character. Base path containing yearly DuckDB folders and the
xpath_reportsdirectory.- concordance
Optional data frame containing a variable
xpathfor merging. If not supplied, the merge step is skipped.- get_type
Optional function that accepts an XPATH string and returns a type label. Used to classify paths into
"HEADER"or"DATA".
Details
This function:
Iterates over a range of tax years and calls
generate_xpath_report()for each.Reads all CSV reports from the specified
xpath_reportsdirectory.Combines and aggregates XPATH occurrences across years.
Cleans and consolidates schema version lists using
combine_lists().Extracts first and last schema years and merges results with a
concordancetable if provided.
The final combined report is saved to "xpath_reports/ALL-XPATHS.csv".