Setup Module
The Setup module provides functionality for initializing the database schema and acquiring Census TIGER/Line shapefiles.
Database Initialization
Main function to completely initialize the database:
Missing docstring for initialize_database. Check Documenter's build log for details.
GeoIDs.Setup.ensure_database_exists — Functionensure_database_exists()Check if the configured database exists and create it if it doesn't. Returns true if the database was created, false if it already existed.
Schema Setup
Functions for setting up the database schema:
GeoIDs.Setup.setup_census_schema — Functionsetup_census_schema(conn)Create the census schema if it doesn't exist.
Arguments
conn: LibPQ connection object
Census Data Management
Functions for downloading and loading Census geographic data:
GeoIDs.Setup.download_county_shapefile — Functiondownload_county_shapefile(output_dir="./data", year=2023)Download the Census TIGER/Line county shapefile for the specified year.
Arguments
output_dir: Directory to save the downloaded fileyear: Census year (default: 2023)
Returns
- Path to the downloaded zip file
GeoIDs.Setup.extract_shapefile — Functionextract_shapefile(zip_path, output_dir="./data")Extract the downloaded shapefile zip to the specified directory.
Arguments
zip_path: Path to the zip fileoutput_dir: Directory to extract files to
Returns
- Path to the extracted shapefile (.shp)
GeoIDs.Setup.load_counties_to_db — Functionload_counties_to_db(shapefile_path, conn)Load the county shapefile into the database.
Arguments
shapefile_path: Path to the shapefile (.shp)conn: LibPQ connection object
Module Index
GeoIDs.Setup.download_county_shapefileGeoIDs.Setup.ensure_database_existsGeoIDs.Setup.extract_shapefileGeoIDs.Setup.load_counties_to_dbGeoIDs.Setup.setup_census_schema