Recommendations for the European Parliament API

I recently provided feedback on the European Parliament's data API initiative. I applaud their effort to increase transparency by making the data available in a machine-readable format. However, I had some suggestions for improvement.

The European Union's legislative process involves three institutions, but the Parliament stands out as the most transparent. Despite the abundance of data available, it can be challenging to reuse and process due to its unavailability in a machine-readable format.

In July 2022, the Parliament launched a beta initiative to open up its data and provide access through an API endpoint, seeking feedback from interested parties.

Today, I have taken the time to share my suggestions on this matter, which can be found below and on this link.


Dear European Parliament Team,

I would like to extend my gratitude for this exciting initiative. Making European Parliament data available in a machine-readable format is a welcome move and I am hopeful that it will lead to the creation of innovative applications that can enhance the policy-making process and increase transparency.

Regarding the launch of the project, I was wondering if you could provide more information on the release of the public API. As far as I know, the project was expected to be officially launched in Q4 2022. In the event of any delays, I would greatly appreciate access to the beta API so that I can conduct some tests.

Wish List:

  • Simplifying the API:
    It was a challenge to understand the EUR-LEX API, and I found the documentation to be fragmented and outdated. I would like to see the EP API to be as straightforward to use as NewsAPI or Wikipedia's API, with simple cURL request.

  • Selecting languages:
    In most use cases, it is not necessary to display all languages at once. It would be more efficient to allow users to choose the preferred language in the header request.

  • Enhancing the documentation:
    Clear and numerous examples in the documentation would be helpful in understanding the API's functionality.

  • Linking the data:
    It can be challenging to track MEPs across different websites due to the use of multiple aliases. Using unique IDs would make it easier to parse the data.

  • Separating the data:
    Different applications require different pieces of data. The returned format should have a clear separation, with each key corresponding to a distinct piece of data. I would like to see amendments clearly separated and linked to their MEP(s).

  • Moving away from pdf and docx:
    Parsing pdf and docx documents is challenging and can lead to uncertain results. To make the data more accessible, I suggest including full data in the export format, not just the title.

  • Extending the dataset:
    As highlighted by @stef in a previous publication, there is still a significant amount of data missing. It would be great to see the voting results, details of the legislative procedures (i.e. creating a dump of OEIL), committee meetings, audio and video recordings of sessions (not just plenary sessions), and more comprehensive information about MEPs, including their meetings and activities.

  • Developing an API Sandbox:
    Providing an API sandbox is the simplest way to get started quickly. The Wikipedia API sandbox serves as a great example.

  • Regularly Updating the Dataset:
    Outdated information is only useful for research purposes. The API's data should be as current as the EP website to allow for tracking the legislative process and obtaining results from plenary sessions and other activities as they are published.

As an example, I had a look at parliamentary questions and I have found the format to be confusing and overly complicated (I am translating the ttl into a json format for better understanding):

Translation of the current dump:

  {
    "@id": "https://data.europarl.europa.eu/eli/dl/doc/E-9-2022-000029/en",
    "@type": [
      "http://data.europa.eu/eli/ontology#Expression"
    ],
    "http://data.europa.eu/eli/ontology#is_embodied_by": [
      {
        "@id": "https://data.europarl.europa.eu/eli/dl/doc/E-9-2022-000029/en/pdf"
      },
      {
        "@id": "https://data.europarl.europa.eu/eli/dl/doc/E-9-2022-000029/en/xhtml"
      },
      {
        "@id": "https://data.europarl.europa.eu/eli/dl/doc/E-9-2022-000029/en/docx"
      }
    ],
    "http://data.europa.eu/eli/ontology#title": [
      {
        "@value": "Press freedom in Hong Kong",
        "@language": "en"
      }
    ],
    "http://data.europa.eu/eli/ontology#title_alternative": [
      {
        "@value": "Question for written answer E-000029/2022<br/>to the Vice-President of the Commission / High Representative of the Union for Foreign Affairs and Security Policy<br/>Rule 138<br/>Isabel Santos (S&D)",
        "@language": "en"
      }
    ]
  },

