Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iss397 #424

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: JP Walsh
email: [email protected]
about: Please ask and answer questions here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
name: Moibility Metric Update Issue Template
about: This template was designed as the default issue for updating and/or changing
mobility metrics.
title: Metric Update Description
labels: ''
assignees: ''

---

## Metric Update

This issue updates the \[enter mobility metric\]. Please read through the instructions below carefully. The check at the bottom of this issue should all be completed and marked off prior to creating a final PR for the metric update.

[Enter update goals - column F from the UMF_Update_Tracker]


Please review the instructions on the wiki before starting work on a metric update.

### Crosswalks

Crosswalks were updated prior to the 2024-25 metric update process. If you are editing an existing program please check that the crosswalk being used is the latest version. For more information on crosswalks, see the crosswalk page on the Wiki.

### Checklist

The checklist below outlines key steps that should be taken during the process of this metric update. These steps should all be checked off prior to finalizing the metric update.

*Setup*
- [ ] Metric lead has checked out a new branch from the Version2025 repo that is named after the number associated with this issue, i.e. iss###
- [ ] Metric lead has filled out the final data expectations from located in the functions folder of the repo and saved this form in the metrics data folder for all relevant final output files
- [ ] Metric lead has read through the existing version of the program and has located and examined the existing output files

*Program Documentation*
- [ ] The update program includes a description at the start with the date, the latest changes made and the author of the metric lead that made them
- [ ] If the program reads in raw data that is not available through an API, then the code includes a note on where this data is in Box (including the title of relevant files)
- [ ] Each step taken in the calculation is clearly documented in the code using comments
- [ ] The program is broken out into manageable steps and the code avoids using extensively long lines connected via pipes or pipe equivalents if not using R

*Quality Control*
- [ ] The program includes visuals of the distribution of key analysis variables throughout the calculation steps
- [ ] The program includes visualizations of the final data as well as summary statistic and a selection of assumptions tests (including count of rows by year, missing values and calculation of outliers (min & max) plus any additional checks deemed necessary)
- [ ] Assumption tests are applied to all years being created in the program. If a year in the historical version of the metric data is not being recreated in this program, that historical data is read in and differences with new years are visualized.
- [ ] The program includes the creation of a quality variable for the metric and documents the method for assigning quality grades

*Reproducibility*
- [ ] The program runs from start to finish without stopping due to errors or incompleteness
- [ ] The program avoids hardcoding local file paths and instead uses global paths that will work regardless of where the program is being ran (i.e. here::here() for R users)
- [ ] The program includes a “House Keeping” section which loads all necessary packages at the top of the program

*Final Data*
- [ ] The program reads out a final file in the form of a CSV document or multiple CSVs into a data folder in the relevant metric folder
- [ ] Final files include the relevant years in title if the metric has multiple files separated by year
- [ ] All final files being read out by the update program are put through the evaluate final data function

*Review*
- [ ] When ready for review the metric lead has submitted a PR to Version2025 using the PR template
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/metric_update_pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Mobility metric pull request template
Reference the issue that this PR relates to using "#" - this will pull up a list of issues to chose from.
Describe the content of this metric update - what was changed? What should the reviwer be focusing on?
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ data/temp/
*.bak

*02_housing/data/raw/
*02_housing/data/temp/
*02_housing/data/intermediate/
*04_health/data/raw
*04_health/data/intermediate
Expand Down
80 changes: 80 additions & 0 deletions 01_financial-well-being/city-debt-coll-shares-2021.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@

/************************************************
* Debt in Collections City-Level Shares *
* Data & Program Source: Financial Health & Wealth Dashboard
* State FIPS codes from US Census Bureau
* CDP FIPS codes from IPUMS
* Description: Process city-level debt in collections shares, overall and by race subgroups
[1] Prep state FIPS codes and CDP FIPS codes
[2] Import and process Urban Data Catalog file
[3] Export
************************************************/

global output "" // USER: must set output path here
assert !mi("$output")

