A docassemble extension.
Project description
PovertyScale
Poverty scale, updated approximately on an annual basis, to use for calculating income eligibility in the United States.
Justification
https://github.com/codeforamerica/fplapi exists but requires a dedicated server, and hasn't been updated in recent years. At Suffolk we are already maintaining and consuming this information in multiple apps; it's simple for us to maintain the API alongside it.
The intent is that you will run this on your own Docassemble server, but we may maintain a public endpoint at some point. If you run your own Docassemble server, this allows you have one source of truth for both use in Docassemble interviews (without the overhead of the REST call) and for use in any non-Docassemble webapps you may have.
Update frequency
The Federal Poverty Guidelines are updated annually, but not usually published in the federal register until a month or so into a new year. We will try to closely track that update timeline. Pull requests with updated figures are welcome.
Examples
See example and demo in demo_poverty_scale.yml
This package contains a JSON file, federal_poverty_scale.json, which can be referenced directly,
as well as a module poverty.py which exports poverty_scale_income_qualifies
REST API
Once this file is installed, you can access it as a REST API with a JSON response. The following endpoints are created on your Docassemble server:
- /poverty_guidelines (same as the JSON file)
- /poverty_guidelines/household_size/ (per-household size)
- /poverty_guidelines/household_size/?state=ak|hi&multiplier=2
- /poverty_guidelines/qualifies/household_size/<household_size>?income=1000&state=AK&multiplier=1.5
You can just use the API endpoint to retrieve the contents of the JSON file, or specify a household size and optional state and multiplier to get a tailored response, with either the income limit for a given household size or a determination that someone's income is below the poverty guideline.
Income is expected to be provided on a monthly basis.
Python function signatures
def poverty_scale_income_qualifies(total_monthly_income:float, household_size:int=1, multiplier:int=1)->Union[bool,None]:
"""
Given monthly income, household size, and an optional multiplier, return whether an individual
is at or below the federal poverty level.
Returns None if the poverty level data JSON could not be loaded.
"""
def poverty_scale_get_income_limit(household_size:int=1, multiplier:int=1)->Union[int, None]:
"""
Return the income limit matching the given household size.
"""
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file docassemble.PovertyScale-2024.0.0.tar.gz
.
File metadata
- Download URL: docassemble.PovertyScale-2024.0.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a05e8afff151d70105d1452b4f7bea20ea9f2fcf30b0324cd348d1f2091a842 |
|
MD5 | d945929d970f89451ac3499ed7337736 |
|
BLAKE2b-256 | 03c76fdeb98c7f884dfaf8e27587e31680319171c55f34ba2bbe53077a70d17c |
File details
Details for the file docassemble.PovertyScale-2024.0.0-py3-none-any.whl
.
File metadata
- Download URL: docassemble.PovertyScale-2024.0.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 531cdbc40c7dd58ddad9393ead5d2c254fcdae786a3f5744dd16678fea7bfe6f |
|
MD5 | d31bd8489cbcdd7576d071a221d1f665 |
|
BLAKE2b-256 | 6e880473a7f3badd062ae3ff4a134df27d2198cfc358751981572c22f6d065e9 |