-
Notifications
You must be signed in to change notification settings - Fork 74
Home
Joel Natividad edited this page Oct 7, 2021
·
18 revisions
Welcome to the qsv wiki!
Please feel free to add qsv recipes to the Cookbook!
using qsv, ckanapi, jq and xargs.
- get a CSV of datasets/users/groups/orgs in a CKAN instance
$ ckanapi -r https://demo.ckan.org dump datasets --all | qsv jsonl > datasets.csv
$ ckanapi -r https://demo.ckan.org dump users --all | qsv jsonl > users.csv
$ ckanapi -r https://demo.ckan.org dump groups --all | qsv jsonl > groups.csv
$ ckanapi -r https://demo.ckan.org dump organizations --all | qsv jsonl > organizations.csv
- get a CSV of resources for a given dataset
$ ckanapi -r https://catalog.data.gov action package_show \
id=low-altitude-aerial-imagery-obtained-with-unmanned-aerial-systems-uas-flights-over-black-beach \
| jq -c '.resources[]' \
| qsv jsonl \
> resources.csv
- get the latest version of a CSV resource for
wellstar-oil-and-gas-wells1
on https://data.cnra.ca.gov, run stats on it
$ ckanapi -r https://data.cnra.ca.gov action package_show id="wellstar-oil-and-gas-wells1" > wellstar-oil-and-gas-wells.json
$ cat wellstar-oil-and-gas-wells.json \
| jq -c '.resources[] | select(.name=="CSV") | .url' \
| xargs -L 1 wget -O wellstar.csv
$ qsv stats --everything wellstar.csv > wellstar-stats.csv
- add a column with Quarter information calculated from "Created Date"
- geocode the nearest city given latitude/longitude