The code and queries etc here are unlikely to be updated as my process evolves. Later repos will likely have progressively different approaches and more elaborate tooling, as my habit is to try to improve at least one part of the process each time around.
All the relevant metadata now lives in config.json: ideally nothing will need tweaked after this. We need to be careful here to get the history of Wikidata IDs for the constituency correct.
bundle exec ruby scraper.rb config.json | tee wikipedia.csv
xsv search -v -s party 'Q' wikipedia.csv
Nothing missing.
xsv search -v -s election 'Q' wikipedia.csv | xsv select electionLabel | uniq
Five new by-election items created:
- wb ce create-by-election.js "1863 Totnes by-election" 1863-01-21
- wb ce create-by-election.js "1862 Totnes by-election" 1862-12-09
- wb ce create-by-election.js "1840 Totnes by-election" 1840-04-21
- wb ce create-by-election.js "1839 Totnes by-election" 1839-07-26
- wb ce create-by-election.js "1834 Totnes by-election" 1834-02-17
xsv search -v -s id 'Q' wikipedia.csv | xsv select name | tail +2 |
sed -e 's/^/"/' -e 's/$/"@en/' | paste -s - |
xargs -0 wd sparql find-candidates.js |
jq -r '.[] | [.name, .item.value, .election.label, .constituency.label, .party.label] | @csv' |
tee candidates.csv
xsv join -n --left 2 wikipedia.csv 1 candidates.csv | xsv select '10,1-8' | sed $'1i\\\nfoundid' | tee combo.csv
bundle exec ruby generate-qs.rb config.json | tee commands.qs
Then sent to QuickStatements as https://editgroups.toolforge.org/b/QSv2T/1598111847212/