diff --git a/hub/templates/hub/area.html b/hub/templates/hub/area.html
index 475f0b976..80e2813a5 100644
--- a/hub/templates/hub/area.html
+++ b/hub/templates/hub/area.html
@@ -39,10 +39,40 @@
-
+ {% if area_type == "WMC" %}
+
+
+
+
At the next election, people from this constituency will be divided into {{ overlap_constituencies|length|apnumber }} constituenc{% if overlap_constituencies|length_is:1 %}y{% else %}ies{% endif %}:
+
+
+ {% for overlap_constituency in overlap_constituencies %}
+
+ {{ overlap_constituency.area }} |
+ Covers approximately {{ overlap_constituency.pop_overlap }}% of this constituency's population, and {{ overlap_constituency.area_overlap }}% of this constituency's area. |
+
+ {% endfor %}
+
+
+
+
+ {% endif %}
MP
- {% include 'hub/area/_mp_data.html' with mp_data=mp %}
+ {% if area_type == "WMC23" %}
+
+
+
+
At the next election, an MP will be voted into this constituency, however until then, there is no MP.
+
+
+ {% else %}
+ {% include 'hub/area/_mp_data.html' with mp_data=mp %}
+ {% endif %}
{% if categories.opinion %}
diff --git a/hub/views/area.py b/hub/views/area.py
index aa30034b2..85072a832 100644
--- a/hub/views/area.py
+++ b/hub/views/area.py
@@ -5,6 +5,8 @@
from django.shortcuts import get_object_or_404, redirect
from django.views.generic import DetailView, TemplateView, View
+from mysoc_dataset import get_dataset_df
+
from hub.mixins import TitleMixin
from hub.models import (
Area,
@@ -16,6 +18,7 @@
UserDataSets,
)
from utils import is_valid_postcode
+from utils.constituency_mapping import get_overlap_df
from utils.mapit import (
BadRequestException,
ForbiddenException,
@@ -176,8 +179,36 @@ def get_tags(self, mp_data, area_data):
return tags
+ def get_overlap_info(self, **kwargs):
+ # Get lookup between short code and GSS
+ constituency_lookup = (
+ get_dataset_df(
+ repo_name="2025-constituencies",
+ package_name="parliament_con_2025",
+ version_name="latest",
+ file_name="parl_constituencies_2025.csv",
+ )
+ .set_index("short_code")["gss_code"]
+ .to_dict()
+ )
+
+ df = get_overlap_df("PARL10", "PARL25")
+ overlap_constituencies = df.query("PARL10 == @self.object.gss")
+ overlap_constituencies = [
+ {
+ "area": Area.objects.get(gss=constituency_lookup[row["PARL25"]]),
+ "pop_overlap": int(row["percentage_overlap_pop"] * 100),
+ "area_overlap": int(row["percentage_overlap_area"] * 100),
+ }
+ for index, row in overlap_constituencies.iterrows()
+ ]
+ return overlap_constituencies
+
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
+
+ context["overlap_constituencies"] = self.get_overlap_info()
+ context["area_type"] = str(self.object.area_type)
try:
context["mp"] = {"person": Person.objects.get(area=self.object)}