951
edits
(Add an example when exporting a field containing array to CSV with jq) |
(Selecting products with data quality issues and exporting as csv) |
||
Line 135: | Line 135: | ||
Some part of the data are arrays, you must aggregate them using <code>join</code> for CSV export. For example, to export each product and its states in CSV: | Some part of the data are arrays, you must aggregate them using <code>join</code> for CSV export. For example, to export each product and its states in CSV: | ||
$ zcat openfoodfacts-products.jsonl.gz | jq -r '[.code,(.states_tags|join(","))] | @csv' | $ zcat openfoodfacts-products.jsonl.gz | jq -r '[.code,(.states_tags|join(","))] | @csv' | ||
Selecting products with quality issues and exporting the barcode and the issues in CSV: | |||
$ zcat openfoodfacts-products.jsonl.gz | jq -r '. | select(.data_quality_errors_tags[]? != "")' | jq -r '[.code,(.data_quality_errors_tags|join(","))] | @csv' | |||
These operations can be quite long (more than 10 minutes depending on your computer and your selection). | These operations can be quite long (more than 10 minutes depending on your computer and your selection). | ||