diff --git a/hub/management/commands/import_aid_alliance_power_postcodes.py b/hub/management/commands/import_aid_alliance_power_postcodes.py index d25861f98..553aa6375 100644 --- a/hub/management/commands/import_aid_alliance_power_postcodes.py +++ b/hub/management/commands/import_aid_alliance_power_postcodes.py @@ -17,11 +17,12 @@ class Command(BaseAreaImportCommand): power_postcodes = { "label": "Power Postcodes", - "description": "Description of Aid Alliance 'Power Postcode' activist groups", + "description": "Aid Alliance’s Power Postcodes are activist groups building a stronger connection between communities and MPs in key constituencies, on international development and the UK aid budget.", "data_type": "json", "category": "movement", "subcategory": "groups", - "source_label": "Aid Alliance", + "release_date": "July 2023", + "source_label": "Data from Aid Alliance.", "source": "https://aidalliance.org.uk/", "source_type": "api", "data_url": "https://www.google.com/maps/d/u/0/viewer?mid=15b_tQI0t58rLcBTgFytu2e73jyKrrxFr", @@ -35,10 +36,11 @@ class Command(BaseAreaImportCommand): power_postcode_counts = { "label": "Number of Power Postcodes", - "description": "Number of Aid Alliance 'Power Postcode' activist groups", + "description": "Aid Alliance’s Power Postcodes are activist groups building a stronger connection between communities and MPs in key constituencies, on international development and the UK aid budget.", "data_type": "integer", "category": "movement", - "source_label": "Aid Alliance", + "release_date": "July 2023", + "source_label": "Data from Aid Alliance.", "source": "https://aidalliance.org.uk/", "source_type": "api", "data_url": "https://www.google.com/maps/d/u/0/viewer?mid=15b_tQI0t58rLcBTgFytu2e73jyKrrxFr", diff --git a/hub/management/commands/import_air_quality_data.py b/hub/management/commands/import_air_quality_data.py index f42701c4e..79e86a2da 100644 --- a/hub/management/commands/import_air_quality_data.py +++ b/hub/management/commands/import_air_quality_data.py @@ -20,10 +20,11 @@ class Command(BaseCommand): message = "Importing constituency air-pollution data" defaults = { "label": "Air pollution", - "description": "Data relating to air pollution, recorded in 2021", + "description": "Metrics of pollutants associated with air pollution, aggregated per constituency, recorded automatically across the UK.", "data_type": "float", "category": "place", - "source_label": "Defra", + "source_label": "Data from Defra.", + "release_date": "2021", "is_range": True, "source": source_url, "source_type": "csv", diff --git a/hub/management/commands/import_area_age_data.py b/hub/management/commands/import_area_age_data.py index fbd92d1a6..6bbaddbb7 100644 --- a/hub/management/commands/import_area_age_data.py +++ b/hub/management/commands/import_area_age_data.py @@ -23,11 +23,12 @@ def handle(self, quiet=False, *args, **options): defaults = { "label": "Constituency age distribution", - "description": "Constituency age distribution", + "description": "Distribution of the ages of the constituents of each constituency.", "data_type": "percent", "category": "place", + "release_date": "2021", "is_range": True, - "source_label": "House of Commons Library", + "source_label": "Data from ONS (England and Wales), NRS (Scotland), and NISRA (Northern Ireland), collated by House of Commons Library.", "source": self.source_url, "source_type": "xlxs", "table": "areadata", diff --git a/hub/management/commands/import_area_countries.py b/hub/management/commands/import_area_countries.py index 358a05104..68326b6ad 100644 --- a/hub/management/commands/import_area_countries.py +++ b/hub/management/commands/import_area_countries.py @@ -1,3 +1,5 @@ +from datetime import date + from django.core.management.base import BaseCommand from tqdm import tqdm @@ -31,9 +33,10 @@ def create_data_type(self): name="country", defaults={ "data_type": "text", - "description": "The country that the constituency is in", + "description": "The country that the constituency is in.", + "release_date": str(date.today()), "label": "Country of the UK", - "source_label": "MapIt", + "source_label": "Data from mySociety.", "source": "https://mapit.mysociety.org/", "table": "areadata", "options": options, diff --git a/hub/management/commands/import_brexit_votes.py b/hub/management/commands/import_brexit_votes.py index d3716b548..7cb78812f 100644 --- a/hub/management/commands/import_brexit_votes.py +++ b/hub/management/commands/import_brexit_votes.py @@ -20,8 +20,9 @@ class Command(BaseImportFromDataFrameCommand): "label": "EU (Brexit) leave vote percentage", "description": "Percentage of constituents who voted to leave the EU in the 2016 referendum", "data_type": "percent", + "release_date": "February 2017", "category": "opinion", - "source_label": "UK Parliament", + "source_label": "Data from the House of Commons Library.", "source": "https://commonslibrary.parliament.uk/brexit-votes-by-constituency/", "source_type": "xlxs", "table": "areadata", diff --git a/hub/management/commands/import_cafod_supporters.py b/hub/management/commands/import_cafod_supporters.py index 4d7b87131..772baee2a 100644 --- a/hub/management/commands/import_cafod_supporters.py +++ b/hub/management/commands/import_cafod_supporters.py @@ -26,8 +26,9 @@ class Command(BaseImportFromDataFrameCommand): defaults = { "data_type": "integer", "category": "movement", - "source_label": "CAFOD", + "source_label": "Data from CAFOD.", "source": "https://cafod.org.uk", + "release_date": "February 2023", "source_type": "google sheet", "table": "areadata", "exclude_countries": ["Northern Ireland", "Scotland"], @@ -42,6 +43,7 @@ class Command(BaseImportFromDataFrameCommand): { "subcategory": "supporters_and_activists", "default_value": 10, + "description": "Number of CAFOD activists per constituency." }, ), "col": "activists", @@ -52,6 +54,7 @@ class Command(BaseImportFromDataFrameCommand): { "subcategory": "places_and_spaces", "default_value": 5, + "description": "Number of CAFOD parishes per constituency." }, ), "col": "parishes", @@ -62,6 +65,7 @@ class Command(BaseImportFromDataFrameCommand): { "subcategory": "places_and_spaces", "default_value": 5, + "description": "Number of CAFOD schools per constituency." }, ), "col": "schools", diff --git a/hub/management/commands/import_cen_nzsg_members.py b/hub/management/commands/import_cen_nzsg_members.py index 95c6e5137..63325a1fd 100644 --- a/hub/management/commands/import_cen_nzsg_members.py +++ b/hub/management/commands/import_cen_nzsg_members.py @@ -28,9 +28,10 @@ def create_data_types(self): name="cen_member", defaults={ "data_type": "bool", - "description": "Conservative Environment Network membership", + "description": "MPs in the CEN’s parliamentary caucus are united around conservative environmentalist principles and championing greater environmental action in Parliament.", "label": "MP membership of Conservative Environment Network (CEN)", - "source_label": "CEN, collated by mySociety", + "source_label": "Data from CEN, collated by mySociety.", + "release_date": "January 2023", "source": "https://www.cen.uk.com/our-caucus", "table": "person__persondata", "options": options, @@ -41,9 +42,10 @@ def create_data_types(self): name="nzsg_member", defaults={ "data_type": "bool", - "description": "Net Zero Scrutiny Group membership", - "label": "MP membership of Net Zero Scrutiny Group (NZSG)", - "source_label": "collated by DeSmog", + "description": "MPs in the Net Zero Scrutiny Group generally oppose the government’s net zero policies.", + "label": "MP supporter of Net Zero Scrutiny Group (NZSG)", + "source_label": "Data from public sources, collated by DeSmog.", + "release_date": "January 2023", "source": "https://www.desmog.com/net-zero-scrutiny-group/", "table": "person__persondata", "options": options, diff --git a/hub/management/commands/import_child_poverty_data.py b/hub/management/commands/import_child_poverty_data.py index d8733bdad..fc28ddf0a 100644 --- a/hub/management/commands/import_child_poverty_data.py +++ b/hub/management/commands/import_child_poverty_data.py @@ -20,11 +20,12 @@ class Command(BaseImportFromDataFrameCommand): data_sets = { "constituency_child_poverty": { "defaults": { - "label": "Child Poverty", - "description": "Estimates of percentages of children in poverty", + "label": "Estimated child poverty", + "description": "Percentage of children living in households with a net income (after housing costs) below 60% of the national median.", + "release_date": "March 2022", "data_type": "percent", "category": "place", - "source_label": "End Child Poverty", + "source_label": "Data from End Child Poverty, based on data from DWP/HMRC.", "source": source_url, "source_type": "xlxs", "data_url": data_url, diff --git a/hub/management/commands/import_christian_aid_group_locations.py b/hub/management/commands/import_christian_aid_group_locations.py index a7cfe21e9..b9f36ccdb 100644 --- a/hub/management/commands/import_christian_aid_group_locations.py +++ b/hub/management/commands/import_christian_aid_group_locations.py @@ -18,11 +18,12 @@ class Command(BaseAreaImportCommand): data_file = settings.BASE_DIR / "data" / "christian_aid_groups.csv" defaults = { "label": "Christian Aid groups", - "description": "Descriptions of Christian Aid Groups", + "description": "Descriptions of Christian Aid groups", "data_type": "json", "category": "movement", "subcategory": "groups", - "source_label": "Christian Aid", + "release_date": "April 2023", + "source_label": "Data from Christian Aid.", "source": "", "source_type": "api", "data_url": "", @@ -34,10 +35,11 @@ class Command(BaseAreaImportCommand): count_defaults = { "label": "Number of Christian Aid groups", - "description": "Number of Christian Aid Groups", + "description": "Number of Christian Aid groups", "data_type": "integer", + "release_date": "April 2023", "category": "movement", - "source_label": "Christian Aid", + "source_label": "Data from Christian Aid.", "source": "", "source_type": "api", "data_url": "", diff --git a/hub/management/commands/import_cost_of_living_mrp_data.py b/hub/management/commands/import_cost_of_living_mrp_data.py index 9d528bad3..05f520b4b 100644 --- a/hub/management/commands/import_cost_of_living_mrp_data.py +++ b/hub/management/commands/import_cost_of_living_mrp_data.py @@ -17,7 +17,8 @@ class Command(BaseImportFromDataFrameCommand): "data_type": "percent", "category": "opinion", "subcategory": "cost_of_living", - "source_label": "Survation 2023 MRP polling for 38Degrees", + "release_date": "March 2023", + "source_label": "Survation 2023 MRP polling, commissioned by 38Degrees.", "source": "https://home.38degrees.org.uk/2023/03/08/the-true-cost-of-this-crisis/", "source_type": "google sheet", "table": "areadata", @@ -42,6 +43,18 @@ class Command(BaseImportFromDataFrameCommand): "mental_health_cost_of_living": "Mental health has been impacted by the cost of living crisis", } + descriptions = { + "not_able_to_afford_mortgage_rent": "Estimated percentage of constituents worried about not being able to afford their mortgage or rent in the next year.", + "not_able_to_pay_energy_bills": "Estimated percentage of constituents worried about not being able to pay their energy bills in the next year.", + "worried_foodbank": "Estimated percentage of constituents worried about having to use a foodbank in the next year.", + "conservatives_dont_understand_impact": "Estimated percentage of constituents who think that Rishi Sunak and the Conservative Government do not understand the impact the cost of living crisis is having on people.", + "missed_bill_payment": "Estimated percentage of constituents that have missed a bill payment in the last six months.", + "missed_rent_payment": "Estimated percentage of constituents that have missed a rent payment in the last six months.", + "missed_credit_payment": "Estimated percentage of constituents that have missed a credit payment in the last six months.", + "cant_afford_heating": "Estimated percentage of constituents that have not been able to afford to turn the heating on at home when they have felt cold in the past month.", + "mental_health_cost_of_living": "Estimated percentage of constituents whose mental health has been impacted by the cost of living crisis.", + } + def add_data_sets(self, df): for col in df.columns: if col != "gss_code": @@ -50,6 +63,7 @@ def add_data_sets(self, df): "col": col, } self.data_sets[col]["defaults"]["label"] = self.labels[col] + self.data_sets[col]["defaults"]["description"] = self.descriptions[col] super().add_data_sets() diff --git a/hub/management/commands/import_efpc_fuel_poverty_data.py b/hub/management/commands/import_efpc_fuel_poverty_data.py index 0b6c0f715..1354ee98f 100644 --- a/hub/management/commands/import_efpc_fuel_poverty_data.py +++ b/hub/management/commands/import_efpc_fuel_poverty_data.py @@ -19,11 +19,12 @@ class Command(BaseImportFromDataFrameCommand): data_sets = { "efpc_constituency_fuel_poverty": { "defaults": { - "label": "Households in fuel poverty", - "description": "Percentage of households in fuel poverty", + "label": "Estimated households in fuel poverty", + "description": "Percentage of households in fuel poverty, including adjustment for Energy Price Guarantee, using National Energy Action base number of households in fuel poverty.", "data_type": "percent", + "release_date": "July 2023", "category": "place", - "source_label": "End Fuel Poverty Coalition", + "source_label": "Data from End Fuel Poverty Coalition.", "source": source_url, "source_type": "xlxs", "data_url": "", diff --git a/hub/management/commands/import_ethnicity_data.py b/hub/management/commands/import_ethnicity_data.py index a392d6408..8e73322cc 100644 --- a/hub/management/commands/import_ethnicity_data.py +++ b/hub/management/commands/import_ethnicity_data.py @@ -20,7 +20,8 @@ class Command(BaseCommand): "description": "Ethnicity as of the 2021 census (England and Wales)", "data_type": "percent", "category": "place", - "source_label": "House of Commons Library", + "release_date": "2021", + "source_label": "Data From House of Commons Library", "is_range": True, "source": source_url, "source_type": "xlxs", diff --git a/hub/management/commands/import_flood_risk_data.py b/hub/management/commands/import_flood_risk_data.py index b2c76454d..c32804140 100644 --- a/hub/management/commands/import_flood_risk_data.py +++ b/hub/management/commands/import_flood_risk_data.py @@ -14,10 +14,11 @@ class Command(BaseCommand): message = "Importing constituency flood risk data" defaults = { "label": "Flood risk from rivers or sea", - "description": "Data relating to risk of flooding from rivers or sea, recorded in 2018", + "description": "Data relating to risk of flooding from rivers or sea across the UK, aggregated by constituency.", + "release_date": "2018", "data_type": "percent", "category": "place", - "source_label": "Defra", + "source_label": "Data from Defra.", "is_range": True, "source_type": "csv", "table": "areadata", diff --git a/hub/management/commands/import_foe_groups.py b/hub/management/commands/import_foe_groups.py index d0d8a436e..f91f2742c 100644 --- a/hub/management/commands/import_foe_groups.py +++ b/hub/management/commands/import_foe_groups.py @@ -20,8 +20,9 @@ class Command(BaseLatLongImportCommand): "category": "movement", "subcategory": "groups", "label": "Active Friends of the Earth groups", - "description": "Active Friends of the Earth groups by constituency", - "source_label": "Friends of the Earth", + "description": "Descriptions of active Friends of the Earth groups by constituency.", + "source_label": "Data from Friends of the Earth.", + "release_date": "November 2022", "source": "https://friendsoftheearth.uk/", "source_type": "google sheet", "table": "areadata", diff --git a/hub/management/commands/import_foe_groups_count.py b/hub/management/commands/import_foe_groups_count.py index 9a50b7a71..2087531c0 100644 --- a/hub/management/commands/import_foe_groups_count.py +++ b/hub/management/commands/import_foe_groups_count.py @@ -19,7 +19,9 @@ class Command(BaseImportFromDataFrameCommand): "data_type": "integer", "category": "movement", "subcategory": "groups", - "source_label": "Friends of the Earth", + "description": "Number of Friends of the Earth groups per constituency.", + "release_date": "Novemeber 2022", + "source_label": "Data from Friends of the Earth.", "source": "https://friendsoftheearth.uk/", "source_type": "google sheet", "table": "areadata", diff --git a/hub/management/commands/import_foe_supporters.py b/hub/management/commands/import_foe_supporters.py index 8b7f9ff0c..a40d317fa 100644 --- a/hub/management/commands/import_foe_supporters.py +++ b/hub/management/commands/import_foe_supporters.py @@ -19,7 +19,8 @@ class Command(BaseImportFromDataFrameCommand): "data_type": "integer", "category": "movement", "subcategory": "supporters_and_activists", - "source_label": "Friends of the Earth", + "release_date": "November 2022", + "source_label": "Data from Friends of the Earth.", "source": "https://friendsoftheearth.uk/", "source_type": "google sheet", "table": "areadata", @@ -30,11 +31,11 @@ class Command(BaseImportFromDataFrameCommand): data_sets = { "constituency_foe_activists_count": { - "defaults": defaults, + "defaults": defaults.extend({"description": "Number of Friends of the Earth activists per constituency."}), "col": "activists", }, "constituency_foe_supporters_count": { - "defaults": defaults, + "defaults": defaults.extend({"description": "Number of Friends of the Earth supporters per constituency."}), "col": "supporters", }, } diff --git a/hub/management/commands/import_foodbank_count.py b/hub/management/commands/import_foodbank_count.py index a2a26cb79..e5eef3ce4 100644 --- a/hub/management/commands/import_foodbank_count.py +++ b/hub/management/commands/import_foodbank_count.py @@ -15,10 +15,11 @@ class Command(BaseConstituencyCountImportCommand): defaults = { "label": "Number of Trussell Trust foodbanks", - "description": "Number of Trussell Trust foodbanks", + "description": "Number of Trussell Trust foodbanks per constituency.", "data_type": "integer", "category": "movement", - "source_label": "Trussell Trust", + "release_date": "December 2022", + "source_label": "Data from Trussell Trust.", "source": "https://www.trusselltrust.org/", "source_type": "csv", "data_url": "", diff --git a/hub/management/commands/import_gbgw_events.py b/hub/management/commands/import_gbgw_events.py index c40dbca0f..6d0235bcf 100644 --- a/hub/management/commands/import_gbgw_events.py +++ b/hub/management/commands/import_gbgw_events.py @@ -28,11 +28,12 @@ def add_data_sets(self, df): name="constituency_gbgw_2022_event_count", defaults={ "label": "Number of Great Big Green Week 2022 events", - "description": "Number of Great Big Green Week 2022 events", + "description": "Number of Great Big Green Week 2022 events per constituency.", + "release_date": "October 2022", "data_type": "integer", "category": "movement", "subcategory": "events", - "source_label": "The Climate Coalition", + "source_label": "Data from The Climate Coalition.", "source": "https://greatbiggreenweek.com/", "source_type": "google sheet", "data_url": "", @@ -48,7 +49,7 @@ def add_data_sets(self, df): defaults={ "data_type": "integer", "label": "Number of Great Big Green Week 2022 events", - "description": "Number of Great Big Green Week 2022 events", + "description": "Number of Great Big Green Week 2022 events per constituency.", }, ) diff --git a/hub/management/commands/import_hnh_polling_data.py b/hub/management/commands/import_hnh_polling_data.py index 4b139ce1f..b0d65b84e 100644 --- a/hub/management/commands/import_hnh_polling_data.py +++ b/hub/management/commands/import_hnh_polling_data.py @@ -33,7 +33,8 @@ class Command(BaseImportFromDataFrameCommand): "data_type": "percent", "category": "opinion", "is_range": True, - "source_label": "Focaldata 2023 MRP polling for HOPE not hate", + "release_date": "April 2023", + "source_label": "Focaldata 2023 MRP polling, commissioned by HOPE not hate.", "source": "https://hopenothate.org.uk/research/", "source_type": "google sheet", "table": "areadata", diff --git a/hub/management/commands/import_imd_data.py b/hub/management/commands/import_imd_data.py index a3720f359..7c9b7c798 100644 --- a/hub/management/commands/import_imd_data.py +++ b/hub/management/commands/import_imd_data.py @@ -1,3 +1,5 @@ +from datetime import date + import pandas as pd from mysoc_dataset import get_dataset_url @@ -15,10 +17,11 @@ class Command(BaseImportFromDataFrameCommand): "constituency_imd": { "defaults": { "source": "https://mysociety.github.io/composite_uk_imd/", - "source_label": "mySociety", + "source_label": "Data from ONS (England and Wales), NRS (Scotland), and NISRA (Northern Ireland), collated and standardised by mySociety.", "name": "constituency_imd", - "description": "Index of Multiple Deprivation", + "description": "Deciles of deprivation, from 1 (most deprived) to 10 (least deprived). This uses a composite measure of deprivation (including income, employment, education, skills, health, crime, and housing) standardised across the countries of the UK.", "label": "Index of Multiple Deprivation (IMD)", + "release_date": str(date.today()), "data_type": "integer", "category": "place", "source_type": "csv", diff --git a/hub/management/commands/import_last_election_data.py b/hub/management/commands/import_last_election_data.py index 476af8088..9f7d2f1ab 100644 --- a/hub/management/commands/import_last_election_data.py +++ b/hub/management/commands/import_last_election_data.py @@ -1,3 +1,5 @@ +from datetime import date + from django.conf import settings from django.core.management.base import BaseCommand @@ -181,7 +183,8 @@ def create_data_types(self): "description": "The parliamentary party who came second in this constituency’s most recent election or by-election", "label": "Second placed party at most recent election", "category": "opinion", - "source_label": "UK Parliament", + "release_date": str(date.today()), + "source_label": "Data from UK Parliament.", "source": "https://parliament.uk/", "table": "areadata", "options": self.party_options, @@ -202,7 +205,8 @@ def create_data_types(self): "data_type": "json", "description": "The results of the last parliamentary election held in this constituency", "label": "Results of last election", - "source_label": "UK Parliament", + "release_date": str(date.today()), + "source_label": "Data from UK Parliament.", "source": "https://parliament.uk/", "category": "opinion", "table": "areadata", diff --git a/hub/management/commands/import_mp_engagement.py b/hub/management/commands/import_mp_engagement.py index aab636b6f..af3362339 100644 --- a/hub/management/commands/import_mp_engagement.py +++ b/hub/management/commands/import_mp_engagement.py @@ -38,7 +38,8 @@ def create_data_types(self): "data_type": "string", "description": "MP signed The Climate Coalition’s 2019 Net Zero Target joint letter", "label": "MP signed The Climate Coalition’s 2019 Net Zero Target joint letter", - "source_label": "The Climate Coalition", + "source_label": "Data from The Climate Coalition.", + "release_date": "June 2019", "source": "https://www.theclimatecoalition.org/joint-letter-2019", "table": "person__persondata", "options": options, @@ -59,7 +60,8 @@ def create_data_types(self): "data_type": "string", "description": "MP signed Possible’s Onshore Wind Energy open letter", "label": "MP signed Possible’s 2019 Onshore Wind Energy open letter", - "source_label": "Possible", + "source_label": "Data from Possible.", + "release_date": "October 2019", "source": "https://www.wearepossible.org/onshore-wind/latest/open-letter-from-mps-to-the-prime-minister", "table": "person__persondata", "options": options, diff --git a/hub/management/commands/import_mp_job_titles.py b/hub/management/commands/import_mp_job_titles.py index b0ca7cda3..9952a33a5 100644 --- a/hub/management/commands/import_mp_job_titles.py +++ b/hub/management/commands/import_mp_job_titles.py @@ -42,9 +42,10 @@ def create_data_type(self): name="job_titles", defaults={ "data_type": "text", - "description": "Positions such as cabinet and shadow minister roles, spokespeople, and whips", + "description": "Positions such as cabinet and shadow minister roles, spokespeople, and whips.", + "release_date": "December 2022", "label": "MP positions (job titles)", - "source_label": "Green Alliance", + "source_label": "Data from Green Alliance.", "source": "https://green-alliance.org.uk/", "table": "person__persondata", "comparators": DataSet.string_comparators(), diff --git a/hub/management/commands/import_mps.py b/hub/management/commands/import_mps.py index c4093c2ef..148282e1a 100644 --- a/hub/management/commands/import_mps.py +++ b/hub/management/commands/import_mps.py @@ -1,5 +1,6 @@ import urllib.request from collections import Counter +from datetime import date from django.conf import settings from django.core.files import File @@ -101,8 +102,9 @@ def import_mps(self): "data_type": "profile_id", "description": props["label"], "label": props["label"], + "release_date": str(date.today()), "source": "https://en.wikipedia.org/", - "source_label": "Wikipedia", + "source_label": "Data from Wikipedia.", "table": "person__persondata", "is_filterable": False, } diff --git a/hub/management/commands/import_mps_appg_data.py b/hub/management/commands/import_mps_appg_data.py index 13ada0fe1..250b1687a 100644 --- a/hub/management/commands/import_mps_appg_data.py +++ b/hub/management/commands/import_mps_appg_data.py @@ -1,3 +1,5 @@ +from datetime import date + from django.core.management.base import BaseCommand from mysoc_dataset import get_dataset_df, get_dataset_url @@ -77,9 +79,10 @@ def create_data_type(self): name="mp_appg_memberships", defaults={ "data_type": "text", - "description": "Membership in APPGs as published on the parliament website", + "description": "Membership in APPGs as published on the parliament website.", + "release_date": str(date.today()), "label": "MP APPG memberships", - "source_label": "UK Parliament", + "source_label": "Data from UK Parliament.", "source": "https://parliament.uk/", "table": "person__persondata", "options": options, diff --git a/hub/management/commands/import_mps_election_results.py b/hub/management/commands/import_mps_election_results.py index 80a388328..a240ea586 100644 --- a/hub/management/commands/import_mps_election_results.py +++ b/hub/management/commands/import_mps_election_results.py @@ -1,3 +1,5 @@ +from datetime import date + from django.core.management.base import BaseCommand import requests @@ -66,9 +68,10 @@ def create_data_types(self): defaults={ "data_type": "integer", "label": "MP majority", - "description": "Majority at last election", + "description": "Majority at last election.", + "release_date": str(date.today()), "source": "https://members-api.parliament.uk/", - "source_label": "UK Parliament", + "source_label": "Data from UK Parliament.", "comparators": DataSet.numerical_comparators()[::-1], "table": "person__persondata", "default_value": 1000, @@ -87,7 +90,8 @@ def create_data_types(self): "label": "Date MP last elected", "description": "Date of last election for an MP", "source": "https://members-api.parliament.uk/", - "source_label": "UK Parliament", + "release_date": str(date.today()), + "source_label": "Data from UK Parliament.", "table": "person__persondata", "comparators": DataSet.year_comparators(), "default_value": 2019, @@ -104,9 +108,10 @@ def create_data_types(self): defaults={ "data_type": "date", "label": "Date MP first elected", - "description": "Date an MP was first elected to current position", + "description": "Date an MP was first elected to current position.", + "release_date": str(date.today()), "source": "https://members-api.parliament.uk/", - "source_label": "UK Parliament", + "source_label": "Data from UK Parliament.", "table": "person__persondata", "comparators": DataSet.year_comparators(), "default_value": 2019, diff --git a/hub/management/commands/import_mps_relevant_votes.py b/hub/management/commands/import_mps_relevant_votes.py index ab16b5961..653fd4a89 100644 --- a/hub/management/commands/import_mps_relevant_votes.py +++ b/hub/management/commands/import_mps_relevant_votes.py @@ -147,15 +147,29 @@ def create_data_types(self, votes, edms): {"title": "Did not support", "shader": "gray-500"}, {"title": "Not in office", "shader": "gray-300"}, ] + descriptions = { + "1116_vote": "The final vote on what became the Environment Act 2021, establishing the UK’s new legal framework for environmental protection, post-Brexit.", + "1372_vote": "A Conservative majority saw this ban rejected, but a handful of Conservative MPs refused to vote on this topic.", + "58953_edm": "MPs who supported this Early Day Motion are likely to support other pro-climate and international climate justice policies.", + "60083_edm": "MPs who supported this Early Day Motion are likely to support other pro-climate and international climate justice policies." + } + + release_dates = { + "1116_vote": "October 2021", + "1372_vote": "October 2022", + "58953_edm": "September 2021", + "60083_edm": "September 2022" + } for vote in votes: vote_machine_name = self.get_machine_name(vote) ds, created = DataSet.objects.update_or_create( name=vote_machine_name, defaults={ "data_type": "string", - "description": f"MP vote on {vote['vote_name']}", + "description": descriptions[vote_machine_name], "label": f"MP vote on {vote['vote_name']}", - "source_label": "UK Parliament", + "release_date": release_dates[vote_machine_name], + "source_label": "Data from UK Parliament.", "source": "https://parliament.uk/", "table": "person__persondata", "options": vote_options, @@ -176,8 +190,9 @@ def create_data_types(self, votes, edms): name=edm_machine_name, defaults={ "data_type": "string", - "description": f"MP support for {edm['edm_name']}", + "description": descriptions[edm_machine_name], "label": f"MP support for {edm['edm_name']}", + "release_date": release_dates[edm_machine_name], "source_label": "UK Parliament", "source": "https://parliament.uk/", "table": "person__persondata", diff --git a/hub/management/commands/import_mps_select_committee_membership.py b/hub/management/commands/import_mps_select_committee_membership.py index f6eaf6102..1ff5d28d3 100644 --- a/hub/management/commands/import_mps_select_committee_membership.py +++ b/hub/management/commands/import_mps_select_committee_membership.py @@ -1,3 +1,5 @@ +from datetime import date + from django.core.management.base import BaseCommand import pandas as pd @@ -55,7 +57,8 @@ def create_data_types(self): "data_type": "text", "description": "Membership in Select Committees as published on the parliament website", "label": "MP Select Committee memberships", - "source_label": "UK Parliament", + "source_label": "Data from UK Parliament.", + "release_date": str(date.today()), "source": "https://parliament.uk/", "table": "person__persondata", "is_shadable": False, diff --git a/hub/management/commands/import_national_trust_members.py b/hub/management/commands/import_national_trust_members.py index 31ee4126a..9809fad67 100644 --- a/hub/management/commands/import_national_trust_members.py +++ b/hub/management/commands/import_national_trust_members.py @@ -21,7 +21,8 @@ class Command(BaseImportFromDataFrameCommand): "data_type": "integer", "category": "movement", "subcategory": "supporters_and_activists", - "source_label": "National Trust", + "release_date": "March 2023", + "source_label": "Data from National Trust.", "source": "https://www.nationaltrust.org.uk/", "source_type": "google sheet", "table": "areadata", diff --git a/hub/management/commands/import_nt_property_locations.py b/hub/management/commands/import_nt_property_locations.py index df55c57e9..e9cc2f58e 100644 --- a/hub/management/commands/import_nt_property_locations.py +++ b/hub/management/commands/import_nt_property_locations.py @@ -16,8 +16,9 @@ class Command(BaseAreaImportCommand): "description": "Names of National Trust properties", "data_type": "json", "category": "movement", + "release_date": "March 2023", "subcategory": "locations", - "source_label": "National Trust", + "source_label": "Data from National Trust.", "source": "https://www.nationaltrust.org.uk/", "source_type": "json", "data_url": "", @@ -32,8 +33,9 @@ class Command(BaseAreaImportCommand): "label": "Number of National Trust properties", "description": "Number of National Trust properties", "data_type": "integer", + "release_date": "March 2023", "category": "movement", - "source_label": "National Trust", + "source_label": "Data from National Trust.", "source": "https://www.nationaltrust.org.uk/", "source_type": "json", "data_url": "", diff --git a/hub/management/commands/import_onshore_windfarms.py b/hub/management/commands/import_onshore_windfarms.py index 8321281c9..9674328c2 100644 --- a/hub/management/commands/import_onshore_windfarms.py +++ b/hub/management/commands/import_onshore_windfarms.py @@ -1,3 +1,5 @@ +from datetime import date + from django.conf import settings from hub.models import AreaData, DataSet @@ -18,7 +20,8 @@ class Command(BaseConstituencyCountImportCommand): "description": "Number of onshore windfarms", "data_type": "integer", "category": "place", - "source_label": "Wikipedia", + "release_date": str(date.today()), + "source_label": "Data from Wikipedia.", "source": "https://en.wikipedia.org/wiki/List_of_onshore_wind_farms_in_the_United_Kingdom", "source_type": "api", "data_url": "https://en.wikipedia.org/wiki/List_of_onshore_wind_farms_in_the_United_Kingdom", diff --git a/hub/management/commands/import_onward_polling_data.py b/hub/management/commands/import_onward_polling_data.py index d97f2b5ad..171029b2a 100644 --- a/hub/management/commands/import_onward_polling_data.py +++ b/hub/management/commands/import_onward_polling_data.py @@ -26,8 +26,9 @@ class Command(BaseImportFromDataFrameCommand): defaults = { "data_type": "integer", "category": "opinion", - "source_label": "Public First, commissioned by Onward UK", - "source": "https://www.ukonward.com/", + "source_label": "Public First MRP Polling, commissioned by Onward UK.", + "release_date": "July 2022", + "source": "https://www.publicfirst.co.uk/new-public-first-polling-for-onward.html", "source_type": "google sheet", "subcategory": "net_zero_support", "table": "areadata", @@ -39,19 +40,35 @@ class Command(BaseImportFromDataFrameCommand): data_sets = { "constituency_nz_support": { - "defaults": defaults, + "defaults": defaults.copy().extend( + { + "description": "Estimated percentage of constituents who support net zero." + } + ), "col": "support net zero", }, "constituency_nz_neutral": { - "defaults": defaults, + "defaults": defaults.extend( + { + "description": "Estimated percentage of constituents who neither support nor oppose net zero." + } + ), "col": "neither support nor oppose net zero", }, "constituency_nz_oppose": { - "defaults": defaults, + "defaults": defaults.extend( + { + "description": "Estimated percentage of constituents who oppose net zero." + } + ), "col": "oppose net zero", }, "constituency_cc_high": { - "defaults": defaults.copy(), + "defaults": defaults.copy().extend( + { + "description": "Estimated percentage of constituents who consider climate change a high priority." + } + ), "col": "consider climate change a high priority", }, } diff --git a/hub/management/commands/import_popular_petitions.py b/hub/management/commands/import_popular_petitions.py index d4908d255..c8ce2abce 100644 --- a/hub/management/commands/import_popular_petitions.py +++ b/hub/management/commands/import_popular_petitions.py @@ -1,4 +1,5 @@ import json +from datetime import date from django.conf import settings @@ -16,7 +17,8 @@ class Command(BaseAreaImportCommand): "constituency_popular_petitions": { "defaults": { "source": "https://petition.parliament.uk/", - "source_label": "UK Government and Parliament Petitions", + "source_label": "Data from UK Government and Parliament Petitions.", + "release_date": str(date.today()), "name": "constituency_popular_petitions", "description": "Popular petitions", "label": "Popular petitions", diff --git a/hub/management/commands/import_red_blue_wall_constituencies.py b/hub/management/commands/import_red_blue_wall_constituencies.py index 7132c2bc2..635164e66 100644 --- a/hub/management/commands/import_red_blue_wall_constituencies.py +++ b/hub/management/commands/import_red_blue_wall_constituencies.py @@ -17,9 +17,9 @@ class Command(BaseImportFromDataFrameCommand): defaults = { "label": "Red or Blue Wall constituency", - "description": "Red Wall data from Political Insight, and Blue Wall data from the Financial Times, collated by Green Alliance", - "data_type": "text", + "description": "Data from Political Insight (Red Wall), and the Financial Times (Blue Wall), collated by Green Alliance.", "category": "place", + "release_date": "February 2023", "source_label": "Green Alliance", "source": "https://green-alliance.org.uk/", "source_type": "google sheet", diff --git a/hub/management/commands/import_renewables_polling_data.py b/hub/management/commands/import_renewables_polling_data.py index ad306debf..b4b6b4204 100644 --- a/hub/management/commands/import_renewables_polling_data.py +++ b/hub/management/commands/import_renewables_polling_data.py @@ -23,6 +23,21 @@ "believe-block-onshore-wind": "government_action", } +DESCRIPTIONS = { + "would-change-party": "Estimated percentage of constituents that are considering voting for a different party in the next General Election to the one they voted for in 2019.", + "less-favourable-conservative-weaken-climate": "Estimated percentage of constituents that would be less favourable towards the Conservative Party if they chose to weaken climate policies.", + "prefer-conservative-leader-invest-renewables": "Estimated percentage of constituents that would prefer the next leader of the Conservative Party to invest in renewable energy.", + "support-offshore-wind": "Estimated percentage of constituents that support offshore wind as energy generation.", + "support-onshore-wind": "Estimated percentage of constituents that support onshore wind as energy generation.", + "support-solar": "Estimated percentage of constituents that support solar power as energy generation.", + "support-tidal": "Estimated percentage of constituents that support tidal energy as energy generation.", + "support-wave": "Estimated percentage of constituents that support wave energy as energy generation.", + "support-nuclear": "Estimated percentage of constituents that support nuclear energy as energy generation.", + "support-local-renewable": "Estimated percentage of constituents who support renewable energy projects in their local area.", + "believe-gov-renewable-invest-increase": "Estimated percentage of constituents that believe the Govt has increased investment in renewables over the past 5 years.", + "believe-gov-renewable-should-invest": "Estimated percentage of constituents that believe that the Govt should use wind and solar farms to reduce energy bills.", + "believe-block-onshore-wind": "Estimated percentage of constituents that believe that the Govt should continue the block on onshore wind development.", +} class Command(BaseImportFromDataFrameCommand): help = "Import polling data about support for renewables" @@ -80,14 +95,15 @@ def add_data_sets(self, df): continue label = self.make_label_from_question(self.column_map[column]) - description = self.column_map[column] + description = DESCRIPTIONS[column] defaults = { "label": label, "description": description, "data_type": "percent", "category": "opinion", "subcategory": SUBCATEGORIES_DICT[column], - "source_label": "Survation, commissioned by RenewableUK", + "source_label": "Survation MRP polling, commissioned by RenewableUK.", + "release_date": "September 2022", "source": "https://www.renewableuk.com/news/615931/Polling-in-every-constituency-in-Britain-shows-strong-support-for-wind-farms-to-drive-down-bills.htm", "source_type": "google sheet", "data_url": self.data_url, diff --git a/hub/management/commands/import_ruc_data.py b/hub/management/commands/import_ruc_data.py index 565d3ae38..d587bbab4 100644 --- a/hub/management/commands/import_ruc_data.py +++ b/hub/management/commands/import_ruc_data.py @@ -1,3 +1,5 @@ +from datetime import date + import pandas as pd from mysoc_dataset import get_dataset_url @@ -15,10 +17,11 @@ class Command(BaseImportFromDataFrameCommand): "constituency_ruc": { "defaults": { "label": "Urban Rural Classification", - "description": "Urban Rural Classification", + "description": "A composite measure of 'ruralness' (based population density, settlement size, and drive times) standardised across the countries of the UK.", "data_type": "text", "category": "place", - "source_label": "mySociety", + "release_date": str(date.today()), + "source_label": "Data from ONS (England and Wales), NRS (Scotland), and NISRA (Northern Ireland), collated and standardised by mySociety.", "source": "https://mysociety.github.io/uk_ruc/", "source_type": "csv", "table": "areadata", diff --git a/hub/management/commands/import_save_the_children_shop_count.py b/hub/management/commands/import_save_the_children_shop_count.py index 6577e0f39..12e87bfc3 100644 --- a/hub/management/commands/import_save_the_children_shop_count.py +++ b/hub/management/commands/import_save_the_children_shop_count.py @@ -19,7 +19,8 @@ class Command(BaseConstituencyCountImportCommand): "data_type": "integer", "category": "movement", "subcategory": "places_and_spaces", - "source_label": "Save the Children", + "source_label": "Data from Save the Children.", + "release_date": "July 2023", "source": "https://www.savethechildren.org.uk/", "source_type": "csv", "data_url": "", diff --git a/hub/management/commands/import_socio_economic_status_data.py b/hub/management/commands/import_socio_economic_status_data.py index 7522ed59b..03fbca7ad 100644 --- a/hub/management/commands/import_socio_economic_status_data.py +++ b/hub/management/commands/import_socio_economic_status_data.py @@ -14,11 +14,12 @@ class Command(BaseCommand): message = "Importing constituency socio-economic data" defaults = { - "label": "Socio-Economic Status", - "description": "Socio-economic status as of the 2021 census", + "label": "Socio-economic status", + "description": "England and Wales only.", "data_type": "percent", "category": "place", - "source_label": "House of Commons Library", + "release_date": "2021", + "source_label": "Data from the 2021 census, collated by House of Commons Library.", "is_range": True, "source": source_url, "source_type": "xlxs", diff --git a/hub/management/commands/import_tearfund_churches.py b/hub/management/commands/import_tearfund_churches.py index 7805a34e4..858151056 100644 --- a/hub/management/commands/import_tearfund_churches.py +++ b/hub/management/commands/import_tearfund_churches.py @@ -19,7 +19,8 @@ class Command(BaseConstituencyCountImportCommand): "data_type": "integer", "category": "movement", "subcategory": "places_and_spaces", - "source_label": "Tearfund", + "release_date": "July 2023", + "source_label": "Data from Tearfund.", "source": "https://www.tearfund.org/", "source_type": "csv", "data_url": "", diff --git a/hub/management/commands/import_wi_group_locations.py b/hub/management/commands/import_wi_group_locations.py index e9acdc366..5a62af2dc 100644 --- a/hub/management/commands/import_wi_group_locations.py +++ b/hub/management/commands/import_wi_group_locations.py @@ -1,3 +1,4 @@ +from datetime import date from django.conf import settings import pandas as pd @@ -17,7 +18,8 @@ class Command(BaseAreaImportCommand): "data_type": "json", "category": "movement", "subcategory": "groups", - "source_label": "Woman’s Institute", + "release_date": str(date.today()), + "source_label": "Data from the WI.", "source": "https://www.thewi.org.uk/", "source_type": "api", "data_url": "https://wi-search.squiz.cloud/s/search.json?collection=nfwi-federations&profile=_default&query=!null&sort=prox&sort=prox&start_rank=1&origin=54.093409,-2.89479&maxdist=9999&num_ranks=9999", @@ -34,7 +36,8 @@ class Command(BaseAreaImportCommand): "description": "Number of Women's Institute Groups", "data_type": "integer", "category": "movement", - "source_label": "Woman’s Institute", + "release_date": str(date.today()), + "source_label": "Data from the WI.", "source": "https://www.thewi.org.uk/", "source_type": "api", "data_url": "https://wi-search.squiz.cloud/s/search.json?collection=nfwi-federations&profile=_default&query=!null&sort=prox&sort=prox&start_rank=1&origin=54.093409,-2.89479&maxdist=9999&num_ranks=9999", diff --git a/hub/management/commands/import_wwf_supporters.py b/hub/management/commands/import_wwf_supporters.py index b5f45478e..1ac082416 100644 --- a/hub/management/commands/import_wwf_supporters.py +++ b/hub/management/commands/import_wwf_supporters.py @@ -19,7 +19,8 @@ class Command(BaseImportFromDataFrameCommand): "data_type": "integer", "category": "movement", "subcategory": "supporters_and_activists", - "source_label": "WWF", + "release_date": "February 2023", + "source_label": "Data from WWF.", "source": "https://www.wwf.org.uk/", "source_type": "google sheet", "table": "areadata",