sleep#161
Conversation
updated master survey cycle suffix from _i to _m
SLPG01_A and SLPG01_C had same variable categories so these surveys were merged into SLPG01_A. Master survey cycles added to SLPG01_cont.
added master survey cycles from 2001 and 2015-2016 into SLPG01_cont
SLPG01_A and SLPG01_C had same variable categories so these surveys were merged into SLPG01_A.
added master survey cycles from 2001 and 2015-2016 into SLPG01_cont
added SLPG01_cont values for 2011-2012 and 2013-2014 master survey cycles.
There was a problem hiding this comment.
The PR correctly adds Master file cycles. Passes all tests, including integration testing.
Sleeping variables are optional content, which means the availability varies from cycle to cycle and from province to province.
This PR changes:
- Adds Master file cycles (2001, 2011-2012, 2013-2014, 2015-2016) to sleep variables
- Creates SLPG01_B for Master cycles 2011-2014
- Correctly maps source variables across eras
Key findings
Optional content warning: Sleep module was Optional Content from 2007-2018. Provincial availability varies by cycle - not all provinces have sleep data in all cycles. Added description notes to all 11 sleep variables to alert users.
Scale incompatibility:
- 2001 uses 3-point scale (Most/Sometimes/Never) with inverted direction (lower = worse)
- 2007+ uses 5-point scale (None to All) where higher = worse
- Correctly handled via
_Asuffix variables for 2001
Cycles without sleep data (Canada-wide PUMF):
- 2003, 2005, 2009-2010 - correctly excluded from worksheets
Verification
- ✓ Variable naming evolution verified across all eras
- ✓ Missing cycles correctly excluded
- ✓ Scale incompatibility handled with separate
_Avariables - ✓ Added optional content notes to variables.csv
Documentation
Full review documentation: https://dmanuel.quarto.pub/cep-005-sleep-variables
Notes
Added notes about data availability
Add documentation for PR #161 sleep variable review: - CEP-005 review documents with PUMF availability analysis - Integration tests for rec_with_table() validation - Scale incompatibility documentation (2001 vs 2007+) Add description notes to 11 sleep variables in variables.csv: - Sleep module was Optional Content from 2007-2018 - Provincial availability varies by cycle - 2001 uses incompatible 3-point scale with inverted direction Worksheets verified correct - no fixes required.
Removed exports for functions that don't exist: - assess_binge_drinking - assess_drinking_risk_long - assess_drinking_risk_short - categorize_bmi These exports were causing R CMD check to fail with "undefined exports" errors.
Code reviewReviewed 10 sleep variables (SLP_02, SLP_02_A, SLP_03, SLP_03_A, SLP_04, SLP_04_A, SLPG01, SLPG01_A, SLPG01_B, SLPG01_cont) for PUMF and Master across 2001 through 2017-2018. Note: This PR was previously approved (2026-01-27) but 2 commits were pushed after approval, triggering a re-review. L6 integration test: cross-cycle prevalence
Master ( Issues found3 PR-introduced issues. 6 pre-existing issues noted but not blocking. PR-introduced:
Pre-existing (not blocking, for information):
GHA statusR-CMD-check failed with 2 ERRORs and 6 WARNINGs. These appear to be pre-existing package-level issues (undefined exports, parse errors) not caused by the sleep worksheet changes. The NAMESPACE commit (7cb75eb) partially addressed this but issues remain. CheckedEra boundary defaults, databaseStart consistency (variables.csv vs variable_details.csv), PUMF vs Master naming, deprecated CEP: |
1. SLP_04 else row: add cchs2011_2012_m, cchs2013_2014_m, cchs2015_2016_m (Master dbs were missing from catch-all row) 2. variables.csv: add missing _m databases for SLP_04, SLP_04_A, SLPG01_A, SLPG01_cont to match variable_details.csv 3. cchs2012_s -> cchs2012_m in SLP_02, SLP_03, SLP_04 (deprecated _s suffix replaced in both files)
|
All 3 PR-introduced issues from the review have been fixed in daaec8b:
Ready to merge. @rafidoole for final checks. |
…renamed all SLPG01 variants
rafdoodle
left a comment
There was a problem hiding this comment.
Final SLP Variable Changes
Overview
| Action | Variable | Notes |
|---|---|---|
| Renamed | SLP_02_A → SLP_02_cat3 |
Name now reflects recoding type |
| Renamed | SLP_03_A → SLP_03_cat3 |
Name now reflects recoding type |
| Renamed | SLP_04_A → SLP_04_cat3 |
Name now reflects recoding type |
| Renamed | SLPG01 → SLPG01_pre2015 |
Scoped to pre-2015 PUMF cycles |
| Renamed | SLPG01_A → SLPG01_cat12 |
Name now reflects 12-category scale |
| Added | SLPG01_2015plus |
New variable for 2015+ PUMF cycles |
| Deleted | SLPG01_B |
Superseded by SLPG01_pre2015 |
| Deleted | SLPG01_C |
Orphan variable (no rows in variable_details.csv); removed |
| Modified | SLP_02, SLP_03, SLP_04 |
databaseStart/variableStart expanded |
| Modified | SLPG01_cont |
databaseStart/variableStart expanded; label fixes |
variables.csv changes
| Variable | Field | Before | After |
|---|---|---|---|
SLP_02 |
databaseStart |
PUMF cycles only | Added master file cycles |
SLP_03 |
databaseStart |
PUMF cycles only | Added master file cycles |
SLP_04 |
databaseStart |
PUMF cycles only | Added master file cycles |
SLPG01_pre2015 (was SLPG01) |
databaseStart |
All cycles | Pre-2015 PUMF cycles only |
SLPG01_cat12 (was SLPG01_A) |
databaseStart |
2015+ cycles | All cycles including cchs2001_p/m via GENA_03 |
SLPG01_cont |
databaseStart |
Subset of cycles | Expanded to full set of supported cycles |
SLPG01_2015plus |
— | (did not exist) | New; covers 2015+ PUMF cycles, 11-category scale |
SLPG01_B |
— | Present | Deleted |
SLPG01_C |
— | Present | Deleted (orphan — no corresponding rows in variable_details.csv) |
variable_details.csv changes
Renames & dummyVariable fixes
| Variable | Rows | dummyVariable pattern — Before |
dummyVariable pattern — After |
|---|---|---|---|
SLP_02_cat3 (was SLP_02_A) |
6 | SLP_02_A_cat3_* |
SLP_02_cat3_* |
SLP_03_cat3 (was SLP_03_A) |
6 | SLP_03_A_cat3_* |
SLP_03_cat3_* |
SLP_04_cat3 (was SLP_04_A) |
6 | SLP_04_A_cat3_* |
SLP_04_cat3_* |
SLPG01_pre2015 (was SLPG01) |
14 | SLPG01_cat11_* |
SLPG01_pre2015_cat11_* |
SLPG01_cat12 (was SLPG01_A) |
15 | SLPG01_A_cat12_* |
SLPG01_cat12_cat12_* |
New rows added
| Variable | Rows | Description |
|---|---|---|
SLPG01_2015plus |
14 | 11-category structure mirroring SLPG01_pre2015; covers cchs2015_2016_p and cchs2017_2018_p via [SLPG005] |
Rows deleted
| Variable | Rows | Reason |
|---|---|---|
SLPG01_B |
14 | Superseded by SLPG01_pre2015 |
SLPG01_C |
0 | Orphan variable; existed only in variables.csv with no recoding rows |
SLPG01_cont block 3 |
14 | Duplicate master-file recoding block; removed |
databaseStart / variableStart updates
| Variable | Change |
|---|---|
SLP_02, SLP_03, SLP_04 |
Updated to match expanded variables.csv cycles |
SLPG01_pre2015 |
Set to pre-2015 PUMF cycles |
SLPG01_cat12 |
Set to all supported cycles including cchs2001_p/m |
SLPG01_cont block 1 |
Updated to match SLPG01_cat12 cycles |
Label corrections
| Variable | Field | Before | After |
|---|---|---|---|
SLPG01_pre2015, recStart = 1 |
catLabel, catLabelLong, catStartLabel |
<3 hours |
<2 hours |
SLPG01_cont block 1, all 12 category rows |
catLabel |
Hours |
Proper hour ranges (e.g., <2 hours, 2-<3 hours, …, >= 12 hours) |
SLPG01_cont block 2, recStart = 1 |
catLabel |
<3 hours |
<2 hours |
SLP_03 NA rows |
dummyVariable |
SLP_03_cat3_NA |
SLP_03_cat5_NA |
|
Changed manually merged to v3 via commit 699dbff. Will close this PR now. |
sleep variables SLP_02, SLP_02_A, SLP_03, SLP_03_A, SLP_04, SLP_04_A, SLPG01_A, SLPG01_B, SLPG01_cont were harmonized into the variable and variable_details sheets for master survey cycles 2001, 2011-2012, 2013-2014, and 2015-2016.
master survey cycles 2011-2012, 2013-2014, and 2015-2016 were added to existing variables SLP_02, SLP_3, SLP_04.
master survey cycle 2001 was added to existing variables SLP_02_A, SLP_03_A, SLP_04_A.
master survey cycles 2001 and 2015-2016 were added to existing variable SLPG01_A
SLPG01_B was created for master survey cycles 2011-2012 and 2013-2014
master survey cycles 2001, 2011-2012, 2013-2014, and 2015-2016 were added to existing variable SLPG01_cont