website icon indicating copy to clipboard operation
website copied to clipboard

Validating or basing expected count on quantity (P1114)

Open Ainali opened this issue 1 year ago • 1 comments

The feature

In Wikidata, each type of organization can have quantity (P1114) on them, showing how many of these exists. We could use that to validate our query results, either instead of the manual, or perhaps even better, as an extra column.

I am not sure if it is better to create an extra query to compare with (that may be redundant data stored and making it more complex to add a new country), bake it into the country query (I don't know if that can be done without being redundant in the same query, but that is probably better than in a different file), or create it on-the-fly in a script by extracting the types from the country query or the results (this would be elegant, but I don't know how to do it).

Why?

By using the data provided in Wikidata, the community can help us discover changes, and it may give an additional way to investigate differences.

Examples and inspiration

  • Here are example queries showing expected count for Denmark and Nepal: https://w.wiki/CEas https://w.wiki/CEbH
  • Here is a naive attempt to get that result baked into the Danish country query: https://w.wiki/CEN$
  • The US states item shows well how this varies over time: https://www.wikidata.org/wiki/Q35657#P1114

Ainali avatar Nov 29 '24 07:11 Ainali

I started to play around with this by getting any government agency type and checking "all of them"(https://w.wiki/Cpvp). Interestingly the (somewhat early) results highlight some "complete" types which we don't have in Govdirectory:

abbe@knockturn-alley ~/P/g/detect-agency-types-ready-for-inclusion> python generate-report.py
Analyzing government agency types...

Results:
--------------------------------------------------------------------------------
Type                                     Expected   Actual     Country         Status
--------------------------------------------------------------------------------
summary court                            438        439        Japan           !
Q44269577                                27         2          Japan           !
emergency zone                           34         35         Belgium         !
ministry of Finland                      12         12         Finland         ✓
ministry of Andorra                      11         9          Andorra         !
wizarate of Saudi Arabia                 24         4          Saudi Arabia    !
ministries of Denmark                    21         21         Kingdom of Denmark ✓
ministry of Malaysia                     27         28         Malaysia        !
ministry of Nepal                        21         21         Nepal           ✓
ministry of Bangladesh                   39         39         Bangladesh      ✓
water board in the Netherlands           22         24         Netherlands     !
State Historic Preservation Office       59         53         United States   !
house secretariat                        2          2          Japan           ✓
Q27962302                                9          9          Belgium         ✓
District election commission             225        0          Ukraine         !
state corporate register                 55         1          United States   !
ministries of Denmark                    21         21         Kingdom of Denmark ✓
ministry of Bangladesh                   39         39         Bangladesh      ✓
Directorate-General of the European Commission 31         34         -               !

Report saved to: agency_report_20250124_160453.csv

Abbe98 avatar Jan 24 '25 15:01 Abbe98