Skip to content

CampaignLab/constituency-explorer

Repository files navigation

Constituency Explorer

A Laravel app for people to explore the new UK constituency boundaries and see what falls within the boundaries (Schools, Hospitals, Places of Worship, etc.).

Commissioned by Campaign Lab and built by C6 Digital.

Installation

Tip

To get setup easily with Laravel, we suggest using Herd and DBngin

  1. Clone repository.
  2. Install dependencies.
npm ci
composer install
  1. Create .env
cp .env.example .env
  1. Generate app key
php artisan key:generate
  1. Run migrations
php artisan migrate

Import data

On a fresh installation, you can use the following command to import all datasets at once:

php artisan import:data

Note

You can run the import scripts separately if you wish - they are called individually within ImportDataCommand.php. They are listed out in the Datasets section

Datasets

Tip

To get the Schema for datasets, see the linked "Import command" and check what $row fields it's using

Important

Shortly before the boundary change in July 2024, the GSS codes for five constituencies were changed (this was resolved manually - for more details, see: issue #35).

Geographical Datasets

Dataset Source Fixture file Import command
New (post-July 2024) constituencies ONS parliament_con_2025.csv import:constituencies
Constituency populations Unknown (Just Register) constituencies_population.csv import:constituencies-population
Constituency shapefiles - pcon24.geojson import:constituency-geojson
Parliament constituency IDs UK Parliament API - import:parliament-constituency-ids
Old (pre-July 2024) constituencies ONS Westminster_Parliamentary_Constituencies[...].csv import:old-constituencies
Old constituency overlaps MySociety PARL10_PARL25_combo_overlap.csv import:old-constituency-overlaps
Local Authorities Districts ONS local_authority_districts.csv import:local-authorities
Constituency -> Local authority mappings MySociety overlap_local_authorities_cons_2025.csv import:constituency-local-authority-pivot-data

Place Datasets

Note

All datasets are expected to use the UTF-8 character encoding, except schools-england.csv, which is parsed using the ISO-8859-1 encoding.

Tip

To get the Schema for datasets, see the linked "Import command" and check what $row fields it's using

Dataset Source Fixture file Import command
Charities CharityBase CharityBase_6a177[...].csv import:charities
Towns Unknown (Campaign Lab) uktowns.csv import:towns
Constituency town mappings - towns-map.csv import:constituency-town-mappings
Dentists (England) Unknown (CampaignLab) dentists-england.csv import:dentists
Hospitals (England) Unknown (CampaignLab) hospitals-england.csv import:english-hospitals
Hospitals (Scotland) Unknown (CampaignLab) hospitals-scotland.csv import:scottish-hospitals
Schools (England) Gov.uk schools-england.csv import:english-schools
Schools (Scotland) Gov.uk schools-scotland.xlsx import:scottish-schools
Community centres - community-centres.csv import:community-centres
Places of worship - places-of-worship.csv import:places-of-worship
Green spaces - green-spaces.csv import:green-spaces
Local media - local-media.csv import:local-media

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •