Skip to content

Commit

Permalink
fixup! WIP: Update air quality data to use more recent data and also …
Browse files Browse the repository at this point in the history
…include WHO standards
  • Loading branch information
struan committed Apr 1, 2024
1 parent d080725 commit 008e85c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hub/management/commands/import_air_quality_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

from hub.models import Area, AreaData, DataSet, DataType

from .base_importers import BaseAreaImportCommand

class Command(BaseCommand):

class Command(BaseAreaImportCommand):
help = "Import air-pollution data"

source_url = "https://uk-air.defra.gov.uk/data/modelling-data"
Expand Down Expand Up @@ -107,6 +109,8 @@ def create_data_types(self, df):
data_set, created = DataSet.objects.update_or_create(
name="constituency_air_quality", defaults=self.defaults
)
data_set.areas_available.add(self.get_area_type())

data_types = []
for col in tqdm(df.columns, disable=self._quiet):
label = self.in_files[col]["pollutant"]
Expand All @@ -117,6 +121,7 @@ def create_data_types(self, df):
data_type, created = DataType.objects.update_or_create(
data_set=data_set,
name=f"air_quality_{col}",
area_type=self.get_area_type(),
defaults={
"data_type": "float",
"label": label,
Expand Down

0 comments on commit 008e85c

Please sign in to comment.