write_derived: skip metadata regeneration unless csv/spec-list actually change#255
Open
andersone1 wants to merge 38 commits intomainfrom
Open
write_derived: skip metadata regeneration unless csv/spec-list actually change#255andersone1 wants to merge 38 commits intomainfrom
andersone1 wants to merge 38 commits intomainfrom
Conversation
…ly change
- Always write the output CSV and `spec-list.yml`.
- Determine `.needs_update` from old vs new MD5 of:
- `.file` (CSV)
- `<meta>/spec-list.yml`
`.needs_update` is TRUE in these cases:
1. CSV did not exist before this call.
2. `spec-list.yml` did not exist before this call.
3. CSV content changed.
4. `spec-list.yml` content changed.
When `.needs_update` is TRUE:
- regenerate XPT
- rerender define output
- run diff generation only if `base_df` exists and `.execute_diffs` is TRUE
- write `diffs.csv` only if generated diffs are non-empty (no delete/overwrite when empty)
- as a result, `diffs.csv` reflects the most recent run that produced at least one diff
When `.needs_update` is FALSE:
- skip XPT and define regeneration
- skip diff generation (even if `.prev_file` changes)
- keep any existing `diffs.csv` unchanged (no delete/overwrite)
tests:
- assert `diffs.csv` is not created when no diffs are found
- assert XPT is not rewritten when rerunning with unchanged CSV/spec-list
- assert existing `diffs.csv` is preserved (mtime unchanged) when no new diffs are generated
- assert diff generation is skipped when `.needs_update` is FALSE
…leanup - write human-readable latest-data-diff.txt (timestamp/user header + same diff rows) - keep skip-if-unchanged behavior intact - if metadata contains legacy diffs.csv, show clear cli warning and recreate folder - update docs and tests for new output + backward-compatibility migration
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.
📝 Summary
xptanddefinedocuments are now only regenerated when the.csvorspec-listcontent actually changes (md5-based check), avoiding noisy version-control diffs from embedded timestamps.execute_spec_diffs()function detects added, removed, and updated spec variables/fields alongside the existing data diffs.diffs.csvartifact with a human-readablediff-summary.txtthat includes SVN author/revision/date metadata, structured into Data Changes and Spec Changes sections.1020 (+5)) instead of descriptive strings. Variable-level diffs are also separated from standard summary rows (Rows, Columns, Subjects).diffs.csvbefore regenerating.get_base_df(),diffdf_value_changes_to_df(),get_sdtm_lookup(), and the bundledsdtm-lookup.yamldata file.stringrwithtidyselectfor the comma check (now usesgreplwithfixed = TRUEfor speed); addedfsas a dependency.📂 New Files
R/get-svn-baseline.Rget_base_df()— retrieves baseline from SVN with author/rev/date metadata, supports arbitrary file readers.R/execute-spec-diffs.Rspec-listobjects and summarizes changes.R/build-run-summary-lines.R🧪 Test Coverage
test-write-derived-scenarios.R(693 lines) covering end-to-end scenarios forwrite_derived().get_svn_baseline(),execute_spec_diffs(), andbuild_run_summary_lines().get_base_df,diffdf_value_changes_to_df).+1,201/-119lines in tests.