Skip to content

Seed Dev Data

The following scripts are used to seed the dev data.

The scripts for creating the HoneyGrid are located in the packages/scripts directory.

There is a local copy of the HoneyGrid in a leveldb database in the packages/scripts/intermediate directory. You can prepare a portion of the HoneyGrid for local development by running the following command in the packages/scripts directory:

Terminal window
# You can pass a zip code prefix to the script to limit the data seeded to a specific zip code prefix.
# For example, "78" will seed the KV cache with most of central Texas.
# If you do not pass a zip code prefix, the script will seed the entire HoneyGrid, which is a lot of data.
pnpm seedLocalHoneyGrid 78

This script will export the HoneyGrid to a JSON file located at apps/api/seed-data/honey-grid.json. To seed the KV cache with the HoneyGrid, run the following command in the apps/api directory:

Terminal window
pnpm seedHoneyGridKV

This script will use the wrangler kv:bulk put command to seed the KV cache with the HoneyGrid.

The scripts/geojson/zipcode-h3cells directory contains a file for each state that contains the zip codes for that state and all of the corresponding H3 cells for each zip code.

You can seed the local KV cache with the zip codes for a specific state by running the following command in the packages/scripts directory:

Terminal window
# You can pass a state filter to the script to limit the data seeded to a specific state.
# If you do not pass a state filter, the script will seed the entire KV cache with zip codes for all states.
pnpm seedLocalZipCodes texas

This script will export the zip codes for the state of Texas to a JSON file located at apps/api/seed-data/zip-codes-to-h3.json.

To seed the KV cache with the zip codes, run the following command in the apps/api directory:

Terminal window
pnpm seedZipCodesKV

This script will use the wrangler kv:bulk put command to seed the KV cache with the zip codes.

The packages/scripts/geojson/countyToH3Cells.json file contains the H3 cells for each county in the United States. There are relatively few counties in the United States, so there is no need to filter the data.

You can seed the local KV cache with the counties by running the following command in the packages/scripts directory:

Terminal window
pnpm seedLocalCounties

This script will export the counties to a JSON file located at apps/api/seed-data/counties-to-h3.json.

To seed the KV cache with the counties, run the following command in the apps/api directory:

Terminal window
pnpm seedCountiesKV

This script will use the wrangler kv:bulk put command to seed the KV cache with the counties.