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.

Missing docstring for initialize_database. Check Documenter's build log for details.

GeoIDs.Setup.ensure_database_existsFunction
ensure_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.

source

Schema Setup

Functions for setting up the database schema:

Census Data Management

Functions for downloading and loading Census geographic data:

GeoIDs.Setup.download_county_shapefileFunction
download_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 file
  • year: Census year (default: 2023)

Returns

  • Path to the downloaded zip file
source
GeoIDs.Setup.extract_shapefileFunction
extract_shapefile(zip_path, output_dir="./data")

Extract the downloaded shapefile zip to the specified directory.

Arguments

  • zip_path: Path to the zip file
  • output_dir: Directory to extract files to

Returns

  • Path to the extracted shapefile (.shp)
source
GeoIDs.Setup.load_counties_to_dbFunction
load_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
source

Module Index