Conversation
…only) as a result
…aster continuous SDCDRES and not PUMF cateogircal SDCGRES
Code reviewReviewed 7 variables (DHH_AGE, SDCGCB, SDCGCBG, SDCDRES, SDCGRES, pct_time_der, pct_time_der_A) for PUMF and Master across 2001-2018. L6 integration test: cross-cycle prevalence (PUMF)
Master ( Issues found6 issues (4 PR-introduced, 2 pre-existing/informational):
cchsflow/R/percent-time-canada.R Lines 78 to 118 in 5b89547 Checked: era boundary defaults, databaseStart consistency, PUMF/Master naming, pre-2007 cycle letters, known error patterns, DV specifications, unit tests, and PUMF integration. CEP: Generated with Claude Code |
|
DHH_AGE has maintained the same name since 2007-2008. Isn't it supposed to be |
… boundaries; created Rd for pct_time_fun_A
…put bounds validation
Replaced pct_time_fun() and pct_time_fun_A() with calculate_pct_time(age,
born_in_canada, years_in_canada) using case_when for vectorised logic.
Renamed pct_time_fun_cat() to categorize_pct_time(). Moved PUMF midpoints
from R code to worksheet via new SDCGRES_cont intermediate variable.
Merged pct_time_der and pct_time_der_A into single pct_time_der with
separate PUMF and master row sets. Added [0,100] output bounds validation
with out-of-range values returning tagged_na("b"). 28 tests passing.
CEP-008 review artifacts included.
Code review — update after refactoring (2c4c9d1)Reviewed 5 in-scope variables (SDCGRES_cont, pct_time_der, pct_time_der_cat10, SDCDRES, SDCGCB) for PUMF and Master across 2001-2018. Full review details in Summary of changes since last reviewAll 6 issues from the original review are resolved:
Key refactoring in latest commit
L6 integration and testsL6 PUMF integration ( 28/28 unit tests pass. Master mappings validated by worksheet checks only (no PUMF runtime data for Issues found in this review passNo new issues. All L3-L5 checks pass (era boundaries, databaseStart consistency, naming conventions, error patterns, DV spec). Pre-existing issues (18 check_worksheet errors in variable_details.csv column ordering and row sorting) confirmed on v3 target branch — not introduced by this PR. Checked: era boundary defaults, databaseStart consistency, PUMF/Master naming, pre-2007 cycle letters, known error patterns, DV specification, unit tests, PUMF integration, output bounds validation. CEP: |
…pct_time functions
Hello Doug and Caitlin,
Here is a new v3 PR for percent time in Canada, following up form PR #149.
In this PR, I added the following new variables:
I also created a new function in
R/percent-time-canada.Rcalled pct_time_fun_A, which takes in the two above variables and DHH_AGE to calculate % time in Canada in the Master data.residency/age * 100with the Master's continuous SDCDRES, unlikeresidency midpoint/age * 100when using the PUMF's categorical SDCGRES.tests/testthat/test-immigarion.R.databaseStartandvariableStarthad to be updated to only _m and _s data in the worksheets forrec_with_table()to work which it did.Please let me know what you think.
Thanks,
Rafidul