Skip to content
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

Add the AreaType model #310

Closed
wants to merge 7 commits into from
Closed

Conversation

alexander-griffen
Copy link
Contributor

This PR adds the AreaType model, creates an object for the 2010 constituency boundaries, and then backfills the current Area objects with the new AreaType object. This is split into several migrations to allow for not-null constraints.

This PR does not totally complete #256, but is the first step towards doing so. Currently, it makes no visible changes to the website.

@alexander-griffen alexander-griffen self-assigned this Aug 3, 2023
@alexander-griffen alexander-griffen force-pushed the 256-multiple-geographies branch 3 times, most recently from ace3c7b to 4e50dc7 Compare August 3, 2023 16:10
@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Merging #310 (700f260) into main (8243066) will decrease coverage by 0.23%.
The diff coverage is 77.77%.

@@            Coverage Diff             @@
##             main     #310      +/-   ##
==========================================
- Coverage   84.59%   84.36%   -0.23%     
==========================================
  Files          76       83       +7     
  Lines        2512     2578      +66     
  Branches      250      254       +4     
==========================================
+ Hits         2125     2175      +50     
- Misses        326      340      +14     
- Partials       61       63       +2     
Files Changed Coverage Δ
hub/migrations/0049_add_dataset_release_date.py 100.00% <ø> (ø)
hub/views/explore.py 63.54% <ø> (ø)
hub/migrations/0045_remove_area_type.py 50.00% <50.00%> (ø)
hub/migrations/0047_backfill_area_types.py 56.25% <56.25%> (ø)
...b/migrations/0043_create_2010_constituency_type.py 80.00% <80.00%> (ø)
hub/management/commands/import_areas.py 100.00% <100.00%> (ø)
hub/migrations/0042_areatype.py 100.00% <100.00%> (ø)
hub/migrations/0044_alter_area_area_type.py 100.00% <100.00%> (ø)
hub/migrations/0046_alter_area_area_type.py 100.00% <100.00%> (ø)
hub/migrations/0048_alter_area_area_type.py 100.00% <100.00%> (ø)
... and 3 more

@alexander-griffen alexander-griffen force-pushed the 256-multiple-geographies branch from 4e50dc7 to 290f052 Compare August 3, 2023 16:40
@alexander-griffen alexander-griffen marked this pull request as ready for review August 3, 2023 16:43
Copy link
Member

@struan struan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay for multi-step migration process 🎉

struan and others added 7 commits August 14, 2023 10:32
So we can keep track of, and display, when the data was released.
The file which is used to match the 'gridcode' value to the constituency
code was created using shapefiles of constituencies re-projected onto
the same projection as the defra data (BNG 27700), and one example of
the gridcodes to x and y values as found from an arbitrary input file
for this import. QGIS was used to find where the points were within the
boundaries of the constituencies, and indeed which constituencies. To
prevent this process having to be repeated, the output file is stored
in the Drive
This change includes an addition of a filter, which allows for rendering
of subscript written in shorthand
(https://pages.uoregon.edu/ncp/Courses/MathInPlainTextEmail.html).

Currently, this new filter only works if there is only one instance of
subscript, and that it's at the end of the string.
This commit adds the AreaType model, creates an object for the 2010
constituency boundaries, and then backfills the current Area objects
with the new AreaType object. This is split into several migrations to
allow for not-null constraints
This commit is a combination of altering tests and fixtures to
accomodate schema changes, as well as altering some of the views
themselves to accomodate these changes.
@struan
Copy link
Member

struan commented Aug 14, 2023

Merged in db4a60a

@struan struan closed this Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants