From 49ab1c68368b404809788011f7d561ec5db73ce2 Mon Sep 17 00:00:00 2001 From: Mike Simpson Date: Tue, 18 Jul 2023 12:32:44 +0100 Subject: [PATCH] Typology Section Updates #1151 --- app/src/api/config/dataFields.ts | 58 +++- app/src/api/services/autofill.ts | 1 + .../building/data-containers/typology.tsx | 295 ++++++++++++++---- app/src/frontend/config/data-fields-config.ts | 138 +++++++- migrations/043.typology_updates.down.sql | 18 ++ migrations/043.typology_updates_up.sql | 18 ++ 6 files changed, 451 insertions(+), 77 deletions(-) create mode 100644 migrations/043.typology_updates.down.sql create mode 100644 migrations/043.typology_updates_up.sql diff --git a/app/src/api/config/dataFields.ts b/app/src/api/config/dataFields.ts index 624ed479..6a249cb5 100644 --- a/app/src/api/config/dataFields.ts +++ b/app/src/api/config/dataFields.ts @@ -423,6 +423,14 @@ export const buildingAttributesConfig = valueType()({ /* eslint edit: true, verify: true, }, + building_attachment_source_type: { + edit: true, + verify: true, + }, + building_attachment_source_links: { + edit: true, + verify: true, + }, date_change_building_use: { edit: true, }, @@ -801,7 +809,55 @@ export const buildingAttributesConfig = valueType()({ /* eslint energy_green_roof_source_links : { edit: true, verify: true - } + }, + typology_classification : { + edit: true, + verify: true + }, + typology_classification_source_type : { + edit: true, + verify: true + }, + typology_classification_source_links: { + edit: true, + verify: true + }, + typology_style_period : { + edit: true, + verify: true + }, + typology_style_period_source_type : { + edit: true, + verify: true + }, + typology_style_period_source_links: { + edit: true, + verify: true + }, + typology_dynamic_classification : { + edit: true, + verify: true + }, + typology_dynamic_classification_source_type : { + edit: true, + verify: true + }, + typology_dynamic_classification_source_links: { + edit: true, + verify: true + }, + typology_original_use : { + edit: true, + verify: true + }, + typology_original_use_source_type : { + edit: true, + verify: true + }, + typology_original_use_source_links: { + edit: true, + verify: true + }, }); diff --git a/app/src/api/services/autofill.ts b/app/src/api/services/autofill.ts index 8021a277..f0e1c285 100644 --- a/app/src/api/services/autofill.ts +++ b/app/src/api/services/autofill.ts @@ -10,6 +10,7 @@ type GetAutofillOptionsFn = (value: string, all?: boolean) => Promise = (props) => { return ( - + + + + + {(props.building.typology_classification_source_type == commonSourceTypes[0] || + props.building.typology_classification_source_type == commonSourceTypes[1] || + props.building.typology_classification_source_type == null) ? <> : + <> + + + } + + + + + + {(props.building.typology_style_period_source_type == commonSourceTypes[0] || + props.building.typology_style_period_source_type == commonSourceTypes[1] || + props.building.typology_style_period_source_type == null) ? <> : + <> + + + } + + + + + + {(props.building.typology_dynamic_classification_source_type == commonSourceTypes[0] || + props.building.typology_dynamic_classification_source_type == commonSourceTypes[1] || + props.building.typology_dynamic_classification_source_type == null) ? <> : + <> + + + } + + + + + + {(props.building.typology_original_use_source_type == commonSourceTypes[0] || + props.building.typology_original_use_source_type == commonSourceTypes[1] || + props.building.typology_original_use_source_type == null) ? <> : + <> + + + } + + = (props) => { user_verified_as={props.user_verified.building_attachment_form} verified_count={props.building.verified.building_attachment_form} /> - - -
- - - - + {(props.building.building_attachment_source_type == commonSourceTypes[0] || + props.building.building_attachment_source_type == commonSourceTypes[1] || + props.building.building_attachment_source_type == null) ? <> : + <> + + + }
- - - + {/*} + = (props) => { value="" mode='view' /> + {/* = (props) => { mode={props.mode} copy={props.copy} onChange={props.onChange} - /> */} - + />//*} + */}
); }; diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index c2f24093..ebd235c0 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -310,26 +310,23 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ }, building_attachment_form: { category: Category.Typology, - title: "Attachment type/adjacency", + title: "Which description best explains the way the building is attached to others?", tooltip: "We have prepopulated these based on their current attachment. A building can either be detached, semi-detached or part of a terrace (middle or end)", example: "", }, - date_change_building_use: { - category: Category.Typology, - title: "When did use change?", - tooltip: "This is the date the building stopped being used for for the function it was built for. I.e. if it was Victorian warehouse which is now an office this would be when it became an office or if it was something before that, maybe a garage then the date that happened", - example: 1920, - }, - /** - * original_building_use does not exist in database yet. - * Slug needs to be adjusted if the db column will be named differently - */ - original_building_use: { - category: Category.Typology, - title: "Original building use", - tooltip: "What was the building originally used for when it was built?", + building_attachment_source_type: { + category: Category.Age, + title: "Source type", + tooltip: "Source type for the building data above", + items: commonSourceTypes, example: "", }, + building_attachment_source_links: { + category: Category.Age, + title: "Source link(s)", + tooltip: "URL for data reference", + example: ["", "", ""], + }, size_roof_shape: { category: Category.Typology, title: "Roof type", @@ -1466,6 +1463,117 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ tooltip: "Source link(s) for street width data", example: ["", "", ""], }, + + typology_classification: { + category: Category.Typology, + title: "Which description best suits the building and its context?", + tooltip: "HINT: Adapted from building type classifications developed in urban morphology. See https://www.smog.chalmers.se/ 'Space Matrix' for further information.", + example: "High rise: Not part of a group/cluster", + items: [ + 'Low-rise: Not part of a group/cluster (1-3 core floors- excluding extensions)', + 'Low-rise: Part of dense block/row/terrace', + 'Low-rise: Part of group of widely spaced blocks (includes semi-detached houses)', + 'Mid-rise: Not part of a group/cluster (4-7 core floors)', + 'Mid-rise: Part of group of densely spaced blocks', + 'Mid-rise: Part of group of widely spaced blocks', + 'High rise: Not part of a group/cluster', + 'High-rise: Part of group of densely spaced blocks (8 + core floors)', + 'High-rise: Part of group of widely spaced blocks', + ] + }, + typology_classification_source_type: { + category: Category.Typology, + title: "Source type", + tooltip: "Source type for street width data", + example: "", + items: commonSourceTypes + }, + typology_classification_source_links: { + category: Category.Typology, + title: "Source link(s)", + tooltip: "Source link(s) for street width data", + example: ["", "", ""], + }, + typology_style_period: { + category: Category.Typology, + title: "Which description best suits the building's architectural style/historical period?", + tooltip: "", + example: "High rise: Not part of a group/cluster", + items: [ + 'Roman (43AD-410)', + 'Early Medieval (410-1066)', + 'Mid- Late Medieval (1066-1485)', + 'Tudor (1485-1603)', + 'Stuart (1603 -1714)', + 'Georgian/William IV (1714-1837)', + 'Victorian (1837-1901)', + 'Edwardian (1901-1914)', + 'World War I (1914-18)', + 'Interwar (1918-39)', + 'World War II (1939-45)', + 'Post war (1945-1975)', + 'Postmodern (1975-1990)', + '1990s', + '2000s/2010s', + '2020s', + ] + }, + typology_style_period_source_type: { + category: Category.Typology, + title: "Source type", + tooltip: "Source type for street width data", + example: "", + items: commonSourceTypes + }, + typology_style_period_source_links: { + category: Category.Typology, + title: "Source link(s)", + tooltip: "Source link(s) for street width data", + example: ["", "", ""], + }, + typology_dynamic_classification: { + category: Category.Typology, + title: "Which description best suits the building's plot?", + tooltip: "HINT: Based on a dynamic classification system for urban tissue developed by Brenda Case Scheer. For further information see: https://www.researchgate.net/publication/242150847_The_Anatomy_of_Sprawl.", + example: "High rise: Not part of a group/cluster", + items: [ + 'Small fairly regular plot part of repetitive domestic streets', + 'Irregular shaped plots built along the edge of long established routes (e.g high streets)', + 'Large plot with internal access roads (e.g. infrastructure hubs/large institution such as hospitals/universities/airports)', + ] + }, + typology_dynamic_classification_source_type: { + category: Category.Typology, + title: "Source type", + tooltip: "Source type for street width data", + example: "", + items: commonSourceTypes + }, + typology_dynamic_classification_source_links: { + category: Category.Typology, + title: "Source link(s)", + tooltip: "Source link(s) for street width data", + example: ["", "", ""], + }, + typology_original_use: { + category: Category.Typology, + title: "Which land use best describes the purpose for which the building was built?", + tooltip: "Land use Groups as classified by [NLUD](https://www.gov.uk/government/statistics/national-land-use-database-land-use-and-land-cover-classification)", + example: ["", ""], + }, + typology_original_use_source_type: { + category: Category.Typology, + title: "Source type", + tooltip: "Source type for street width data", + example: "", + items: commonSourceTypes + }, + typology_original_use_source_links: { + category: Category.Typology, + title: "Source link(s)", + tooltip: "Source link(s) for street width data", + example: ["", "", ""], + }, }; export const allFieldsConfig = { ...dataFields, ...buildingUserFields }; \ No newline at end of file diff --git a/migrations/043.typology_updates.down.sql b/migrations/043.typology_updates.down.sql new file mode 100644 index 00000000..bc3f3b84 --- /dev/null +++ b/migrations/043.typology_updates.down.sql @@ -0,0 +1,18 @@ +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_classification; +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_classification_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_classification_source_links; + +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_style_period; +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_style_period_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_style_period_source_links; + +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_dynamic_classification; +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_dynamic_classification_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_dynamic_classification_source_links; + +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_original_use; +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_original_use_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS typology_original_use_source_links; + +ALTER TABLE buildings DROP COLUMN IF EXISTS building_attachment_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS building_attachment_source_links; diff --git a/migrations/043.typology_updates_up.sql b/migrations/043.typology_updates_up.sql new file mode 100644 index 00000000..af0f4a72 --- /dev/null +++ b/migrations/043.typology_updates_up.sql @@ -0,0 +1,18 @@ +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_classification text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_classification_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_classification_source_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_style_period text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_style_period_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_style_period_source_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_dynamic_classification text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_dynamic_classification_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_dynamic_classification_source_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_original_use text[]; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_original_use_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS typology_original_use_source_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS building_attachment_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS building_attachment_source_links text[]; \ No newline at end of file