Skip to content

Add AMI and FMR data from HUD#2450

Closed
shahzorkhan123 wants to merge 2 commits intoPolicyEngine:mainfrom
shahzorkhan123:master
Closed

Add AMI and FMR data from HUD#2450
shahzorkhan123 wants to merge 2 commits intoPolicyEngine:mainfrom
shahzorkhan123:master

Conversation

@shahzorkhan123
Copy link
Copy Markdown

@shahzorkhan123 shahzorkhan123 commented Jun 12, 2023

🤖 Generated by Copilot at 7c7aaf1

Summary

🏠📊💵

This pull request adds the HUDUSER dataset and the HUD income limits and free market rent variables to the policyengine-us package. It creates the policyengine_us.data.datasets.huduser package, which contains the modules for generating and loading the HUDUSER data from the HUD website. It also creates the policyengine_us.variables.gov.hud package, which contains the modules for defining the HUD-related variables based on the HUDUSER data and the household FIPS code.

HUDUSER dataset
Adding variables and rent
Autumn leaves fall fast

Walkthrough

  • Create and load the HUDUSER dataset from the HUD website (link, link, link)
    • Import the raw_huduser and huduser modules from the policyengine_us.data.datasets.huduser package (link)
    • Define the HUDUSER class that inherits from the PublicDataset class and generates the HUDUSER dataset from the raw HUDUSER data (link)
    • Define the RawHUDUSER class that inherits from the PublicDataset class and generates the raw HUDUSER data from the HUD website (link)
  • Define the variables for the free market rent and the income limits based on the HUD data and the FIPS code of the household (link, link)
    • Define the FMR_0_bedroom, FMR_1_bedroom, FMR_2_bedroom, FMR_3_bedroom, and FMR_4_bedroom variables that inherit from the Variable class and calculate the free market rent for different bedroom sizes (link)
    • Define the HUDIncomeLimits variable that inherits from the Variable class and calculates the HUD income limits for ELI, LI, and VLI for different household sizes (link)


class HUDUSER(PublicDataset):
name = "huduser"
is_openfisca_compatible = True
Copy link
Copy Markdown
Author

@shahzorkhan123 shahzorkhan123 Jun 12, 2023

Choose a reason for hiding this comment

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

@nikhilwoodruff does this mean all the columns need to match variable/parameter names?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

discussed, will change to false

# Load HUD data for FMR values (Update the path to the CSV file as needed)
hud_data = pd.read_csv("path_to/FMR_data.csv")

class FMR_0_bedroom(Variable):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

discussed with @MaxGhenis ,
variable - fmr(input household, spmunit) etc.
variable ami (input spmunit/?)

should I map all data columns to parameter names then?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No, I think we're fine loading from data.

@MaxGhenis MaxGhenis changed the title [DRAFT] initial changes for HUD User data. Add AMI and FMR data from HUD Jun 12, 2023
@MaxGhenis MaxGhenis marked this pull request as draft June 12, 2023 17:17
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We could combine these into one variable hud_free_market_rent

Copy link
Copy Markdown
Collaborator

@nikhilwoodruff nikhilwoodruff left a comment

Choose a reason for hiding this comment

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

So, the full process:

  • Take a household
  • Look up min(num bedrooms, num people) in the FMR table for the local area FIPS
    ...

# Load HUD data for FMR values (Update the path to the CSV file as needed)
hud_data = pd.read_csv("path_to/FMR_data.csv")

class FMR_0_bedroom(Variable):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No, I think we're fine loading from data.

RawHUDUSER.generate(year)

raw_data = RawHUDUSER.load(year)
huduser_data = h5py.File(HUDUSER.file(year), mode="w")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Discussed, no need to convert to H5, use csv/xls instead.

@nikhilwoodruff nikhilwoodruff force-pushed the master branch 2 times, most recently from 7926ec9 to d2543dc Compare July 12, 2025 15:13
@MaxGhenis
Copy link
Copy Markdown
Contributor

Closing: very old stale PR. If still relevant, please open a fresh PR against current master.

@MaxGhenis MaxGhenis closed this Feb 23, 2026
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.

3 participants