Helper
ASCIIColors
Bases: StrEnum
ASCII colors for use in printing colored text to the terminal.
Source code in src\backend\helper.py
df_to_file(df)
Write a DataFrame to a unique file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
the DataFrame to write |
required |
Source code in src\backend\helper.py
is_valid_zipcode(zip)
Check if the given ZIP code is valid based on a local file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zip |
int
|
the ZIP code to check |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
if ZIP code is valid |
Source code in src\backend\helper.py
metro_name_to_zip_code_list(msa_name)
Return the constituent ZIP codes for the given Metropolitan Statistical Area.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msa_name |
str
|
name of the Metropolitan Statistical Area |
required |
Returns:
Type | Description |
---|---|
list[int]
|
list[int]: list of ZIP codes found. Is empty if MSA name is invalid |
Source code in src\backend\helper.py
req_get_to_file(request)
Write the contents of a request response to a unique file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request |
Response
|
the request |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
the status code of the request |
Source code in src\backend\helper.py
state_city_to_zip_df(state, city)
Take in a state and city and return the ZIP code constituents of that city.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state |
str
|
the state |
required |
city |
str
|
the city |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
pl.DataFrame: DataFrame of ZIP codes |
Source code in src\backend\helper.py
state_county_to_zip_df(state, county)
Take in a state and county and return the ZIP code constituents of that county.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state |
str
|
the state |
required |
county |
str
|
the county |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
pl.DataFrame: DataFrame of ZIP codes |
Source code in src\backend\helper.py
zip_to_metro(zip)
Find the Metropolitan Statistical Area name for the specified ZIP code.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
zip |
int
|
the ZIP code to look up |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the Metropolitan name. Is empty if the ZIP code is not a part of a Metropolitan Statistical Area |