Redesign interface listing protection

Per @polly64 checkbox fields were removed and switch was made to using links as both as input method and for providing source.

It is no longer possible to just claim that something is listed/featured, entering data will now be also faster
This commit is contained in:
Mateusz Konieczny 2022-09-20 10:34:22 +02:00
parent cbd99f49f3
commit 20f99e9103
10 changed files with 173 additions and 330 deletions

View File

@ -169,23 +169,11 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true,
},
planning_in_conservation_area: {
planning_in_conservation_area_url: {
edit: true,
verify: true,
},
planning_conservation_area_name: {
edit: true,
verify: true,
},
planning_in_list: {
edit: true,
verify: true,
},
planning_list_id: {
edit: true,
verify: true,
},
planning_list_cat: {
planning_in_conservation_area_source_url: {
edit: true,
verify: true,
},
@ -193,15 +181,11 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true,
},
planning_heritage_at_risk_id: {
planning_heritage_at_risk_url: {
edit: true,
verify: true,
},
planning_world_list_id: {
edit: true,
verify: true,
},
planning_in_glher: {
planning_world_list_url: {
edit: true,
verify: true,
},
@ -209,19 +193,7 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true,
},
planning_in_apa: {
edit: true,
verify: true,
},
planning_apa_name: {
edit: true,
verify: true,
},
planning_apa_tier: {
edit: true,
verify: true,
},
planning_in_local_list: {
planning_in_apa_url: {
edit: true,
verify: true,
},
@ -229,10 +201,6 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true,
},
planning_in_historic_area_assessment: {
edit: true,
verify: true,
},
planning_historic_area_assessment_url: {
edit: true,
verify: true,

View File

@ -87,9 +87,6 @@ const withCopyEdit: (wc: React.ComponentType<CategoryViewProps>) => DataContaine
const categoryKeys = {};
const blackListedKeys = ['current_landuse_order',
'current_landuse_verified',
'planning_in_list',
'planning_list_id',
'planning_list_cat',
'planning_list_grade',
'likes_total',
'community_local_significance_total',

View File

@ -91,21 +91,23 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
</DataEntryGroup>
<DataEntryGroup name="Designation/protection" collapsed={false} >
<DataEntryGroup name="Conservation" collapsed={false} >
<CheckboxDataEntry
title={dataFields.planning_in_conservation_area.title}
slug="planning_in_conservation_area"
value={props.building.planning_in_conservation_area}
<DataEntry
title={dataFields.planning_in_conservation_area_url.title}
slug="planning_in_conservation_area_url"
value={props.building.planning_in_conservation_area_url}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
isUrl={true}
placeholder="https://..."
/>
<Verification
slug="planning_in_conservation_area"
allow_verify={props.user !== undefined && props.building.planning_in_conservation_area !== null && !props.edited}
slug="planning_in_conservation_area_url"
allow_verify={props.user !== undefined && props.building.planning_in_conservation_area_url !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_in_conservation_area")}
user_verified_as={props.user_verified.planning_in_conservation_area}
verified_count={props.building.verified.planning_in_conservation_area}
user_verified={props.user_verified.hasOwnProperty("planning_in_conservation_area_url")}
user_verified_as={props.user_verified.planning_in_conservation_area_url}
verified_count={props.building.verified.planning_in_conservation_area_url}
/>
<DataEntry
title={dataFields.planning_conservation_area_name.title}
@ -125,33 +127,14 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
/>
</DataEntryGroup>
<DataEntryGroup name="Listed buildings & scheduled monuments" collapsed={false} >
<CheckboxDataEntry
title={dataFields.planning_in_list.title}
slug="planning_in_list"
value={props.building.planning_in_list}
mode={props.mode}
disabled={false}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_in_list"
allow_verify={props.user !== undefined && props.building.planning_in_list !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_in_list")}
user_verified_as={props.user_verified.planning_in_list}
verified_count={props.building.verified.planning_in_list}
/>
<MultiDataEntry
<DataEntry
title={dataFields.planning_nhle_link.title}
slug="planning_nhle_link"
value={props.building.planning_nhle_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.planning_nhle_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
<Verification
@ -162,47 +145,6 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
user_verified_as={props.user_verified.planning_nhle_link}
verified_count={props.building.verified.planning_nhle_link}
/>
<DataEntry
title={dataFields.planning_list_id.title}
slug="planning_list_id"
value={props.building.planning_list_id}
mode={props.mode}
disabled={false}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_list_id"
allow_verify={props.user !== undefined && props.building.planning_list_id !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_list_id")}
user_verified_as={props.user_verified.planning_list_id}
verified_count={props.building.verified.planning_list_id}
/>
<SelectDataEntry
title={dataFields.planning_list_cat.title}
slug="planning_list_cat"
value={props.building.planning_list_cat}
mode={props.mode}
disabled={false}
copy={props.copy}
onChange={props.onChange}
options={[
"Listed Building",
"Scheduled Monument",
"World Heritage Site",
"Building Preservation Notice",
"None"
]}
/>
<Verification
slug="planning_list_cat"
allow_verify={props.user !== undefined && props.building.planning_list_cat !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_list_cat")}
user_verified_as={props.user_verified.planning_list_cat}
verified_count={props.building.verified.planning_list_cat}
/>
<SelectDataEntry
title={dataFields.planning_list_grade.title}
slug="planning_list_grade"
@ -227,55 +169,60 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
verified_count={props.building.verified.planning_list_grade}
/>
<DataEntry
title={dataFields.planning_heritage_at_risk_id.title}
slug="planning_heritage_at_risk_id"
value={props.building.planning_heritage_at_risk_id}
title={dataFields.planning_heritage_at_risk_url.title}
slug="planning_heritage_at_risk_url"
value={props.building.planning_heritage_at_risk_url}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_heritage_at_risk_id"
allow_verify={props.user !== undefined && props.building.planning_heritage_at_risk_id !== null && !props.edited}
slug="planning_heritage_at_risk_url"
allow_verify={props.user !== undefined && props.building.planning_heritage_at_risk_url !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_heritage_at_risk_id")}
user_verified_as={props.user_verified.planning_heritage_at_risk_id}
verified_count={props.building.verified.planning_heritage_at_risk_id}
user_verified={props.user_verified.hasOwnProperty("planning_heritage_at_risk_url")}
user_verified_as={props.user_verified.planning_heritage_at_risk_url}
verified_count={props.building.verified.planning_heritage_at_risk_url}
/>
</DataEntryGroup>
<DataEntryGroup name="Other types of protection & recording" collapsed={false} >
<DataEntry
title={dataFields.planning_world_list_id.title}
slug="planning_world_list_id"
value={props.building.planning_world_list_id}
title={dataFields.planning_local_list_url.title}
slug="planning_local_list_url"
value={props.building.planning_local_list_url}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
isUrl={true}
placeholder="https://..."
/>
<Verification
slug="planning_world_list_id"
allow_verify={props.user !== undefined && props.building.planning_world_list_id !== null && !props.edited}
slug="planning_local_list_url"
allow_verify={props.user !== undefined && props.building.planning_local_list_url !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_world_list_id")}
user_verified_as={props.user_verified.planning_world_list_id}
verified_count={props.building.verified.planning_world_list_id}
user_verified={props.user_verified.hasOwnProperty("planning_local_list_url")}
user_verified_as={props.user_verified.planning_local_list_url}
verified_count={props.building.verified.planning_local_list_url}
/>
<DataEntry
title={dataFields.planning_world_list_url.title}
slug="planning_world_list_url"
value={props.building.planning_world_list_url}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
isUrl={true}
placeholder="https://..."
/>
<Verification
slug="planning_world_list_url"
allow_verify={props.user !== undefined && props.building.planning_world_list_url !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_world_list_url")}
user_verified_as={props.user_verified.planning_world_list_url}
verified_count={props.building.verified.planning_world_list_url}
/>
<CheckboxDataEntry
title={dataFields.planning_in_glher.title}
slug="planning_in_glher"
value={props.building.planning_in_glher}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_in_glher"
allow_verify={props.user !== undefined && props.building.planning_in_glher !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_in_glher")}
user_verified_as={props.user_verified.planning_in_glher}
verified_count={props.building.verified.planning_in_glher}
/>
<DataEntry
title={dataFields.planning_glher_url.title}
slug="planning_glher_url"
@ -283,6 +230,8 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
isUrl={true}
placeholder="https://..."
/>
<Verification
slug="planning_glher_url"
@ -293,104 +242,23 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
verified_count={props.building.verified.planning_glher_url}
/>
<CheckboxDataEntry
title={dataFields.planning_in_apa.title}
slug="planning_in_apa"
value={props.building.planning_in_apa}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_in_apa"
allow_verify={props.user !== undefined && props.building.planning_in_apa !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_in_apa")}
user_verified_as={props.user_verified.planning_in_apa}
verified_count={props.building.verified.planning_in_apa}
/>
<DataEntry
title={dataFields.planning_apa_name.title}
slug="planning_apa_name"
value={props.building.planning_apa_name}
title={dataFields.planning_in_apa_url.title}
slug="planning_in_apa_url"
value={props.building.planning_in_apa_url}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
isUrl={true}
placeholder="https://..."
/>
<Verification
slug="planning_apa_name"
allow_verify={props.user !== undefined && props.building.planning_apa_name !== null && !props.edited}
slug="planning_in_apa_url"
allow_verify={props.user !== undefined && props.building.planning_in_apa_url !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_apa_name")}
user_verified_as={props.user_verified.planning_apa_name}
verified_count={props.building.verified.planning_apa_name}
/>
<DataEntry
title={dataFields.planning_apa_tier.title}
slug="planning_apa_tier"
value={props.building.planning_apa_tier}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_apa_tier"
allow_verify={props.user !== undefined && props.building.planning_apa_tier !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_apa_tier")}
user_verified_as={props.user_verified.planning_apa_tier}
verified_count={props.building.verified.planning_apa_tier}
/>
</DataEntryGroup>
<DataEntryGroup name="Other types of protection & recording" collapsed={false} >
<CheckboxDataEntry
title={dataFields.planning_in_local_list.title}
slug="planning_in_local_list"
value={props.building.planning_in_local_list}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_in_local_list"
allow_verify={props.user !== undefined && props.building.planning_in_local_list !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_in_local_list")}
user_verified_as={props.user_verified.planning_in_local_list}
verified_count={props.building.verified.planning_in_local_list}
/>
<DataEntry
title={dataFields.planning_local_list_url.title}
slug="planning_local_list_url"
value={props.building.planning_local_list_url}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_local_list_url"
allow_verify={props.user !== undefined && props.building.planning_local_list_url !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_local_list_url")}
user_verified_as={props.user_verified.planning_local_list_url}
verified_count={props.building.verified.planning_local_list_url}
/>
<CheckboxDataEntry
title={dataFields.planning_in_historic_area_assessment.title}
slug="planning_in_historic_area_assessment"
value={props.building.planning_in_historic_area_assessment}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_in_historic_area_assessment"
allow_verify={props.user !== undefined && props.building.planning_in_historic_area_assessment !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_in_historic_area_assessment")}
user_verified_as={props.user_verified.planning_in_historic_area_assessment}
verified_count={props.building.verified.planning_in_historic_area_assessment}
user_verified={props.user_verified.hasOwnProperty("planning_in_apa_url")}
user_verified_as={props.user_verified.planning_in_apa_url}
verified_count={props.building.verified.planning_in_apa_url}
/>
<DataEntry
title={dataFields.planning_historic_area_assessment_url.title}
@ -399,6 +267,8 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
isUrl={true}
placeholder="https://..."
/>
<Verification
slug="planning_historic_area_assessment_url"

View File

@ -170,7 +170,7 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
[Category.Planning]: [{
mapStyle: 'planning_combined',
legend: {
title: 'Statutory protections',
title: 'Designation/protection',
disclaimer: 'All data relating to designated buildings should be checked on the National Heritage List for England or local authority websites where used for planning or development purposes',
elements: [
{ color: '#95beba', text: 'In conservation area'},

View File

@ -446,111 +446,62 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
example: "",
//tooltip: ,
},
planning_in_conservation_area: {
planning_in_conservation_area_url: {
category: Category.Planning,
title: "In a conservation area?",
example: true,
title: "Is the building in a <a href=\"https://historicengland.org.uk/listing/what-is-designation/local/conservation-areas/\" target=\"_blank\">Conservation Area</a>?",
example: "",
//tooltip: ,
},
planning_conservation_area_name: {
category: Category.Planning,
title: "Conservation area name",
title: "Conservation Area Name",
example: "",
//tooltip: ,
},
planning_in_list: {
category: Category.Planning,
title: "Is it listed on the National Heritage List for England?",
example: true,
//tooltip: ,
},
planning_nhle_link: {
category: Category.Planning,
title: "NHLE list entry link",
tooltip: "URL for National Heritage List for England entry",
example: ["", "", ""],
},
planning_list_id: {
category: Category.Planning,
title: "National Heritage List for England list id",
example: "121436",
//tooltip: ,
},
planning_list_cat: {
category: Category.Planning,
title: "National Heritage List for England list type",
title: "Is the building on the <a href=\"https://historicengland.org.uk/advice/hpg/heritage-assets/nhle/\" target=\"_blank\">National Heritage List for England</a>?",
example: "",
//tooltip: ,
},
planning_list_grade: {
category: Category.Planning,
title: "Listing grade",
title: "What is its grade?",
example: "II",
//tooltip: ,
},
planning_heritage_at_risk_id: {
planning_heritage_at_risk_url: {
category: Category.Planning,
title: "Heritage at risk list id",
title: "Is it on the <a href=\"https://historicengland.org.uk/advice/heritage-at-risk/search-register/\" target=\"_blank\">Heritage at Risk</a> register?",
example: "",
//tooltip: ,
},
planning_world_list_id: {
planning_world_list_url: {
category: Category.Planning,
title: "World heritage list id",
title: "Is it within a <a href=\"https://historicengland.org.uk/advice/hpg/has/whs/\" target=\"_blank\">World Heritage Site</a>?",
example: "",
//tooltip: ,
},
planning_in_glher: {
category: Category.Planning,
title: "In the Greater London Historic Environment Record?",
example: true,
//tooltip: ,
},
planning_glher_url: {
category: Category.Planning,
title: "Greater London Historic Environment Record link",
title: "Is it recorded on the <a href=\"https://historicengland.org.uk/advice/technical-advice/information-management/hers/\" target=\"_blank\">Historic Environment Record</a>?",
example: "",
//tooltip: ,
},
planning_in_apa: {
planning_in_apa_url: {
category: Category.Planning,
title: "In an Architectural Priority Area?",
example: true,
//tooltip: ,
},
planning_apa_name: {
category: Category.Planning,
title: "Architectural Priority Area name",
title: "Is it in an <a href=\"https://historicengland.org.uk/services-skills/our-planning-services/greater-london-archaeology-advisory-service/greater-london-archaeological-priority-areas/\" target=\"_blank\">Archaeological Priority Area</a>?",
example: "",
//tooltip: ,
},
planning_apa_tier: {
category: Category.Planning,
title: "Architectural Priority Area tier",
example: "2",
//tooltip: ,
},
planning_in_local_list: {
category: Category.Planning,
title: "Is locally listed?",
example: true,
//tooltip: ,
},
planning_local_list_url: {
category: Category.Planning,
title: "Local list link",
title: "Is it a <a href=\"https://historicengland.org.uk/advice/hpg/has/locallylistedhas/\" target=\"_blank\">Locally Listed Heritage Asset</a>?",
example: "",
//tooltip: ,
},
planning_in_historic_area_assessment: {
category: Category.Planning,
title: "Within a historic area assessment?",
example: true,
//tooltip: ,
},
planning_historic_area_assessment_url: {
category: Category.Planning,
title: "Historic area assessment link",
title: "Does it have an <a href=\"https://historicengland.org.uk/images-books/publications/understanding-place-historic-area-assessments/\" target=\"_blank\">Historic Area Assessment</a>?",
example: "",
//tooltip: ,
},

View File

@ -141,26 +141,26 @@ const LAYER_QUERIES = {
geometry_id,
(
CASE
WHEN planning_list_cat = 'Listed Building' and planning_list_grade = 'I' THEN 'Grade I Listed'
WHEN planning_list_cat = 'Listed Building' and planning_list_grade = 'II*' THEN 'Grade II* Listed'
WHEN planning_list_cat = 'Listed Building' and planning_list_grade = 'II' THEN 'Grade II Listed'
WHEN planning_in_local_list THEN 'Locally Listed'
WHEN planning_list_grade = 'I' THEN 'Grade I Listed'
WHEN planning_list_grade = 'II*' THEN 'Grade II* Listed'
WHEN planning_list_grade = 'II' THEN 'Grade II Listed'
WHEN planning_local_list_url <> '' THEN 'Locally Listed'
ELSE 'None'
END
) AS listing_type,
planning_in_conservation_area
planning_in_conservation_area_url <> '' AS planning_in_conservation_area
FROM buildings
WHERE
planning_in_conservation_area
OR planning_in_local_list
OR planning_list_cat IS NOT NULL`,
planning_in_conservation_area_url <> ''
OR planning_local_list_url <> ''
OR planning_list_grade IS NOT NULL`,
conservation_area: `
SELECT
geometry_id
FROM
buildings
WHERE
planning_in_conservation_area = true`,
planning_in_conservation_area_url = true`,
sust_dec: `
SELECT
geometry_id,

View File

@ -70,22 +70,14 @@ This is the main table, containing almost all data collected by Colouring London
- `sust_dec`: DEC rating
- `sust_retrofit_date`: year of last significant retrofit
- `planning_portal_link`: link to an entry on https://www.planningportal.co.uk/
- `planning_in_conservation_area`: in a conservation area? (True/False)
- `planning_conservation_area_name`: conservation area name
- `planning_in_list`: in the National Heritage List for England? (True/False)
- `planning_list_id`: National Heritage List for England ID
- `planning_list_cat`: National Heritage List for England listing type
- `planning_in_conservation_area_url`: conservation area appraisal link
- `planning_in_conservation_area_url`: conservation area data source link
- `planning_list_grade`: National Heritage List for England listing grade
- `planning_heritage_at_risk_id`: on the Heritage at Risk list? (True/False)
- `planning_world_list_id`: UNESCO World Heritage list ID
- `planning_in_glher`: in the Greater London Historic Environment Record? (True/False)
- `planning_heritage_at_risk_url`: Heritage at Risk link
- `planning_world_list_url`: UNESCO World Heritage list id
- `planning_glher_url`: Greater London Historic Environment Record link
- `planning_in_apa`: in an Architectural Priority Area? (True/False)
- `planning_apa_name`: Architectural Priority Area name
- `planning_apa_tier`: Architectural Priority Area tier
- `planning_in_local_list`: in a local list? (True/False)
- `planning_in_apa_url`: an Archeological Priority Area (APA) link
- `planning_local_list_url`: local list reference link
- `planning_in_historic_area_assessment`: within a historic area assessment? (True/False)
- `planning_historic_area_assessment_url`: historic area assessment reference link
- `likes_total`: number of times the building has been liked by Colouring London users

View File

@ -40,22 +40,18 @@ COPY (SELECT
construction_secondary_materials,
construction_roof_covering,
planning_portal_link,
planning_in_conservation_area,
planning_in_conservation_area_url,
planning_in_conservation_area_source_url,
planning_conservation_area_name,
planning_in_list,
planning_list_id,
planning_list_cat,
planning_list_grade,
planning_heritage_at_risk_id,
planning_world_list_id,
planning_in_glher,
planning_heritage_at_risk_url,
planning_world_list_url,
planning_glher_url,
planning_in_apa,
planning_apa_name,
planning_apa_tier,
planning_in_local_list,
planning_in_apa_url,
planning_local_list_url,
planning_in_historic_area_assessment,
planning_historic_area_assessment_url,
likes_total
FROM buildings)

View File

@ -0,0 +1,26 @@
--into a single link from array of links
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_nhle_link;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_nhle_link text[];
--changed into URL
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_apa_url;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_apa boolean DEFAULT FALSE;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_world_list_url;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_world_list_id int DEFAULT NULL;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_heritage_at_risk_url;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_heritage_at_risk_id int DEFAULT NULL;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_conservation_area_url;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_conservation_area boolean DEFAULT FALSE;
-- URL column exists already
ALTER TABLE ADD COLUMN IF NOT EXISTS planning_list_id int DEFAULT NULL;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_glher boolean DEFAULT FALSE;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_apa_name VARCHAR DEFAULT '';
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_apa_tier smallint DEFAULT NULL;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_local_list boolean DEFAULT FALSE;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_historic_area_assessment boolean DEFAULT FALSE;

View File

@ -0,0 +1,43 @@
-- this type of links is expected:
-- 'https://historicengland.org.uk/listing/the-list/list-entry/1080446?section=official-list-entry'
UPDATE buildings
SET planning_nhle_link = CONCAT('https://historicengland.org.uk/listing/the-list/list-entry/', planning_list_id,
'?section=official-list-entry')
WHERE planning_nhle_link = ''
AND planning_list_id IS NOT NULL;
UPDATE buildings
SET planning_local_list_url = 'identified as listed: please replace with link'
WHERE planning_local_list_url = ''
AND planning_in_local_list;
--into a single link from array of links
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_nhle_link;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_nhle_link VARCHAR DEFAULT '';
--changed into URL
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_apa;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_apa_url VARCHAR DEFAULT '';
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_world_list_id;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_world_list_url VARCHAR DEFAULT '';
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_heritage_at_risk_id;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_heritage_at_risk_url VARCHAR DEFAULT '';
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_conservation_area;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_in_conservation_area_url VARCHAR DEFAULT '';
-- URL column exists already
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_list_id;
--fully removed
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_glher;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_apa_name;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_apa_tier;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_local_list;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_in_historic_area_assessment;
rg "planning_in_apa|planning_world_list_id|planning_heritage_at_risk_id|planning_in_conservation_area|planning_in_glher|planning_apa_name|planning_apa_tier|planning_in_local_list|planning_in_historic_area_assessment"