diff --git a/app/src/api/config/dataFields.ts b/app/src/api/config/dataFields.ts index 6a249cb5..a14a1b4f 100644 --- a/app/src/api/config/dataFields.ts +++ b/app/src/api/config/dataFields.ts @@ -270,6 +270,14 @@ export const buildingAttributesConfig = valueType()({ /* eslint edit: true, verify: true, }, + construction_core_material_source_type: { + edit: true, + verify: true, + }, + construction_core_material_source_links: { + edit: true, + verify: true, + }, construction_secondary_materials: { edit: false, }, @@ -277,6 +285,116 @@ 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, + }, + construction_structural_system_source_type: { + edit: true, + verify: true, + }, + construction_structural_system_source_links: { + edit: true, + verify: true, + }, + construction_foundation: { + edit: true, + verify: true, + }, + construction_foundation_source_type: { + edit: true, + verify: true, + }, + construction_foundation_source_links: { + edit: true, + verify: true, + }, + construction_roof_shape: { + edit: true, + verify: true, + }, + construction_roof_shape_source_type: { + edit: true, + verify: true, + }, + construction_roof_shape_source_links: { + edit: true, + verify: true, + }, + construction_irregularities: { + edit: true, + verify: true, + }, + construction_irregularities_source_type: { + edit: true, + verify: true, + }, + construction_irregularities_source_links: { + 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, + }, + construction_external_wall: { + edit: true, + verify: true, + }, + construction_external_wall_source_type: { + edit: true, + verify: true, + }, + construction_external_wall_source_links: { + edit: true, + verify: true, + }, + construction_internal_wall: { + edit: true, + verify: true, + }, + construction_internal_wall_source_type: { + edit: true, + verify: true, + }, + construction_internal_wall_source_links: { + edit: true, + verify: true, + }, + construction_ground_floor: { + edit: true, + verify: true, + }, + construction_ground_floor_source_type: { + edit: true, + verify: true, + }, + construction_ground_floor_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 69f709a1..1111b606 100644 --- a/app/src/frontend/building/data-containers/construction.tsx +++ b/app/src/frontend/building/data-containers/construction.tsx @@ -1,6 +1,6 @@ import React, { Fragment } from 'react'; -import { dataFields } from '../../config/data-fields-config'; +import { commonSourceTypes, dataFields } from '../../config/data-fields-config'; import DataEntry from '../data-components/data-entry'; import SelectDataEntry from '../data-components/select-data-entry'; import withCopyEdit from '../data-container'; @@ -9,6 +9,8 @@ import Verification from '../data-components/verification'; 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', @@ -21,23 +23,205 @@ 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 */ const ConstructionView: React.FunctionComponent = (props) => { return ( + + + + + {(props.building.construction_structural_system_source_type == commonSourceTypes[0] || + props.building.construction_structural_system_source_type == commonSourceTypes[1] || + props.building.construction_structural_system_source_type == null) ? <> : + <> + + + } +
+ + + + {(props.building.construction_foundation_source_type == commonSourceTypes[0] || + props.building.construction_foundation_source_type == commonSourceTypes[1] || + props.building.construction_foundation_source_type == null) ? <> : + <> + + + } +
+ + + + {(props.building.construction_roof_shape_source_type == commonSourceTypes[0] || + props.building.construction_roof_shape_source_type == commonSourceTypes[1] || + props.building.construction_roof_shape_source_type == null) ? <> : + <> + + + } +
+ + + + {(props.building.construction_irregularities_source_type == commonSourceTypes[0] || + props.building.construction_irregularities_source_type == commonSourceTypes[1] || + props.building.construction_irregularities_source_type == null) ? <> : + <> + + + } +
= (props) => user_verified={props.user_verified.hasOwnProperty("construction_core_material")} user_verified_as={props.user_verified.construction_core_material} verified_count={props.building.verified.construction_core_material} - /> + /> + {(props.building.construction_core_material_source_type == commonSourceTypes[0] || + props.building.construction_core_material_source_type == commonSourceTypes[1] || + props.building.construction_core_material_source_type == null) ? <> : + <> + + + } +
+ + + + {(props.building.construction_external_wall_source_type == commonSourceTypes[0] || + props.building.construction_external_wall_source_type == commonSourceTypes[1] || + props.building.construction_external_wall_source_type == null) ? <> : + <> + + + } +
+ + + + {(props.building.construction_internal_wall_source_type == commonSourceTypes[0] || + props.building.construction_internal_wall_source_type == commonSourceTypes[1] || + props.building.construction_internal_wall_source_type == null) ? <> : + <> + + + } +
+ + + + {(props.building.construction_ground_floor_source_type == commonSourceTypes[0] || + props.building.construction_ground_floor_source_type == commonSourceTypes[1] || + props.building.construction_ground_floor_source_type == null) ? <> : + <> + + + } +
= (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 1d41ef4b..ca141343 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -587,10 +587,23 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ construction_core_material: { category: Category.Construction, - title: "Core material", + title: "What is the main structural material thought to be?", tooltip: "The main structural material", example: "", }, + construction_core_material_source_type: { + category: Category.Construction, + title: "Source type", + tooltip: "Source of main structural material data", + example: "", + items: commonSourceTypes + }, + construction_core_material_source_links: { + category: Category.Construction, + title: "Source links", + tooltip: "URL(s) for main structural material data source(s)", + example: ["", "", ""], + }, construction_secondary_materials: { category: Category.Construction, @@ -601,9 +614,263 @@ 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: "Refer to GEM Taxonomy [LINK]", + example: "Solid masonry walls supporting the roof", + items: [ + "Solid masonry walls supporting the roof", + "A lateral load resisting structure (e.g. concrete or wooden frame)", + "Other" + ] + }, + construction_structural_system_source_type: { + category: Category.Construction, + title: "Source type", + tooltip: "Source of structural system data", + example: "", + items: commonSourceTypes + }, + construction_structural_system_source_links: { + category: Category.Construction, + title: "Source links", + tooltip: "URL(s) for structural system data source(s)", + example: ["", "", ""], + }, + construction_foundation: { + category: Category.Construction, + title: "What is the foundation system thought to be", + tooltip: "Refer to GEM Taxonomy [LINK]", + example: "Deep Foundations with lateral support", + items: [ + "Shallow foundations with no lateral support", + "Shallow foundations with lateral support", + "Deep foundations with no lateral support", + "Deep Foundations with lateral support", + "Other" + ] + }, + construction_foundation_source_type: { + category: Category.Construction, + title: "Source type", + tooltip: "Source of foundation system data", + example: "", + items: commonSourceTypes + }, + construction_foundation_source_links: { + category: Category.Construction, + title: "Source links", + tooltip: "URL(s) for foundation system data source(s)", + example: ["", "", ""], + }, + construction_roof_shape: { + category: Category.Construction, + title: "What kind of roof shape does the building have?", + tooltip: "Refer to GEM Taxonomy [LINK]", + example: "Pitched with gable ends", + items: [ + "What kind of roof shape does the building have?", + "Pitched with gable ends", + "Pitched and hipped", + "Pitched with dormers", + "Monopitch", + "Sawtooth", + "Curved", + "Complex regular", + "Complex irregular", + "Other" + ] + }, + construction_roof_shape_source_type: { + category: Category.Construction, + title: "Source type", + tooltip: "Source of roof shape data", + example: "", + items: commonSourceTypes + }, + construction_roof_shape_source_links: { + category: Category.Construction, + title: "Source links", + tooltip: "URL(s) for roof shape data source(s)", + example: ["", "", ""], + }, + 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? - Refer to GEM Taxonomy [LINK]", + example: "No irregularities", + items: [ + "Vertical irregularities", + "Horizontal irregularities", + "No irregularities" + ] + }, + construction_irregularities_source_type: { + category: Category.Construction, + title: "Source type", + tooltip: "Source of irregularity data", + example: "", + items: commonSourceTypes + }, + construction_irregularities_source_links: { + category: Category.Construction, + title: "Source links", + 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: ["", "", ""], + }, + construction_internal_wall: { + category: Category.Construction, + title: "What is the main internal wall material thought to be?", + tooltip: '', + example: "", + items: [ + 'Brick', + 'Stone', + 'Concrete blocks', + 'Concrete slabs/panels', + 'Wood', + 'Metal', + 'Adobe/Earth', + 'Glass', + 'Plastic', + 'Stucco on light framing', + 'Vegetative (straw, matting etc)', + 'Cement based boards', + ] + }, + construction_internal_wall_source_type: { + category: Category.Construction, + title: "Source type", + tooltip: "Source of internal wall data", + example: "", + items: commonSourceTypes + }, + construction_internal_wall_source_links: { + category: Category.Construction, + title: "Source links", + tooltip: "URL(s) for internal wall data source(s)", + example: ["", "", ""], + }, + construction_external_wall: { + category: Category.Construction, + title: "What is the main external wall material thought to be?", + tooltip: '', + example: "", + items: [ + 'Brick', + 'Stone', + 'Concrete blocks', + 'Concrete slabs/panels', + 'Wood', + 'Metal', + 'Adobe/Earth', + 'Glass', + 'Plastic', + 'Stucco on light framing', + 'Vegetative (straw, matting etc)', + 'Cement based boards', + ] + }, + construction_external_wall_source_type: { + category: Category.Construction, + title: "Source type", + tooltip: "Source of external wall data", + example: "", + items: commonSourceTypes + }, + construction_external_wall_source_links: { + category: Category.Construction, + title: "Source links", + tooltip: "URL(s) for external wall data source(s)", + example: ["", "", ""], + }, + construction_ground_floor: { + category: Category.Construction, + title: "What is the main ground floor material thought to be?", + tooltip: '', + example: "", + items: [ + 'Masonry', + 'Earthen', + 'Concrete', + 'Wood', + 'Metal', + 'Other', + ] + }, + construction_ground_floor_source_type: { + category: Category.Construction, + title: "Source type", + tooltip: "Source of ground floor material data", + example: "", + items: commonSourceTypes + }, + construction_ground_floor_source_links: { + category: Category.Construction, + title: "Source links", + tooltip: "URL(s) for ground floor material data source(s)", + example: ["", "", ""], }, sust_breeam_rating: { diff --git a/migrations/044.construction_updates.down.sql b/migrations/044.construction_updates.down.sql new file mode 100644 index 00000000..f964e8fd --- /dev/null +++ b/migrations/044.construction_updates.down.sql @@ -0,0 +1,38 @@ +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_structural_system; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_structural_system_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_structural_system_source_links; + +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_foundation; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_foundation_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_foundation_source_links; + +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_roof_shape; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_roof_shape_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_roof_shape_source_links; + +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; + +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_internal_wall; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_internal_wall_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_internal_wall_source_links; + +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_external_wall; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_external_wall_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_external_wall_source_links; + +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_ground_floor; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_ground_floor_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_ground_floor_source_links; + +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_core_material_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS construction_core_material_source_links; \ No newline at end of file diff --git a/migrations/044.construction_updates.up.sql b/migrations/044.construction_updates.up.sql new file mode 100644 index 00000000..35005e38 --- /dev/null +++ b/migrations/044.construction_updates.up.sql @@ -0,0 +1,38 @@ +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_structural_system text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_structural_system_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_structural_system_source_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_foundation text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_foundation_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_foundation_source_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_roof_shape text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_roof_shape_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_roof_shape_source_links text[]; + +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[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_internal_wall text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_internal_wall_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_internal_wall_source_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_external_wall text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_external_wall_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_external_wall_source_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_ground_floor text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_ground_floor_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_ground_floor_source_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_core_material_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_core_material_source_links text[]; \ No newline at end of file