Add Structural System Subcategory

This commit is contained in:
Mike Simpson 2023-07-27 14:25:50 +01:00
parent 16c5a0a517
commit 39a0a01d57
5 changed files with 382 additions and 2 deletions

View File

@ -277,6 +277,54 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true, edit: true,
verify: 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,
},
planning_portal_link: { planning_portal_link: {
edit: true, edit: true,
verify: true, verify: true,

View File

@ -1,6 +1,6 @@
import React, { Fragment } from 'react'; 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 DataEntry from '../data-components/data-entry';
import SelectDataEntry from '../data-components/select-data-entry'; import SelectDataEntry from '../data-components/select-data-entry';
import withCopyEdit from '../data-container'; import withCopyEdit from '../data-container';
@ -9,6 +9,7 @@ import Verification from '../data-components/verification';
import { CategoryViewProps } from './category-view-props'; import { CategoryViewProps } from './category-view-props';
import InfoBox from '../../components/info-box'; import InfoBox from '../../components/info-box';
import { DataEntryGroup } from '../data-components/data-entry-group'; import { DataEntryGroup } from '../data-components/data-entry-group';
import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry';
const ConstructionMaterialsOptions = [ const ConstructionMaterialsOptions = [
'Wood', 'Wood',
@ -38,6 +39,199 @@ const RoofCoveringOptions = [
const ConstructionView: React.FunctionComponent<CategoryViewProps> = (props) => { const ConstructionView: React.FunctionComponent<CategoryViewProps> = (props) => {
return ( return (
<Fragment> <Fragment>
<DataEntryGroup name="Structural system">
<SelectDataEntry
title={dataFields.construction_structural_system.title}
slug="construction_structural_system"
value={props.building.construction_structural_system}
tooltip={dataFields.construction_structural_system.tooltip}
options={dataFields.construction_structural_system.items}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="construction_structural_system"
allow_verify={props.user !== undefined && props.building.construction_structural_system !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("construction_structural_system")}
user_verified_as={props.user_verified.construction_structural_system}
verified_count={props.building.verified.construction_structural_system}
/>
<SelectDataEntry
title={dataFields.construction_structural_system_source_type.title}
slug="construction_structural_system_source_type"
value={props.building.construction_structural_system_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_structural_system_source_type.tooltip}
placeholder={dataFields.construction_structural_system_source_type.example}
options={dataFields.construction_structural_system_source_type.items}
/>
{(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) ? <></> :
<>
<MultiDataEntry
title={dataFields.construction_structural_system_source_links.title}
slug="construction_structural_system_source_links"
value={props.building.construction_structural_system_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_structural_system_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<SelectDataEntry
title={dataFields.construction_foundation.title}
slug="construction_foundation"
value={props.building.construction_foundation}
tooltip={dataFields.construction_foundation.tooltip}
options={dataFields.construction_foundation.items}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="construction_foundation"
allow_verify={props.user !== undefined && props.building.construction_foundation !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("construction_foundation")}
user_verified_as={props.user_verified.construction_foundation}
verified_count={props.building.verified.construction_foundation}
/>
<SelectDataEntry
title={dataFields.construction_foundation_source_type.title}
slug="construction_foundation_source_type"
value={props.building.construction_foundation_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_foundation_source_type.tooltip}
placeholder={dataFields.construction_foundation_source_type.example}
options={dataFields.construction_foundation_source_type.items}
/>
{(props.building.construction_foundation_source_type == commonSourceTypes[0] ||
props.building.construction_foundation_source_type == commonSourceTypes[1] ||
props.building.construction_foundation_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.construction_foundation_source_links.title}
slug="construction_foundation_source_links"
value={props.building.construction_foundation_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_foundation_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<SelectDataEntry
title={dataFields.construction_roof_shape.title}
slug="construction_roof_shape"
value={props.building.construction_roof_shape}
tooltip={dataFields.construction_roof_shape.tooltip}
options={dataFields.construction_roof_shape.items}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="construction_roof_shape"
allow_verify={props.user !== undefined && props.building.construction_roof_shape !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("construction_roof_shape")}
user_verified_as={props.user_verified.construction_roof_shape}
verified_count={props.building.verified.construction_roof_shape}
/>
<SelectDataEntry
title={dataFields.construction_roof_shape_source_type.title}
slug="construction_roof_shape_source_type"
value={props.building.construction_roof_shape_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_roof_shape_source_type.tooltip}
placeholder={dataFields.construction_roof_shape_source_type.example}
options={dataFields.construction_roof_shape_source_type.items}
/>
{(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) ? <></> :
<>
<MultiDataEntry
title={dataFields.construction_roof_shape_source_links.title}
slug="construction_roof_shape_source_links"
value={props.building.construction_roof_shape_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_roof_shape_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<SelectDataEntry
title={dataFields.construction_irregularities.title}
slug="construction_irregularities"
value={props.building.construction_irregularities}
tooltip={dataFields.construction_irregularities.tooltip}
options={dataFields.construction_irregularities.items}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="construction_irregularities"
allow_verify={props.user !== undefined && props.building.construction_irregularities !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("construction_irregularities")}
user_verified_as={props.user_verified.construction_irregularities}
verified_count={props.building.verified.construction_irregularities}
/>
<SelectDataEntry
title={dataFields.construction_irregularities_source_type.title}
slug="construction_irregularities_source_type"
value={props.building.construction_irregularities_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_irregularities_source_type.tooltip}
placeholder={dataFields.construction_irregularities_source_type.example}
options={dataFields.construction_irregularities_source_type.items}
/>
{(props.building.construction_irregularities_source_type == commonSourceTypes[0] ||
props.building.construction_irregularities_source_type == commonSourceTypes[1] ||
props.building.construction_irregularities_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.construction_irregularities_source_links.title}
slug="construction_irregularities_source_links"
value={props.building.construction_irregularities_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_irregularities_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
</DataEntryGroup>
<DataEntryGroup name="Materials"> <DataEntryGroup name="Materials">
<SelectDataEntry <SelectDataEntry
title={dataFields.construction_core_material.title} title={dataFields.construction_core_material.title}

View File

@ -605,6 +605,111 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
tooltip: 'Main roof covering material', tooltip: 'Main roof covering material',
example: "", example: "",
}, },
construction_structural_system: {
category: Category.Construction,
title: "What type of structural system does the building appear to have?",
tooltip: "",
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: "",
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: "",
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?",
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: ["", "", ""],
},
sust_breeam_rating: { sust_breeam_rating: {
category: Category.EnergyPerformance, category: Category.EnergyPerformance,

View File

@ -0,0 +1,17 @@
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;

View File

@ -0,0 +1,16 @@
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[];