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

auto convert old cons data to new cons data #365

Merged
merged 18 commits into from
Jan 16, 2024

Conversation

struan
Copy link
Member

@struan struan commented Dec 5, 2023

This adds a script, plus updates all the importers to automatically convert suitable datasets from the old constituency data to the upcoming ones. Essentially it does anything that is a percentage and is evenly distributed over the area or people in the area. It also adds a notice to indicate where a dataset has been automatically converted:

Screenshot 2024-01-11 at 11 39 58

Fixes #360

@struan struan force-pushed the multiple-geometry-staging branch from 27202e4 to e53be2b Compare December 6, 2023 17:02
Copy link

codecov bot commented Dec 6, 2023

Codecov Report

Attention: 58 lines in your changes are missing coverage. Please review.

Comparison is base (1030abd) 84.51% compared to head (85de704) 83.44%.

❗ Current head 85de704 differs from pull request most recent head 9602176. Consider uploading reports for the commit 9602176 to get more accurate results

Files Patch % Lines
hub/transformers.py 24.52% 40 Missing ⚠️
hub/models.py 71.42% 8 Missing and 2 partials ⚠️
hub/management/commands/base_importers.py 64.28% 4 Missing and 1 partial ⚠️
hub/views/area.py 89.47% 1 Missing and 1 partial ⚠️
utils/constituency_mapping.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           multiple-geometry-staging     #365      +/-   ##
=============================================================
- Coverage                      84.51%   83.44%   -1.08%     
=============================================================
  Files                             97      100       +3     
  Lines                           2829     2942     +113     
  Branches                         285      300      +15     
=============================================================
+ Hits                            2391     2455      +64     
- Misses                           369      414      +45     
- Partials                          69       73       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@struan struan force-pushed the 360-new-cons-data-transform branch 2 times, most recently from 0f63475 to 80163e0 Compare December 7, 2023 16:30
@struan struan force-pushed the 360-new-cons-data-transform branch 2 times, most recently from 44fa046 to 56c2e16 Compare December 11, 2023 15:51
@struan struan force-pushed the multiple-geometry-staging branch from e53be2b to 40908c3 Compare December 11, 2023 16:22
@struan struan force-pushed the 360-new-cons-data-transform branch from 56c2e16 to 31d415e Compare December 11, 2023 16:32
@struan struan mentioned this pull request Jan 9, 2024
11 tasks
@struan struan force-pushed the multiple-geometry-staging branch from 6bec7e1 to 59a6179 Compare January 11, 2024 10:07
@struan struan force-pushed the 360-new-cons-data-transform branch from b257c24 to a535563 Compare January 11, 2024 10:32
@struan struan changed the title WIP auto convert old cons data to new cons data auto convert old cons data to new cons data Jan 11, 2024
@struan struan force-pushed the 360-new-cons-data-transform branch from d2df82f to 9f7f2f2 Compare January 11, 2024 11:43
@struan struan marked this pull request as ready for review January 11, 2024 11:44
@zarino zarino self-assigned this Jan 11, 2024
@zarino zarino self-requested a review January 11, 2024 14:11
@struan struan force-pushed the 360-new-cons-data-transform branch from 9f7f2f2 to 7f553b3 Compare January 11, 2024 14:50
Copy link
Member

@zarino zarino left a comment

Choose a reason for hiding this comment

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

@struan I’ve attempted to tidy up the display of the "disclaimer" in the template, by moving it into the model. My instinct, though, is that the string explaining the conversion should be set by the script that actually does the conversion, rather than us having to guess which generation was converted to/from what.

In fact, perhaps DataType.auto_converted (a BooleanField) should actually be DataType.auto_converted_from_area_type (a ForeignKey to AreaType, defaulting to None) so that the view/template can automatically fetch the name and details of the AreaType from which the dataset was auto-converted?

to be used if the data type has been created by an auto conversion
between geometry types
@struan struan force-pushed the 360-new-cons-data-transform branch from ae54fdf to 6f7948e Compare January 16, 2024 12:09
@struan
Copy link
Member Author

struan commented Jan 16, 2024

I've made some updates which I think answer most of your issues. I'm not totally sure about the Foreign key thing because I'm not sure what we'd do with it.

Copy link
Member

@zarino zarino left a comment

Choose a reason for hiding this comment

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

@struan I’ve committed a new page that explains the conversion process, and have linked to that from the disclaimers on the area page. Could you check the links all work fine, and then merge if you’re happy?

@struan struan force-pushed the 360-new-cons-data-transform branch from 85de704 to 9602176 Compare January 16, 2024 16:39
@struan struan merged commit 9602176 into multiple-geometry-staging Jan 16, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants