Skip to content

FullFact/election-2026-candidate-analysis

Repository files navigation

Elections 2026 data

Get candidate data into the right format for the AI tools.

This takes raw CSV data from Democracy Club and outputs it as a JSON file in various formats to be used in the AI tools.

Set up

  • Clone the repo git clone https://github.com/FullFact/election-2026-candidate-analysis.git
  • Go to the new election-2026-candidate-analysis folder you have just cloned
  • uv sync to update packages
  • pre-commit install to add pre-commit

Running the code

To run the code: uv run python src/main.py. The output JSON files will be in the data_outputs folder.

If you can't run this code locally, you can run it in GitHub Codespaces. Go to: https://github.com/codespaces/new - select this repo and your chosen branch.

Updating the data

The current code downloads all election candidate data for 7th March 2026 so you do not have to do it manually.

If you wish to read the CSV data from a file there is an option to do that (use read_csv_data_from_file).

The raw_data folder contains existing raw data from the Democracy Club.

This data from Democracy Club is regularly updated, you can download the latest data from here if you wish: https://candidates.democracyclub.org.uk/data/.

Tests

uv run pytest .

Outstanding issues

  • What do we do about duplicate candidates for a given election? There is at least one example of a duplicate candidate in the same election list (looks like they are standing in 2 seats - ID 113862). You might want to deal with this and uncomment the code that checks for this in the validate_election_data function.
  • Have assumed social media doesn't include Mastodon (though that is available - but so far not included).
  • At present it includes candidates for all elections on 7th May (inc local elections) - do we need to remove the local ones?

About

Data analysis of public data on candidates from elections happening across the UK.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors