| Crates.io | popgetter-cli |
| lib.rs | popgetter-cli |
| version | 0.2.2 |
| created_at | 2025-01-10 21:31:48.992895+00 |
| updated_at | 2025-04-22 14:52:31.950577+00 |
| description | CLI for popgetter |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1511768 |
| size | 209,534 |
Library and associated command-line application for exploring and fetching popgetter data.
cargo install popgetter-cli
popgetter --help
countries subcommandGet a list of available data:
popgetter countries
metrics subcommandGet a summary of all data:
popgetter metrics --summary
Get a summary of data for a given country:
popgetter metrics --summary --country "united states"
Get the list of metadata fields:
popgetter metrics --display-metadata-columns
Get a list of geometry levels for a given country:
popgetter metrics --country "united states" \
--unique geometry_level
An example search using a regex for search text combined with a given country and geometry level:
popgetter metrics \
--text " car[^a-z] | cars " \
--country "northern ireland" \
--geometry-level sdz21
An example search using a regex for search text combined with a given country and geometry level:
popgetter data
--id 38757cf9 \
--output-file popgetter.geojson \
--output-format geojson
--dev
where the --dev flag is used here to enable output with CRS transformed to EPSG:4326 since all data is provided here in EPSG:4326.
Recipe files provide an alternative to using the command line flags. An example recipe can be downloaded with:
popgetter recipe test_recipe.json \
--output-format csv --output-file popgetter.csv
It is possible to also search and generate data requests supported by LLMs.
The below steps are required for this experimental functionality implemented in the popgetter-llm crate.
llm feature:cargo install popgetter-cli --features llm
text-embedding-3-small)gpt-4o)export AZURE_OPEN_AI_KEY="REPLACE_WITH_API_KEY"
Note: currently only Azure endpoints are supported.
Install and run Docker
Initialize the Qdrant database:
cd ../popgetter-llm/
docker compose up
Construct the database with embeddings derived from metadata using the popgetter CLI:
popgetter llm init
This process will take several hours to run and will construct the Qdrant database for all the metadata (around 3GB total size).
With the database populated, search queries can be performed using the embeddings to:
For search results based on embedding similarity, e.g.:
popgetter llm query \
"cars and household size" \
--limit 10 \
--output-format SearchResults \
--country "United States"
output-format set to --output-format SearchResultsToRecipe, the metric IDs from the search results are included in a recipe:popgetter llm query \
"cars and household size" \
--limit 10 \
--output-format SearchResultsToRecipe \
--country "United States"
output-format set to --output-format DataRequestSpec, the data request specification is produced directly from the search results through a second prompt:RUST_LOG=info popgetter llm query \
"cars and household size" \
--limit 10 \
--output-format DataRequestSpec \
--country "United States"
Note: This output format is highly experimental and may produce incorrect data request specifications.