Task 1: Help us find the offices of heads of governments across the world!

Lucy Chambers
May 31, 2017 · 6 min read

Update: 2017–06–05. This mission is now over. But don’t despair, you can still help! There are now more missions like this over on the Wikidata:WikiProject Heads of state and government. Come join us!

This is part one of a five part series examining how to use Wikidata to answer the question: “What is the gender breakdown of heads of government across the world?”.

As part of my onboarding onto the Wikidata project, I was given the task of understanding why particular questions involving political data are currently hard to answer using Wikidata.

Spoiler: blanks and inconsistencies in the data are the reason that even answering simple questions is hard. But the good news is: you can help to fix them. This series of posts will show you how. All you need is to know what should be in a gap and be bold enough to go and fix it; we’ll walk you through how.

We are going to start by exploring the question: “What is the gender breakdown of heads of government across the world?” and examine which data problems stop us from answering that question at present using Wikidata.

In order to know the gender breakdown of heads of government across the world, you first need to know: “Who are the heads of government across the world?”

Before we go much further, you should know that one of the reasons this is hard is that there are often multiple ways to ask even a simple question on Wikidata. The question above can be asked both indirectly, directly and in reverse, as we will see in the next couple of posts.

Here, we are going to take the first step of the indirect route by asking: “What is the office held by the head of government in each country?”

Here we meet our first problem. To illustrate why it is a problem, we had to generate some reports which show you what information Wikidata already contains. Reports show a particular angle on the data which isn’t normally visible because Wikidata is edited and viewed at the level of an individual item; this means it is normally hard to see whether you are entering data in a way that is consistent with other people entering similar data, or when no-one has realised that some information is missing. Reports collect and present data so that it is clear if there is a gap or an inconsistency.

As this report on the office held by the head of government shows, we have a lot of blanks already!

Wikidata office held by head of government (P1313) report.

Fun facts for those interested in some of the complexities of modelling this data (or for those collecting pub quiz questions!):

  1. Take a look at Myanmar:

Notice that there are two entries? In a nutshell, this is because the old role of Prime Minister was abolished in 2011 and replaced with President, but Aung San Suu Kyi was constitutionally barred from becoming president, so they had to create a new role for her. Read more here.

2. Take a look at Switzerland:

That <no value> is not an error and it is different from a blank. Switzerland does not have a single head of government but instead a Federal Council with seven members.

Spot any blanks or incorrect information in the report? Help us fill them! To add or correct the information on the corresponding page for the country, all you need is a Wikidata account. Never edited Wikidata before? Take a tour and read the introduction and you’ll be on your way in no time.

How? In human speak, if you see a blank in this table next to a country for which you know the information — go to the Wikidata item for the country you want to edit and search for the term “office held by head of government” (in Wikidata speak, this is a P1313 statement). Given you were going to this page because there was a blank in the table, you probably won’t find it, so you will need to add a new statement to the page. Note that the relevant “+ add” button is quite hard to find — you are looking for the one right at the end of the list of existing statements (see below).

Start typing “office” and various options should pop up. Select ‘office held by head of government’. Note: we are writing this with English as our default language, but you can use Wikidata in your language and search for the equivalent, or just type P1313 and you’ll get the right result!

Next, start typing the role in the box to the right. In most cases, this will bring up the item you are looking for (skip to the next step if you don’t see it).

If the item you are looking for does not appear in the list, that may mean it does not yet exist in Wikidata and you will need to create it. As background for this step: here’s the general Wikidata documentation on items.

To add your item:

  • Click the “Create a new item” link
  • In the Label field add the name of the office of the head of government (adding a description and alias are optional) and hit Create. You will be taken to the page for the item you just created.

Remember, you got here because the item for that role didn’t exist: you still need to link it to the country by using the steps mentioned earlier in the post.

For bonus points, you should add a couple of statements to the item page for the role you just created.

For now, we care most about about the following three fields:

  • subclass of. Add a statement as described above and indicate that this is a subclass of whatever the title is minus the country, so if the item is Prime Minister of Botswana, the ‘subclass of’ should be prime minister. This rule works for common role titles such as prime minister and president but if the role title does not appear in the dropdown, you can fall back to entering head of government.
  • country. Enter the country to which this office relates.
  • applies to territorial jurisdiction. Enter here the geographical area governed by the person in this role (see the note below if you get stuck).

Watch out for places (often sub-national territories) where the territorial jurisdiction is not the same as the country e.g. Greenland and Scotland. For example: Greenland is a territory of the Kingdom of Denmark, so the country on the page Prime Minister of Greenland is actually the Kingdom of Denmark; the jurisdiction over which the Prime Minister governs, however, is Greenland. Scotland is a similar story: for the purposes of the office of the First Minister of Scotland, the country is the United Kingdom, but the jurisdiction is Scotland.

Phew, glad that one’s out the way!


Congratulations and thanks! You just made a huge step towards making politicians around the world more accountable.

At the time of writing, we still have a lot of gaps in this foundational piece of the puzzle. Over the next few posts, we’ll explore how we fill in the next pieces.

So far, we have completed this part of the journey:

Keen for more? Read the next post in the series. Remember to follow EveryPoliticianBot on Twitter to never miss a post.

Gratuitous pretty picture of something political. Glass | Transparent | Transparency > totally on theme. (CC-BY dylanramos)

mySociety for coders

Posts about the code, the data, the development and the…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store