Seed Dev Data
Overview
Section titled “Overview”The following scripts are used to seed the dev data.
Seed Local Honey Grid
Section titled “Seed Local Honey Grid”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:
# 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 78This 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:
pnpm seedHoneyGridKVThis script will use the wrangler kv:bulk put command to seed the KV cache with the HoneyGrid.
Seed Local Zip Codes
Section titled “Seed Local Zip Codes”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:
# 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 texasThis 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:
pnpm seedZipCodesKVThis script will use the wrangler kv:bulk put command to seed the KV cache with the zip codes.
Seed Local Counties
Section titled “Seed Local Counties”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:
pnpm seedLocalCountiesThis 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:
pnpm seedCountiesKVThis script will use the wrangler kv:bulk put command to seed the KV cache with the counties.