How Àgora builds the record of the XV legislature from open data

Àgora compares what the parties promised in 2023 with what the XV legislature actually did. For that it needs a record of the legislature that does not depend on anyone’s summary: which initiatives were tabled, which norms were passed, what the Government approved, and how each group voted. We build it from three public sources and keep every row traceable to its origin.

This post lists those sources, with the counts as they stand in the repository today, then explains how a bill is matched to a law and what the record leaves out. It says nothing about who did better: the record is the same for everyone, and the pledge scales are a separate step.

Three sources, scraping only where there is no API

SourceWhat we takeRows
Congress open dataLegislative initiatives and plenary votes488 initiatives, 2,179 votes
BOELaws, decree-laws, royal decrees, orders and section III provisions103 norms, 1,604 decrees and orders, 11,958 provisions
La MoncloaThe references of the Council of Ministers7,810 items from 159 meetings

The Congress and the BOE publish data meant to be reused. La Moncloa does not: its only feed carries the latest meetings, so scripts/data/legislature/moncloa-referencias.mjs reads each meeting’s HTML page instead. It is the most fragile of the three sources.

Every script is idempotent and has a --check mode that validates the output without network access. Downloads are cached outside git, so the same cache gives the same file. The pledges themselves are read from the party programmes in a separate step, which we check quote by quote.

Initiatives: 488, and most of them lapsed

congreso/initiatives.json holds the bills of the legislature, which ran from 17 August 2023 to 6 October 2026. The Congress publishes them in separate files, and we merge them by type:

TypeCountApprovedLapsed
Government bills (projecte-llei)1152289
Private members’ bills (proposicio-llei)37112215
Statute reform proposals200

The rest of the private members’ bills ended as rejected (56), withdrawn (50), fallen (28), not admitted (4), merged into another (3) or moved to another procedure (3). The two statute proposals were moved. The counts come from congreso/initiatives-meta.json, built from the Congress snapshot of 26 October 2026.

“Lapsed” means the bill was still pending when the legislature was dissolved. Àgora does not treat that as a rejection, and the earlier post on the two scales explains how a dissolution is handled.

Norms: 103, and how they are tied to bills

laws.json holds the norms of the legislature, each with its BOE id and its ELI, the European legislation identifier that gives a norm a stable URL:

RankCount
Laws21
Organic laws13
Royal decree-laws67
Constitutional reforms2

The Congress file of approved initiatives is the starting point, but it mixes three things: the norms, the corrections of errors to those norms, and the resolutions that record whether a decree-law was validated or repealed. scripts/data/legislature/boe.mjs separates them. The BOE gives the id, the ELI and the dates. Its consolidated database covers only part of the norms, so the id is looked up in the daily summary of the publication day and the ELI in the document’s XML.

Two matches follow from that:

The two constitutional reforms are not in the Congress approved file, because they are not laws. We declare them by hand in CONSTITUTIONAL_REFORMS in boe.mjs: Article 49 (BOE-A-2024-3099) and Article 69.3 (BOE-A-2026-10881). The README records that the list was checked by searching the BOE summaries of the whole legislature, and --check verifies that each final vote exists in the votes file.

Government acts that never pass through Parliament

A law needs a vote. Most of what a government does does not. So the record has three more layers, each from a different place:

A decree approved by the Council of Ministers and published in the BOE appears in both feeds. They are different facts about different days, and Àgora keeps them apart. A rule stops the layers from overreaching: an act in section III can never prove a pledge about a law or about taxes, and a draft bill is at most a partial result.

Votes: 2,179 in 148 sessions

congreso/votes.json has every plenary vote the Congress publishes in JSON, from 19 September 2023 to 30 September 2026, with the totals and the tally for each group. Each vote gets a result, “approved” or “rejected”, taken from the Congress’s own assent field when it exists and otherwise from yes against no. 23 votes carry a needsCheck flag: the yes votes beat the no votes but fell short of the 176 of an absolute majority, and the text mentions an organic law, a statute, an investiture or an absolute majority, so we cannot tell whether one was required.

Public roll-call votes are the exception. For those the Congress publishes only a PNG of the totals, so the vote of each deputy is not in the open data. Ten votes remain in missing.json because the source gives no usable JSON. For the three investitures and the final vote on the Article 49 reform, we recovered the names from the Diario de Sesiones, the official transcript, with a script that checks that the names add up to the official count. The transcript does not say each deputy’s group, so we take it from their closest vote, and it does not list absentees.

Vote affinity: a count, not a judgement

The affinity page crosses the groups two by two. src/features/legislature/stats.ts defines a group’s stance in a vote as the option, yes, no or abstention, chosen by most of its deputies. A tie at the top, or no vote cast, means no stance. For each pair, affinityCounts counts the votes in which both have a stance and, of those, the ones where it is the same. The percentage is one divided by the other.

Two details matter when reading it. The Mixed Group is split into Podemos, BNG, CC and UPN, because it votes by deputy. And an abstention is a stance of its own, so a group that abstains does not agree with one that votes yes. Affinity measures how often two groups voted alike. It says nothing about why, and a high number may be only a long run of unanimous votes.

What the record leaves out

Laws, decrees and provisions carry the URL of their BOE page, and initiatives carry the Congress one, so any row can be checked at its source. The legislature page has the laws, the votes and the affinity matrix built on this record.