-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a generic processing command to turn the spreadsheet of events into one with constituencies. Add a new command for the 2024 events. Fixes #593
- Loading branch information
Showing
4 changed files
with
79 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from django.conf import settings | ||
|
||
from .base_generators import BaseLatLonGeneratorCommand | ||
|
||
|
||
class Command(BaseLatLonGeneratorCommand): | ||
help = "Generate CSV file of GBGW events with area name'" | ||
message = "Generating a CSV of areas for GBGW events" | ||
|
||
row_name = "Organisation" | ||
|
||
def add_arguments(self, parser): | ||
super().add_arguments(parser) | ||
|
||
parser.add_argument( | ||
"--year", | ||
required=True, | ||
action="store", | ||
help="The last two digits of the year for the events, e.g 24 for 2024", | ||
) | ||
|
||
def _setup(self, *args, **kwargs): | ||
year = kwargs["year"] | ||
self.data_file = settings.BASE_DIR / "data" / f"gbgw_events_{year}.csv" | ||
self.out_file = settings.BASE_DIR / "data" / f"gbgw_events_{year}_processed.csv" | ||
|
||
def get_location_from_row(self, row): | ||
return {"lat_lon": [row.Lat, row.Long]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from django.conf import settings | ||
|
||
from hub.models import DataSet | ||
|
||
from .base_importers import BaseConstituencyCountImportCommand, MultipleAreaTypesMixin | ||
|
||
|
||
class Command(MultipleAreaTypesMixin, BaseConstituencyCountImportCommand): | ||
help = "Import data about number of GBGW events in 2024 per constituency" | ||
message = "Importing 2024 GBGW events" | ||
uses_gss = False | ||
|
||
data_file = settings.BASE_DIR / "data" / "gbgw_events_24_processed.csv" | ||
|
||
area_types = ["WMC23", "STC", "DIS"] | ||
cons_col_map = { | ||
"WMC23": "WMC23", | ||
"STC": "STC", | ||
"DIS": "DIS", | ||
} | ||
|
||
data_sets = { | ||
"constituency_gbgw_2024_event_count": { | ||
"defaults": { | ||
"label": "Number of Great Big Green Week 2024 events", | ||
"description": "Number of public Great Big Green week 2024 events held in the area. This exludes any private events that were held.", | ||
"release_date": "September 2024", | ||
"data_type": "integer", | ||
"category": "movement", | ||
"subcategory": "events", | ||
"source_label": "Data from The Climate Coalition.", | ||
"source": "https://greatbiggreenweek.com/", | ||
"source_type": "google sheet", | ||
"data_url": "", | ||
"table": "areadata", | ||
"is_public": True, | ||
"default_value": 10, | ||
"comparators": DataSet.numerical_comparators(), | ||
"unit_type": "raw", | ||
"unit_distribution": "people_in_area", | ||
} | ||
} | ||
} |