diff --git a/app/src/api/config/dataFields.ts b/app/src/api/config/dataFields.ts index 06cec053..bddc0bcc 100644 --- a/app/src/api/config/dataFields.ts +++ b/app/src/api/config/dataFields.ts @@ -169,23 +169,11 @@ export const buildingAttributesConfig = valueType()({ /* 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()({ /* 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()({ /* 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()({ /* eslint edit: true, verify: true, }, - planning_in_historic_area_assessment: { - edit: true, - verify: true, - }, planning_historic_area_assessment_url: { edit: true, verify: true, diff --git a/app/src/frontend/building/data-container.tsx b/app/src/frontend/building/data-container.tsx index cf8c8776..ce47e4b2 100644 --- a/app/src/frontend/building/data-container.tsx +++ b/app/src/frontend/building/data-container.tsx @@ -87,9 +87,6 @@ const withCopyEdit: (wc: React.ComponentType) => 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', diff --git a/app/src/frontend/building/data-containers/planning.tsx b/app/src/frontend/building/data-containers/planning.tsx index 41dddce0..47383e6c 100644 --- a/app/src/frontend/building/data-containers/planning.tsx +++ b/app/src/frontend/building/data-containers/planning.tsx @@ -91,21 +91,23 @@ const PlanningView: React.FunctionComponent = (props) => ( - = (props) => ( /> - - - = (props) => ( user_verified_as={props.user_verified.planning_nhle_link} verified_count={props.building.verified.planning_nhle_link} /> - - - - = (props) => ( verified_count={props.building.verified.planning_list_grade} /> - + + + + - - = (props) => ( mode={props.mode} copy={props.copy} onChange={props.onChange} + isUrl={true} + placeholder="https://..." /> = (props) => ( verified_count={props.building.verified.planning_glher_url} /> - - - - - - - - - - - - - = (props) => ( mode={props.mode} copy={props.copy} onChange={props.onChange} + isUrl={true} + placeholder="https://..." /> Conservation Area?", + 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 National Heritage List for England?", 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 Heritage at Risk register?", example: "", //tooltip: , }, - planning_world_list_id: { + planning_world_list_url: { category: Category.Planning, - title: "World heritage list id", + title: "Is it within a World Heritage Site?", 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 Historic Environment Record?", 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 Archaeological Priority Area?", 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 Locally Listed Heritage Asset?", 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 Historic Area Assessment?", example: "", //tooltip: , }, diff --git a/app/src/tiles/dataDefinition.ts b/app/src/tiles/dataDefinition.ts index 282b8efb..8a92a37a 100644 --- a/app/src/tiles/dataDefinition.ts +++ b/app/src/tiles/dataDefinition.ts @@ -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, diff --git a/maintenance/extract_data/README.md b/maintenance/extract_data/README.md index 5877afb5..3fe92171 100644 --- a/maintenance/extract_data/README.md +++ b/maintenance/extract_data/README.md @@ -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 diff --git a/maintenance/extract_data/export_attributes.sql b/maintenance/extract_data/export_attributes.sql index 5b97224a..8a597b3d 100644 --- a/maintenance/extract_data/export_attributes.sql +++ b/maintenance/extract_data/export_attributes.sql @@ -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) diff --git a/migrations/033.redesign_protection_designation.down.sql b/migrations/033.redesign_protection_designation.down.sql new file mode 100644 index 00000000..42fd9eb8 --- /dev/null +++ b/migrations/033.redesign_protection_designation.down.sql @@ -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; + diff --git a/migrations/033.redesign_protection_designation.up.sql b/migrations/033.redesign_protection_designation.up.sql new file mode 100644 index 00000000..47563f0d --- /dev/null +++ b/migrations/033.redesign_protection_designation.up.sql @@ -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" \ No newline at end of file