adjusted BMI for master files#146
Conversation
included 2001 into derived adjusted BMI (grouped)
created adjusted derived BMI variable with true height and weight values for ICES surveys
2001_m has non-grouped height and weight variables to use for HWTDCOR so do not need to include it in HWTGCOR
added in HWTDBMI_der, HWTDBMI_der_cat4, and HWTDCOR_der for master files to use continuous height and weight values
yulric
left a comment
There was a problem hiding this comment.
@caitlink12 I'm not sure what happened but it looks like the changes for the new BMI variables in the variables details sheet are not there (?). Do you mind re-adding them.
adjusting to track changes properly
updated HWTDBMI, HWTDBMI_der, HWTDCOR_der variables which use continuous height and weight measures
|
@yulric the variables were still in the sheet but the changes must not have been tracked after I had to make additional adjustments to another variables after the initial push. I've re-added them in now so they should appear as a tracked change now. |
yulric
left a comment
There was a problem hiding this comment.
I still can't see the changes in the variable details sheet on Github but that's ok, I looked at the rows within the variable details sheet. The only issue I see is that the database suffixes are inconsistent between the two sheets.
|
@yulric I've adjusted the suffixes to _m for HWTDBMI, HWTDBMI_der, HWTDCOR_der, HWTDHTM and HWTDWTK. |
Worksheet fixes (HWTDHTM rows only): - Fix HTWDVHTM typo → HWTDVHTM (4 rows in variable_details, 1 in variables) - Fix cchs_2003_m → cchs2003_m, cchs_2005_m → cchs2005_m underscore typos - Fix missing cchs prefix: 2015_2016_m → cchs2015_2016_m New R/bmi-master.R: - Self-contained Master-file BMI functions (calculate_bmi_D, adjust_bmi_D, categorize_bmi_D) that don't depend on assign_tagged_na - Referenced by variable_details.csv as Func:: entries for HWTDBMI_der, HWTDCOR_der, HWTDBMI_der_cat4
Code reviewReviewed 10 BMI variables (HWTGHTM, HWTGWTK, HWTGBMI, HWTGBMI_der, HWTGBMI_der_cat4, HWTGBMI_cat4, HWTGCOR_der, HWTDBMI_der, HWTDBMI_der_cat4, HWTDCOR_der) for PUMF and Master across 2001–2018. Issues found and fixed (68ee15d)
Issues noted but not fixed
L6 integration summaryPUMF pass-through variables (HWTGHTM, HWTGWTK) recoded successfully across all 9 cycles. PUMF derived variables blocked by pre-existing |
Add the 6-file v3 infrastructure stack for missing data handling: - file-sourcing.R (L1): robust file sourcing with here() - worksheet-loaders.R (L2B): worksheet metadata loading - worksheet-getters.R (L3): get_variable_details(), get_variables() - missing-pattern-cache.R (L4): session-level missing pattern cache - missing-data-functions.R (L5): any_missing(), get_priority_missing(), assign_missing() - clean-variables.R (L6): clean_variables(vars=, output_format=) These files provide the shared infrastructure for v3 derive functions across all variable domains (BMI, smoking, etc.).
Resolve namespace collision with new clean_variables() from R/clean-variables.R (v3 infrastructure). The old API using continuous_vars/categorical_vars params is renamed to clean_variables_legacy(). Callers in smoking.R and alcohol.R will be updated when v3-smoking merges.
Also fix is_value_in_range() and apply_else_rule() in clean-variables.R to handle the copy_mapping format (recStart/recStart_values/recEnd) from map_recStart_to_recEnd(), which was mismatched with the expected min/max and action keys.
- Add deprecated aliases: calculate_bmi_D, adjust_bmi_D, categorize_bmi_D forwarding to _master equivalents - Update variable_details.csv Func:: references from _D to _master - Add 6 alias delegation tests (76 total passing)
Replace separate PUMF (bmi.R) and Master (bmi-master.R) implementations with unified source-agnostic functions using semantic parameter names (height_m, weight_kg). Worksheet routing maps PUMF grouped variables (HWTGHTM/HWTGWTK) and Master continuous variables (HWTDHTM/HWTDWTK) to the same function parameters. - Delete bmi-master.R; consolidate into bmi.R - Rename parameters from CCHS variable names to semantic names - Update deprecated aliases (_D suffix) to point to unified functions - Add @param ... to all three BMI functions for R CMD check compliance - Update worksheets for unified function routing - Regenerate man/ pages
BMI unification: source-agnostic functionsReplaced the separate PUMF ( What changed
Design rationaleSame pattern as
Verification
|
Run fix-worksheets.R to remove unnecessary quotes per project convention.
… NA::a rows for all derived HWT variables, and eliminated redundant/incorrect HWTGBMI_cat4 variable
|
Changes manually merged to v3 via commit 3ce9a9f. Will close this PR now. |
added HTWDBMI_der (derived BMI) calculated with HTWDHTM (continuous height) HWTDWTK (continuous weight) for master files 2001-2018 into variable_details
added HWTDCOR_der (corrected BMI) calculated using HWTDHTM (continuous height) and HWTDWTK (continuous weight) for master files 2001-2018 into variable_details
added HTWDBMI_der and HWTDCOR_der along with necessary information in variables.csv