Page MenuHomePhabricator
Paste P6333

Constraint check result statuses on 100 random items
ActivePublic

Authored by Lucas_Werkmeister_WMDE on Nov 16 2017, 5:39 PM.
#!/bin/bash
function checkId {
id=${1:?no entity ID given}
curl -G \
-d 'format=json' \
-d 'formatversion=2' \
-d 'action=wbcheckconstraints' \
-d "id=$id" \
https://www.wikidata.org/w/api.php |
jq '.. |
objects |
select(has("status")) |
.status' |
sort |
uniq -c |
sort -nr > \
"$id.results"
}
cd /tmp || exit
for ((i=0; i<100; i++)); do
randomId=$(
curl -s -I https://www.wikidata.org/wiki/Special:Random |
sed -n '
/^Location: /I {
s|.*/||
s|\r$||
p
}'
)
checkId "$randomId"
done
awk '
{
all[$2]+=$1
}
END {
for (k in all)
print k, all[k]
}
' Q*.results

Event Timeline

Example results:

"bad-parameters" 15
"warning" 66
"not-main-snak" 1601
"todo" 26
"compliance" 5096

Updated example results:

"bad-parameters" 6                             
"warning" 68                                   
"not-main-snak" 2561                           
"violation" 14                                 
"todo" 17                                      
"compliance" 6513