Skip to content

Complete deidentify, tidy, and clean pipeline steps - #2

Open
aleortiz-uchicago wants to merge 1 commit into
DevInnovationLab:mainfrom
aleortiz-uchicago:Alejandro/data_session
Open

Complete deidentify, tidy, and clean pipeline steps#2
aleortiz-uchicago wants to merge 1 commit into
DevInnovationLab:mainfrom
aleortiz-uchicago:Alejandro/data_session

Conversation

@aleortiz-uchicago

Copy link
Copy Markdown

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.do

  • Set pii_vars = devicephonenum gps child_name_1 child_name_2 child_name_3 so direct identifiers go to the PII crosswalk and are dropped from the working data.

code/3-tidy.do

  • Split the wide file into household- and child-level tidy tables.
  • Child row count is driven by the roster (non-missing child age = 1629), not the self-reported hh_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.do

  • Define num_vars; parse date strings to %tc; attach value labels; save + export codebook.
  • Fix sentinel mapping to match the SurveyCTO form's choices sheet: -666 Other, -888 Refused, -999 Don't know (previously -666/-999 were swapped).

main.do

  • Add data_raw / data_tidy / data_clean / doc path globals.

Notes

  • 5-clean-child.do needed no changes (child data has no sentinels).
  • No develop branch exists upstream, so this targets main.

- 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
Copilot AI review requested due to automatic review settings July 22, 2026 22:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 iesave reports + 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 thread main.do
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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants