Complete deidentify, tidy, and clean pipeline steps - #2
Open
aleortiz-uchicago wants to merge 1 commit into
Open
Conversation
- 2-deidentify: set PII vars (devicephonenum, gps, child_name_1-3) so they are split to the crosswalk and dropped from the working data - 3-tidy: split household vs child tables; drive the child row count from the roster (non-missing child age = 1629), not the self-reported hh_children (1631) -- the two disagree for one household and the discrepancy is left for the HFC stage, not reconciled here - 4-clean-household: define num_vars, parse date strings to %tc, attach value labels, save + export codebook; map sentinels to match the SurveyCTO form (-666 Other, -888 Refused, -999 Don't know) - main.do: add data_raw/data_tidy/data_clean/doc path globals
There was a problem hiding this comment.
Pull request overview
This PR completes the remaining stubs in the Stata pipeline so the raw SurveyCTO export can run end-to-end into de-identified, tidy, and clean datasets (plus codebooks), consistent with the repo’s “shape/format only” rule.
Changes:
- De-identification: split out direct identifiers into a PII crosswalk and drop them from the working dataset.
- Tidying: split the wide raw export into separate household- and child-level tidy tables, with child row counts driven by filled roster slots.
- Cleaning: standardize household formats (including datetime parsing), map sentinel codes to extended missing values, attach value labels, and export
iesavereports + codebooks.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| main.do | Adds data_raw/data_tidy/data_clean/doc globals used by the pipeline; also edits a user-specific path branch. |
| code/2-deidentify.do | Defines pii_vars (device phone, GPS, child names) for crosswalk + drop. |
| code/3-tidy.do | Splits household vs child units of observation; reshapes child module to long and filters to filled roster slots. |
| code/4-clean-household.do | Adds datetime parsing, correct sentinel-to-extended-missing mapping, value label attachment, and final save/codebook export. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+29
to
32
| else if c(username) == "Alejandro Ortiz" { | ||
| global box "C:/Users/username/Box/project-folder" | ||
| global github "C:/Users/username/GitHub/dil-template-repo" | ||
| global github "C:/Users/Alejandro Ortiz/Git Projects/Others/welcomeweek/a-ww-datatrack2026" | ||
| } |
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.
Fills in the remaining pipeline stubs so the raw household water survey runs end-to-end into tidy, labeled, de-identified datasets.
Changes
code/2-deidentify.dopii_vars=devicephonenum gps child_name_1 child_name_2 child_name_3so direct identifiers go to the PII crosswalk and are dropped from the working data.code/3-tidy.dohh_children(1631). The two disagree for one household (uuid:11cda278…reports 2 children, fills no roster slots). The discrepancy is preserved for the HFC stage, not reconciled — per the repo's one rule (shape/format only, never values).code/4-clean-household.donum_vars; parse date strings to%tc; attach value labels; save + export codebook.choicessheet: -666 Other, -888 Refused, -999 Don't know (previously -666/-999 were swapped).main.dodata_raw/data_tidy/data_clean/docpath globals.Notes
5-clean-child.doneeded no changes (child data has no sentinels).developbranch exists upstream, so this targetsmain.