**# [1] Prep FIPS codes -----------------------------------
* import and prep state abbreviations & FIPS codes from US Census Bureau
import delimited using "https://www2.census.gov/geo/docs/reference/state.txt", clear
tostring state, format("%02.0f") replace
keep state stusab
tempfile statefips
save `statefips', replace

* import and prep place FIPS codes from IPUMS
import excel using "https://usa.ipums.org/usa/resources/volii/large_place_PUMA2010_match_summary.xlsx", firstrow clear
ren (PlaceFIPS IPUMSCITYLabel) ///
(place_fips city)
replace city = "Gilbert, AZ" if StateName == "Arizona" & CensusPlaceName == "Gilbert town"
replace city = "Honolulu, HI" if StateName == "Hawaii" & CensusPlaceName == "Urban Honolulu CDP"
replace city = "Overland Park, KS" if StateName == "Kansas" & CensusPlaceName == "Overland Park city"
replace city = "Paradise, NV" if StateName == "Nevada" & CensusPlaceName == "Paradise CDP"
replace city = "Scottsdale, AZ" if StateName == "Arizona" & CensusPlaceName == "Scottsdale city"
replace city = "Sunrise Manor, NV" if StateName == "Nevada" & CensusPlaceName == "Sunrise Manor CDP"
drop if city == "[Not identified in any sample]"
keep place_fips city
tempfile placefips
save `placefips', replace

**# [2] Import and process Urban Data Catalog file -----------------------------------
* source: Financial Health & Wealth Dashboard
import excel using "https://urban-data-catalog.s3.amazonaws.com/drupal-root-live/2022/12/05/3_city_financial_health_metrics_b.xlsx", clear

* keep only city-level debt in collections metrics
drop if mi(B)
keep A C AH AI AJ
ren (A C AH AI AJ) ///
(city stusab share_debt_colloverall share_debt_collresidentsofcolor share_debt_collwhite)
drop if city == "city name"

* format long and adjust subgroups to match standard
reshape long share_debt_coll, i(city stusab) j(subgroup) string

replace subgroup = "All" if subgroup == "overall"
replace subgroup = "Majority Non-White" if subgroup == "residentsofcolor"
replace subgroup = "Majority White" if subgroup == "white"

gen subgroup_type = "race-ethnicity"

* create data quality fields - most 1, some 3 for missing/suppression
replace share_debt_coll = "" if share_debt_coll == "NA"
destring share_debt_coll, replace
gen share_debt_coll_quality = .
replace share_debt_coll_quality = 1 if !mi(share_debt_coll)
replace share_debt_coll_quality = 3 if mi(share_debt_coll) // suppressed or no subgroup

* merge state FIPS codes from US Census Bureau
merge m:1 stusab using `statefips', assert(2 3) keep(3) nogen
drop stusab

* merge place FIPS codes from IPUMS
merge m:1 city using `placefips', assert(2 3) keep(3) nogen

**# [3] Export -----------------------------------
gen year = 2021

compress
order year place_fips state city share_debt_coll share_debt_coll_quality subgroup_type subgroup
gsort year place_fips state city subgroup

export delimited using "$output\city-debt-coll-shares-2021.csv", datafmt replace
49 changes: 49 additions & 0 deletions 01_financial-well-being/county-debt-coll-shares-2022.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

/************************************************
* Debt in Collections County-Level Shares 2022 *
* Data & Program Source: Debt in America
* Description: Process county-level debt in collections shares, overall and by race subgroups
[1] Import and process Urban Data Catalog file
[2] Export
************************************************/

global output "" // USER: must set output path here
assert !mi("$output")

**# [1] Import and process Urban Data Catalog file -----------------------------------
* source: Debt in America
import excel using "https://urban-data-catalog.s3.amazonaws.com/drupal-root-live/2022/06/16/county_dia_delinquency_%207%20Jun%202022.xlsx", clear

* keep only debt in collections metrics
gen state = substr(B, 1, 2)
gen county = substr(B, 3, 3)
ren (D E F) ///
(share_debt_coll_all share_debt_coll_majnonwhite share_debt_coll_majwhite)
keep state county share_debt_coll*

drop if county == "OID"

* format long and adjust subgroups to match standard
reshape long share_debt_coll, i(county state) j(subgroup) string

replace subgroup = "All" if subgroup == "_all"
replace subgroup = "Majority Non-White" if subgroup == "_majnonwhite"
replace subgroup = "Majority White" if subgroup == "_majwhite"

gen subgroup_type = "race-ethnicity"

* create data quality fields - most 1, some 3 for missing/suppression
replace share_debt_coll = "" if inlist(share_debt_coll, "n/a*", "n/a**")
destring share_debt_coll, replace
gen share_debt_coll_quality = .
replace share_debt_coll_quality = 1 if !mi(share_debt_coll)
replace share_debt_coll_quality = 3 if mi(share_debt_coll) // suppressed or no subgroup

**# [2] Export -----------------------------------
gen year = 2022

compress
order year state county share_debt_coll share_debt_coll_quality subgroup_type subgroup
gsort year state county subgroup

export delimited using "$output\county-debt-coll-shares-2022.csv", datafmt replace
Loading