Skip to content
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
2 changes: 2 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ About the Author
( -.-)o I am a lovely Rabbit!
o_(")(")

Original author:

**Sanhe Hu** is a very active **Python Developer** Since 2010. Research area includes **Machine Learning, Big Data Infrastructure, Block Chain, Business Intelligent, AWS, Distributive System**. Love photography, outdoor, arts, game, and also the best `Python <https://www.python.org/>`_.

- My Github: https://github.com/MacHu-GWU
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ atomicwrites
fuzzywuzzy
haversine>=2.5.0
SQLAlchemy>=2.0.30
sqlalchemy_mate>=2.0.0.1
sqlalchemy-mate>=2.0.0.1
botocore
15 changes: 8 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
from setuptools import setup, find_packages

# --- import your package ---
import uszipcode as package
import zipcode3 as package

if __name__ == "__main__":
# --- Automatically generate setup parameters ---
# Your package name
PKG_NAME = package.__name__
PKG_NAME = "zipcode3"

# Your GitHub user name
try:
GITHUB_USERNAME = package.__github_username__
GITHUB_USERNAME = "EricSchles"
except:
GITHUB_USERNAME = "Unknown-Github-Username"

Expand All @@ -45,22 +45,22 @@

# Author and Maintainer
try:
AUTHOR = package.__author__
AUTHOR = "EricSchles"
except:
AUTHOR = "Unknown"

try:
AUTHOR_EMAIL = package.__author_email__
AUTHOR_EMAIL = "ericschles@gmail.com"
except:
AUTHOR_EMAIL = None

try:
MAINTAINER = package.__maintainer__
MAINTAINER = "EricSchles"
except:
MAINTAINER = "Unknown"

try:
MAINTAINER_EMAIL = package.__maintainer_email__
MAINTAINER_EMAIL = "ericschles@gmail.com"
except:
MAINTAINER_EMAIL = None

