-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Geographies #331
Multiple Geographies #331
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## multiple-geometry-staging #331 +/- ##
=============================================================
+ Coverage 82.50% 82.82% +0.32%
=============================================================
Files 87 90 +3
Lines 2669 2725 +56
Branches 275 278 +3
=============================================================
+ Hits 2202 2257 +55
Misses 404 404
- Partials 63 64 +1 ☔ View full report in Codecov by Sentry. |
Fill the existing constituencies with the correct AreaType (2010 parliamentary constituencies)
af1a72c
to
5565933
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexander-griffen I‘ve cherry-picked the five useful commits out of your original branch and onto main
, so the PR diff looks much cleaner now! (Your original branch has been backed up to 256-multiple-geographies-backup
in case we ever need it again.)
The "This is a 2010 constituency" card at the top of the Area page looks fine.
I’ll sort out a constituency generation switcher on the Explore page next week.
In the meantime, I‘ve left a few questions / comments inline.
print("Importing Areas") | ||
df = pd.read_csv(self.data_file) | ||
area_type, created = AreaType.objects.get_or_create( | ||
name="2023 Parliamentary Constituency", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we’ve made a decision, elsewhere (eg: https://pages.mysociety.org/2025-constituencies/) to call these "2025" constituencies. So should we use 2025 Parliamentary Constituency
and WMC25
here? /cc @ajparsons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I discussed this with @ajparsons and we think we should refer to these new constituencies as either "2025 constituencies" or "Future constituencies" (if we want to hedge our bets) when we’re limited for space, and "Constituencies at the next election" if we have more space.
I see @struan has already modified import_new_constituencies.py
to use the latter 👍
@@ -388,6 +388,17 @@ def shader_value(self, area): | |||
return None, None, None | |||
|
|||
|
|||
class AreaType(models.Model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS @alexander-griffen I learned a few weeks ago that you can pass a string to models.ForeignKey()
when you want to refer to a model that’s defined further down in the file. So, in this case, a line like…
area_type = models.ForeignKey("AreaType", on_delete=models.CASCADE, null=True)
…would have saved you having to shuffle this Class further up the file.
hub/templates/hub/area.html
Outdated
@@ -39,10 +39,40 @@ <h1 class="m-0">{{ area.name }}</h1> | |||
</div> | |||
</div> | |||
<div class="col-lg-9 offset-xl-1"> | |||
|
|||
{% if area_type == "WMC" %} | |||
<div class="card flex-grow-1 dataset-card"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’d be good to have one of these cards on the WMC23
pages too, but going the other way (ie: saying "This is a 2025 (2023?) constituency … it replaced the following 2010 constituency/ies: …"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to fix this as part of #337
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks fine. one comment about the geometry stuff which is hampered by lack of data.
A further issue is that GSS codes turn out not be unique across the two different boundary sets so we need to update import scripts etc to distinguish areas based on GSS/Name and area type. I am going to add some methods to the Area model for looking up areas so we can consolidate this in once place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@struan @alexander-griffen I’ve added a commit that fixes a few of the comments I left last week. The other open comments are all beyond my ability.
Generally, this seems ok. It’d be nice to get those outstanding comments addressed though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@struan I think this is all looking good so far. Obviously we’re missing all the WMC23 datasets, so the Area page for a WMC23 constituency looks particularly empty/broken. Do you want to implement updated import scripts as part of this PR, or create a separate ticket and PR for it?
Note that this does currently break the table and map
This is to ensure urls work as expected
mostly to default the area_type
- Only show MP section and nav link on WMC pages (ie: not WMC23). - Fix messed up indentation on "This is a 2010 constituency" info box.
863476e
to
228f87c
Compare
So far, this PR:
What is required is:
For #256