Fix attribute ordering in as_case_data() to match test snapshots#200
Merged
sschildhauer merged 3 commits intocopilot/fix-as-case-data-bugfrom Apr 22, 2026
Merged
Fix attribute ordering in as_case_data() to match test snapshots#200sschildhauer merged 3 commits intocopilot/fix-as-case-data-bugfrom
as_case_data() to match test snapshots#200sschildhauer merged 3 commits intocopilot/fix-as-case-data-bugfrom
Conversation
Agent-Logs-Url: https://github.com/ucdavis/serodynamics/sessions/ce1c3fd2-e323-4169-841a-7d54771bad76 Co-authored-by: sschildhauer <165851188+sschildhauer@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ucdavis/serodynamics/sessions/ce1c3fd2-e323-4169-841a-7d54771bad76 Co-authored-by: sschildhauer <165851188+sschildhauer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix bug in as_case_data to ensure tests pass
Fix attribute ordering in Apr 21, 2026
as_case_data() to match test snapshots
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.
When input
dataalready carries custom attributes (e.g. output ofsim_case_data()),tibble::as_tibble()reorders the attribute list and pushesclassto the end. The test snapshot expectsclassto precede the custom attributes (id_var,biomarker_var,timeindays,value_var), causing consistent snapshot failures.Changes
classfirst viaclass(result) <- union("case_data", class(data))to anchor it in the correct positionid_var(viaserocalculator::set_id_var()), thenbiomarker_var,timeindays,value_varThis replaces the previous
structure()call at the end of the pipe, which could not override attribute positions already established byas_tibble().