Expand Down Expand Up @@ -239,6 +239,7 @@ def read_requirements_file(path):
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
]
"""
12 changes: 6 additions & 6 deletions uszipcode/__init__.py → zipcode3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
"2020 census data and geometry information."
)
__license__ = "MIT"
__author__ = "Sanhe Hu"
__author_email__ = "husanhe@gmail.com"
__maintainer__ = "Sanhe Hu"
__maintainer_email__ = "husanhe@gmail.com"
__github_username__ = "MacHu-GWU"
__author__ = "Eric Schles"
__author_email__ = "ericschles@gmail.com"
__maintainer__ = "Eric Schles"
__maintainer_email__ = "ericschles@gmail.com"
__github_username__ = "EricSchles"

try:
from .search import (
Expand All @@ -25,4 +25,4 @@
except ImportError as e: # pragma: no cover
print(e)
except: # pragma: no cover
raise
raise
2 changes: 1 addition & 1 deletion uszipcode/_version.py → zipcode3/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.0.1"
__version__ = "1.0.2"

if __name__ == "__main__": # pragma: no cover
print(__version__)
2 changes: 1 addition & 1 deletion uszipcode/db.py → zipcode3/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pathlib_mate import Path
from pathlib_mate.helper import repr_data_size
from atomicwrites import atomic_write
import sqlalchemy_mate as sam


SIMPLE_DB_FILE_DOWNLOAD_URL = "https://github.com/MacHu-GWU/uszipcode-project/releases/download/1.0.1.db/simple_db.sqlite"
COMPREHENSIVE_DB_FILE_DOWNLOAD_URL = "https://github.com/MacHu-GWU/uszipcode-project/releases/download/1.0.1.db/comprehensive_db.sqlite"
Expand Down
File renamed without changes.
77 changes: 39 additions & 38 deletions uszipcode/model.py → zipcode3/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import sqlalchemy as sa
import sqlalchemy.orm as orm
import sqlalchemy_mate as sam
import sqlalchemy_mate.api
from sqlalchemy_mate import api
from sqlalchemy_mate.types import api as types_api
from .state_abbr import (
MAPPER_STATE_ABBR_SHORT_TO_LONG,
)
Expand All @@ -28,7 +29,7 @@ class ZipcodeTypeEnum(enum.Enum):


@total_ordering
class AbstractSimpleZipcode(Base, sam.api.ExtendedBase):
class AbstractSimpleZipcode(Base, api.ExtendedBase):
"""
Base class for Zipcode.
"""
Expand All @@ -38,7 +39,7 @@ class AbstractSimpleZipcode(Base, sam.api.ExtendedBase):
zipcode_type = sa.Column(sa.String)
major_city = sa.Column(sa.String)
post_office_city = sa.Column(sa.String)
common_city_list = sa.Column(sam.types.api.CompressedJSONType)
common_city_list = sa.Column(types_api.CompressedJSONType)
county = sa.Column(sa.String)
state = sa.Column(sa.String)

Expand All @@ -47,7 +48,7 @@ class AbstractSimpleZipcode(Base, sam.api.ExtendedBase):

timezone = sa.Column(sa.String)
radius_in_miles = sa.Column(sa.Float)
area_code_list = sa.Column(sam.types.api.CompressedJSONType)
area_code_list = sa.Column(types_api.CompressedJSONType)

population = sa.Column(sa.Integer)
population_density = sa.Column(sa.Float)
Expand Down Expand Up @@ -150,61 +151,61 @@ def to_json(self, include_null: bool = True):
class AbstractComprehensiveZipcode(AbstractSimpleZipcode):
__abstract__ = True

polygon = sa.Column(sam.types.api.CompressedJSONType)
polygon = sa.Column(types_api.CompressedJSONType)

# Stats and Demographics
population_by_year = sa.Column(sam.types.api.CompressedJSONType)
population_by_age = sa.Column(sam.types.api.CompressedJSONType)
population_by_gender = sa.Column(sam.types.api.CompressedJSONType)
population_by_race = sa.Column(sam.types.api.CompressedJSONType)
head_of_household_by_age = sa.Column(sam.types.api.CompressedJSONType)
families_vs_singles = sa.Column(sam.types.api.CompressedJSONType)
households_with_kids = sa.Column(sam.types.api.CompressedJSONType)
children_by_age = sa.Column(sam.types.api.CompressedJSONType)
population_by_year = sa.Column(types_api.CompressedJSONType)
population_by_age = sa.Column(types_api.CompressedJSONType)
population_by_gender = sa.Column(types_api.CompressedJSONType)
population_by_race = sa.Column(types_api.CompressedJSONType)
head_of_household_by_age = sa.Column(types_api.CompressedJSONType)
families_vs_singles = sa.Column(types_api.CompressedJSONType)
households_with_kids = sa.Column(types_api.CompressedJSONType)
children_by_age = sa.Column(types_api.CompressedJSONType)

# Real Estate and Housing
housing_type = sa.Column(sam.types.api.CompressedJSONType)
year_housing_was_built = sa.Column(sam.types.api.CompressedJSONType)
housing_occupancy = sa.Column(sam.types.api.CompressedJSONType)
vacancy_reason = sa.Column(sam.types.api.CompressedJSONType)
owner_occupied_home_values = sa.Column(sam.types.api.CompressedJSONType)
rental_properties_by_number_of_rooms = sa.Column(sam.types.api.CompressedJSONType)

monthly_rent_including_utilities_studio_apt = sa.Column(sam.types.api.CompressedJSONType)
monthly_rent_including_utilities_1_b = sa.Column(sam.types.api.CompressedJSONType)
monthly_rent_including_utilities_2_b = sa.Column(sam.types.api.CompressedJSONType)
monthly_rent_including_utilities_3plus_b = sa.Column(sam.types.api.CompressedJSONType)
housing_type = sa.Column(types_api.CompressedJSONType)
year_housing_was_built = sa.Column(types_api.CompressedJSONType)
housing_occupancy = sa.Column(types_api.CompressedJSONType)
vacancy_reason = sa.Column(types_api.CompressedJSONType)
owner_occupied_home_values = sa.Column(types_api.CompressedJSONType)
rental_properties_by_number_of_rooms = sa.Column(types_api.CompressedJSONType)

monthly_rent_including_utilities_studio_apt = sa.Column(types_api.CompressedJSONType)
monthly_rent_including_utilities_1_b = sa.Column(types_api.CompressedJSONType)
monthly_rent_including_utilities_2_b = sa.Column(types_api.CompressedJSONType)
monthly_rent_including_utilities_3plus_b = sa.Column(types_api.CompressedJSONType)

# Employment, Income, Earnings, and Work
employment_status = sa.Column(sam.types.api.CompressedJSONType)
average_household_income_over_time = sa.Column(sam.types.api.CompressedJSONType)
household_income = sa.Column(sam.types.api.CompressedJSONType)
annual_individual_earnings = sa.Column(sam.types.api.CompressedJSONType)
employment_status = sa.Column(types_api.CompressedJSONType)
average_household_income_over_time = sa.Column(types_api.CompressedJSONType)
household_income = sa.Column(types_api.CompressedJSONType)
annual_individual_earnings = sa.Column(types_api.CompressedJSONType)

sources_of_household_income____percent_of_households_receiving_income = sa.Column(
sam.types.api.CompressedJSONType)
types_api.CompressedJSONType)
sources_of_household_income____average_income_per_household_by_income_source = sa.Column(
sam.types.api.CompressedJSONType)
types_api.CompressedJSONType)

household_investment_income____percent_of_households_receiving_investment_income = sa.Column(
sam.types.api.CompressedJSONType)
types_api.CompressedJSONType)
household_investment_income____average_income_per_household_by_income_source = sa.Column(
sam.types.api.CompressedJSONType)
types_api.CompressedJSONType)

household_retirement_income____percent_of_households_receiving_retirement_incom = sa.Column(
sam.types.api.CompressedJSONType)
types_api.CompressedJSONType)
household_retirement_income____average_income_per_household_by_income_source = sa.Column(
sam.types.api.CompressedJSONType)
types_api.CompressedJSONType)

source_of_earnings = sa.Column(sam.types.api.CompressedJSONType)
source_of_earnings = sa.Column(types_api.CompressedJSONType)
means_of_transportation_to_work_for_workers_16_and_over = sa.Column(
sam.types.api.CompressedJSONType)
types_api.CompressedJSONType)
travel_time_to_work_in_minutes = sa.Column(sam.types.api.CompressedJSONType)

# Schools and Education
educational_attainment_for_population_25_and_over = sa.Column(
sam.types.api.CompressedJSONType)
school_enrollment_age_3_to_17 = sa.Column(sam.types.api.CompressedJSONType)
types_api.CompressedJSONType)
school_enrollment_age_3_to_17 = sa.Column(types_api.CompressedJSONType)


class SimpleZipcode(AbstractSimpleZipcode):
Expand Down
5 changes: 2 additions & 3 deletions uszipcode/search.py → zipcode3/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
import sqlalchemy as sa
from sqlalchemy.engine import Engine
import sqlalchemy.orm as orm
import sqlalchemy_mate as sam
import sqlalchemy_mate.api
from sqlalchemy_mate import api

from pathlib_mate import Path
from fuzzywuzzy.process import extract, extractOne
Expand Down Expand Up @@ -153,7 +152,7 @@ def __init__(
self.db_file_path = db_file_path
self.download_url = download_url
self._download_db_file_if_not_exists()
self.engine = sam.api.EngineCreator().create_sqlite(path=self.db_file_path)
self.engine = api.EngineCreator().create_sqlite(path=self.db_file_path)
self.eng = self.engine
self.session = orm.Session(self.engine)
self.ses = self.session
Expand Down
File renamed without changes.
File renamed without changes.