Suggested format:

curl -XPOST -H "Content-type: application/json" -d '{
  "key": "b85cf976586f482c8c09db3d95009d73",
  "id": "E-9-2022-000029",
  "lang": "en",
  "format": "json"
}' 'https://api.europarl.europa.eu/parliamentary-question'
{
  "information": {
    "id": "E-9-2022-000029",
    "url": "https://www.europarl.europa.eu/doceo/document/E-9-2022-000029_EN.html",
    "type": "written",
    "ask_date": "2022-01-05",
    "edit_date": "2022-01-14",
    "rule": 138,
    "from": [
      {
        "full_name": "Isabel Santos",
        "id": 197650
      }
    ],
    "to": {
      "institution": "COM",
      "name": "Vice-President of the Commission / High Representative of the Union for Foreign Affairs and Security Policy",
      "id": 0
    }
  },
  "question": {
    "title": "Press freedom in Hong Kong",
    "context": "In Hong Kong, 2022 has begun on the same note as that on which 2021 ended: with a climate of repression casting a dark shadow over the region’s media outlets and the lives of citizens. \n This has been the order of the day ever since the adoption of the National Security Law in 2020, when China began tightening its grip on Hong Kong through a general curtailment of freedoms, leading to a virtual collapse in freedom of expression and information. \n This was reflected in the closure of Apple Daily in June 2021. The fallout continues to this day with the closure of Stand News, and Citizen News forced to cease operations in order to protect its journalists against the backdrop of an escalating crackdown on press freedom. \n We can see, therefore, that Beijing continues – as it has done in Macao – to disregard its international commitments and to show that dictatorships and the free press make for uncomfortable bedfellows. In view of this:",
    "questions": [
      "Can the Vice-President / High Representative say what action has been, or will be, taken to protect and support journalists and safeguard press freedom in Hong Kong?"
    ]
  },
  "answer": {
    "is_answered": true,
    "answer_date": "2022-03-22",
    "answer_edit_date": "2022-03-22",
    "answer": "Media freedom and pluralism is an essential Union principle, and the Union’s toolbox to defend it and promote it, both within its borders and in its external policy, is being reinforced. \n The situation in Hong Kong (HK) has deteriorated since the imposition of the National Security Law (NSL) in June 2020. The Law has been used to stifle political pluralism and the exercise of human rights that are protected under HK law and international law. \n After the closure of Apple Daily in June, Stand News closed in December 2021 after its former editors-in-chief were arrested accused of publishing seditious materials. A few days later, Citizen News announced the suspension of its operations for fear that journalists could be accused of violating laws. \n The Council adopted conclusions in July 2020 on Hong Kong with a package of measures to be taken both by the EU and by Member States. \n This covers inter alia asylum and visa policy; export controls; observation of trials; support for civil society including media and journalists; scholarships and academic exchanges; reviewing extradition agreements; and refraining from launching any new negotiations. The EU and its Member States continue to implement these Council Conclusions. \n In addition, the EU has spoken publicly on the importance of democratic principles in Hong Kong as well as on fundamental rights and freedom. \n On the specific issue of the press, the Spokesperson’s service issued a statement on the closure of Apple Daily’s Hong Kong operations on 23 June 2021 and tweeted following the closure of Stand News and more recently after the end of CitizensNews. \n The EU is also committed to raise this issue with the Chinese leadership and to call on China, in all bilateral and multilateral fora, to abide by its international commitment. \n The upcoming EU Annual Report on HK expected to be published in spring 2022 will reflect the challenges for the people of HK to exercise their fundamental rights and freedoms as guaranteed by the HK Basic Law."
  }
}
Grégoire Gaonach

© 2024 Grégoire Gaonach Admin