From 42a299b099bfbe13b18063ef7dcf5e30b51cbc60 Mon Sep 17 00:00:00 2001 From: Tom Taylor Date: Mon, 10 Jul 2023 07:57:45 +0100 Subject: [PATCH] Fixes for NSUL April 2023 import *Some* of the column names have changed to uppercase in the April 2023 NSUL release for some reason, and the postcodes also sometimes seem to have a trailing space. --- .../commands/mapit_postcodes_populate_nsul_table.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mapit_postcodes/management/commands/mapit_postcodes_populate_nsul_table.py b/mapit_postcodes/management/commands/mapit_postcodes_populate_nsul_table.py index abf0020..d6c0870 100644 --- a/mapit_postcodes/management/commands/mapit_postcodes_populate_nsul_table.py +++ b/mapit_postcodes/management/commands/mapit_postcodes_populate_nsul_table.py @@ -14,10 +14,10 @@ from mapit_postcodes.models import VoronoiRegion, NSULRow -COLUMN_POSTCODE = "pcds" -COLUMN_E = "gridgb1e" -COLUMN_N = "gridgb1n" -COLUMN_UPRN = "uprn" +COLUMN_POSTCODE = "PCDS" +COLUMN_E = "GRIDGB1E" +COLUMN_N = "GRIDGB1N" +COLUMN_UPRN = "UPRN" BATCH_SIZE = 1000 @@ -189,7 +189,7 @@ def bulk_create_batch_of_new_row_objects(): print("{0} postcodes processed".format(i)) if i > 0 and (i % BATCH_SIZE == 0): bulk_create_batch_of_new_row_objects() - pc = row[COLUMN_POSTCODE] + pc = row[COLUMN_POSTCODE].strip() if required_pc_prefix and not pc.startswith(required_pc_prefix): continue # Exclude Girobank postcodes: