From 3d6113fb0dd2f55b3e8c12642068764f73ad17ec Mon Sep 17 00:00:00 2001 From: Mike Simpson Date: Thu, 27 Jul 2023 15:16:50 +0100 Subject: [PATCH] Decorative Features (and other tweaks) - Add Decorative Features sub category + data - Add Source data to existing roof covering - Move existing roof covering options to the correct place - Add missed hints with links to GEM taxonomy - Add fields to Database --- app/src/api/config/dataFields.ts | 24 ++++ .../building/data-containers/construction.tsx | 133 ++++++++++++++---- app/src/frontend/config/data-fields-config.ts | 68 ++++++++- migrations/044.construction_updates.down.sql | 6 + migrations/044.construction_updates.up.sql | 7 + 5 files changed, 201 insertions(+), 37 deletions(-) diff --git a/app/src/api/config/dataFields.ts b/app/src/api/config/dataFields.ts index 8acde159..b868bd07 100644 --- a/app/src/api/config/dataFields.ts +++ b/app/src/api/config/dataFields.ts @@ -277,6 +277,14 @@ export const buildingAttributesConfig = valueType()({ /* eslint edit: true, verify: true, }, + construction_roof_covering_source_type: { + edit: true, + verify: true, + }, + construction_roof_covering_source_links: { + edit: true, + verify: true, + }, construction_structural_system: { edit: true, verify: true, @@ -325,6 +333,22 @@ export const buildingAttributesConfig = valueType()({ /* eslint edit: true, verify: true, }, + construction_decorative_features: { + edit: true, + verify: true, + }, + construction_decorative_feature_materials: { + edit: true, + verify: true, + }, + construction_decorative_feature_source_type: { + edit: true, + verify: true, + }, + construction_decorative_feature_source_links: { + edit: true, + verify: true, + }, planning_portal_link: { edit: true, verify: true, diff --git a/app/src/frontend/building/data-containers/construction.tsx b/app/src/frontend/building/data-containers/construction.tsx index 962e9c23..63416966 100644 --- a/app/src/frontend/building/data-containers/construction.tsx +++ b/app/src/frontend/building/data-containers/construction.tsx @@ -10,6 +10,7 @@ import { CategoryViewProps } from './category-view-props'; import InfoBox from '../../components/info-box'; import { DataEntryGroup } from '../data-components/data-entry-group'; import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry'; +import { LogicalDataEntry } from '../data-components/logical-data-entry/logical-data-entry'; const ConstructionMaterialsOptions = [ 'Wood', @@ -22,17 +23,6 @@ const ConstructionMaterialsOptions = [ 'Other Man-Made Material' ]; -const RoofCoveringOptions = [ - 'Slate', - 'Clay Tile', - 'Wood', - 'Asphalt', - 'Iron or Steel', - 'Other Metal', - 'Other Natural Material', - 'Other Man-Made Material' -]; - /** * Construction view/edit section */ @@ -251,23 +241,13 @@ const ConstructionView: React.FunctionComponent = (props) => user_verified_as={props.user_verified.construction_core_material} verified_count={props.building.verified.construction_core_material} /> - +
= (props) => user_verified={props.user_verified.hasOwnProperty("construction_roof_covering")} user_verified_as={props.user_verified.construction_roof_covering} verified_count={props.building.verified.construction_roof_covering} - /> - - - + + {(props.building.construction_roof_covering_source_type == commonSourceTypes[0] || + props.building.construction_roof_covering_source_type == commonSourceTypes[1] || + props.building.construction_roof_covering_source_type == null) ? <> : + <> + + + } + + + + + { + props.building.construction_decorative_features && + <> + + + + {(props.building.construction_decorative_feature_source_type == commonSourceTypes[0] || + props.building.construction_decorative_feature_source_type == commonSourceTypes[1] || + props.building.construction_decorative_feature_source_type == null) ? <> : + <> + + + } + + } ); diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index 3c8ecffb..ae135052 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -601,14 +601,37 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ construction_roof_covering: { category: Category.Construction, - title: "Main roof covering", - tooltip: 'Main roof covering material', + title: "What is the main roof covering?", + tooltip: '', example: "", + items: [ + 'Slate', + 'Clay Tile', + 'Wood', + 'Asphalt', + 'Iron or Steel', + 'Other Metal', + 'Other Natural Material', + 'Other Man-Made Material' + ] + }, + construction_roof_covering_source_type: { + category: Category.Construction, + title: "Source type", + tooltip: "Source of roof covering data", + example: "", + items: commonSourceTypes + }, + construction_roof_covering_source_links: { + category: Category.Construction, + title: "Source links", + tooltip: "URL(s) for roof covering data source(s)", + example: ["", "", ""], }, construction_structural_system: { category: Category.Construction, title: "What type of structural system does the building appear to have?", - tooltip: "", + tooltip: "Refer to GEM Taxonomy [LINK]", example: "Solid masonry walls supporting the roof", items: [ "Solid masonry walls supporting the roof", @@ -632,7 +655,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ construction_foundation: { category: Category.Construction, title: "What is the foundation system thought to be", - tooltip: "", + tooltip: "Refer to GEM Taxonomy [LINK]", example: "Deep Foundations with lateral support", items: [ "Shallow foundations with no lateral support", @@ -658,7 +681,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ construction_roof_shape: { category: Category.Construction, title: "What kind of roof shape does the building have?", - tooltip: "", + tooltip: "Refer to GEM Taxonomy [LINK]", example: "Pitched with gable ends", items: [ "What kind of roof shape does the building have?", @@ -689,7 +712,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ construction_irregularities: { category: Category.Construction, title: "Are there any structural irregularities in the shape of the building?", - tooltip: "i.e. Is one side higher than other?", + tooltip: "i.e. Is one side higher than other? - Refer to GEM Taxonomy [LINK]", example: "No irregularities", items: [ "Vertical irregularities", @@ -710,6 +733,39 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ tooltip: "URL(s) for irregularity data source(s)", example: ["", "", ""], }, + construction_decorative_features: { + category: Category.Construction, + title: "Are there decorative features/mouldings integrated into the facade ?", + example: true, + tooltip: "", + }, + construction_decorative_feature_materials: { + category: Category.Construction, + title: "What are these decorative features mainly made of?", + tooltip: "", + example: "Concrete", + items: [ + "Wood", + "Clay", + "Concrete", + "Glass", + "Metal", + "Other" + ] + }, + construction_decorative_feature_source_type: { + category: Category.Construction, + title: "Source type", + tooltip: "Source of roof shape data", + example: "", + items: commonSourceTypes + }, + construction_decorative_feature_source_links: { + category: Category.Construction, + title: "Source links", + tooltip: "URL(s) for roof shape data source(s)", + example: ["", "", ""], + }, sust_breeam_rating: { category: Category.EnergyPerformance, diff --git a/migrations/044.construction_updates.down.sql b/migrations/044.construction_updates.down.sql index 3c6cdebb..27411779 100644 --- a/migrations/044.construction_updates.down.sql +++ b/migrations/044.construction_updates.down.sql @@ -14,4 +14,10 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS construction_irregularities; ALTER TABLE buildings DROP COLUMN IF EXISTS construction_irregularities_source_type; ALTER TABLE buildings DROP COLUMN IF EXISTS construction_irregularities_source_links; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_roof_covering_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_roof_covering_source_links; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_features; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_feature_materials; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_feature_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_feature_source_links; diff --git a/migrations/044.construction_updates.up.sql b/migrations/044.construction_updates.up.sql index a64fe307..9630d0ac 100644 --- a/migrations/044.construction_updates.up.sql +++ b/migrations/044.construction_updates.up.sql @@ -14,3 +14,10 @@ ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_irregularities text; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_irregularities_source_type text; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_irregularities_source_links text[]; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_roof_covering_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_roof_covering_source_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_features boolean; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_feature_materials text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_feature_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_feature_source_links text[]; \ No newline at end of file