Other Category Updates

- Consistent Construction Date between Age and Team categories
- Disable unused Verify buttons
- Add missing Verify buttons
- Add tooltips to Disaster section
- Add new fields to database
This commit is contained in:
Mike Simpson 2023-05-24 14:53:14 +01:00
parent 19c906fcc5
commit 8487ce3afe
9 changed files with 358 additions and 64 deletions

View File

@ -304,6 +304,14 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true,
},
sust_retrofit_source_type: {
edit: true,
verify: true,
},
sust_retrofit_source_links: {
edit: true,
verify: true,
},
sust_life_expectancy: {
edit: false,
},
@ -422,6 +430,14 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true
},
extension_source_type: {
edit: true,
verify: true
},
extension_source_links: {
edit: true,
verify: true
},
developer_type: {
edit: true,
verify: true
@ -430,6 +446,10 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true
},
developer_source_type: {
edit: true,
verify: true
},
developer_source_link: {
edit: true,
verify: true
@ -438,6 +458,10 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true
},
landowner_source_type: {
edit: true,
verify: true
},
landowner_source_link: {
edit: true,
verify: true
@ -446,6 +470,10 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true
},
designers_source_type: {
edit: true,
verify: true
},
designers_source_link: {
edit: true,
verify: true
@ -466,6 +494,10 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true
},
builder_source_type: {
edit: true,
verify: true
},
builder_source_link: {
edit: true,
verify: true

View File

@ -106,6 +106,24 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder={dataFields.date_source.example}
options={dataFields.date_source.items}
/>
{(props.building.date_source == dataFields.date_source.items[0] ||
props.building.date_source == dataFields.date_source.items[1] ||
props.building.date_source == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.date_link.title}
slug="date_link"
value={props.building.date_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.date_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<InfoBox type='warning'>
This section is under development.
@ -331,18 +349,24 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
options={dataFields.date_source.items}
placeholder={dataFields.date_source.example}
/>
<MultiDataEntry
title={dataFields.date_link.title}
slug="date_link"
value={props.building.date_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.date_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
{(props.building.date_source == dataFields.date_source.items[0] ||
props.building.date_source == dataFields.date_source.items[1] ||
props.building.date_source == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.date_link.title}
slug="date_link"
value={props.building.date_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.date_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<InfoBox type='warning'>
This section is under development.
@ -373,14 +397,14 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
value=""
mode='view'
/>
<Verification
{/* <Verification
slug="date_link"
allow_verify={props.user !== undefined && props.building.date_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("date_link")}
user_verified_as={props.user_verified.date_link}
verified_count={props.building.verified.date_link}
/>
/> */}
<DataEntry
title="Source"
slug=""
@ -393,14 +417,14 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
value=""
mode='view'
/>
<Verification
{/* <Verification
slug="date_link"
allow_verify={props.user !== undefined && props.building.date_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("date_link")}
user_verified_as={props.user_verified.date_link}
verified_count={props.building.verified.date_link}
/>
/> */}
<DataEntry
title="Source"
slug=""

View File

@ -10,6 +10,7 @@ import InfoBox from '../../components/info-box';
import { CategoryViewProps } from './category-view-props';
import { DataEntryGroup } from '../data-components/data-entry-group';
import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry';
const EnergyCategoryOptions = ["A", "B", "C", "D", "E", "F", "G"];
const BreeamRatingOptions = [
@ -98,20 +99,50 @@ const SustainabilityView: React.FunctionComponent<CategoryViewProps> = (props) =
user_verified_as={props.user_verified.sust_retrofit_date}
verified_count={props.building.verified.sust_retrofit_date}
/>
<SelectDataEntry
title={dataFields.sust_retrofit_source_type.title}
slug="sust_retrofit_source_type"
value={props.building.sust_retrofit_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.sust_retrofit_source_type.tooltip}
options={dataFields.sust_retrofit_source_type.items}
placeholder={dataFields.sust_retrofit_source_type.example}
/>
{(props.building.sust_retrofit_source_type == dataFields.sust_retrofit_source_type.items[0] ||
props.building.sust_retrofit_source_type == dataFields.sust_retrofit_source_type.items[1] ||
props.building.sust_retrofit_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.sust_retrofit_source_links.title}
slug="sust_retrofit_source_links"
value={props.building.sust_retrofit_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.sust_retrofit_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<DataEntry
title="Date of Significant Retrofits"
slug=""
value=""
mode='view'
/>
<Verification
{/* <Verification
slug="date_link"
allow_verify={props.user !== undefined && props.building.date_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("date_link")}
user_verified_as={props.user_verified.date_link}
verified_count={props.building.verified.date_link}
/>
/> */}
<DataEntry
title="Source"
slug=""

View File

@ -24,6 +24,9 @@ const ResilienceView: React.FunctionComponent<CategoryViewProps> = (props) => {
return (<>
<DataEntryGroup name="Building damage assessment tool" collapsed={true} >
<InfoBox type='warning'>
This section is under development.
</InfoBox>
<div className={`alert alert-dark`} role="alert" style={{ fontSize: 13, backgroundColor: "#f6f8f9" }}>
<i>
This feature is designed as an assessment tool to help communities capture data on the state of buildings following major disasters.
@ -76,7 +79,7 @@ const ResilienceView: React.FunctionComponent<CategoryViewProps> = (props) => {
'Other human (blast damage/spills etc.)',
'Other'
]}
tooltip={dataFields.disaster_type.tooltip}
onChange={props.onChange}
mode={props.mode}
copy={props.copy}
@ -93,7 +96,7 @@ const ResilienceView: React.FunctionComponent<CategoryViewProps> = (props) => {
'Minimal',
'No damage visible',
]}
tooltip={dataFields.disaster_severity.tooltip}
onChange={props.onChange}
mode={props.mode}
copy={props.copy}
@ -116,7 +119,7 @@ const ResilienceView: React.FunctionComponent<CategoryViewProps> = (props) => {
'Specialist emergency group/charity',
'Other',
]}
tooltip={dataFields.disaster_assessment_method.tooltip}
onChange={props.onChange}
mode={props.mode}
copy={props.copy}

View File

@ -160,6 +160,14 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
step={0.1}
min={0}
/>
<Verification
slug="size_height_eaves"
allow_verify={props.user !== undefined && props.building.size_height_eaves !== null}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("size_height_eaves")}
user_verified_as={props.user_verified.size_height_eaves}
verified_count={props.building.verified.size_height_eaves}
/>
<SelectDataEntry
title={dataFields.size_height_eaves_source_type.title}
slug="size_height_eaves_source_type"

View File

@ -1,6 +1,6 @@
import React, { Fragment } from 'react';
import InfoBox from '../../components/info-box';
import { dataFields } from '../../config/data-fields-config';
import { commonSourceTypes, dataFields } from '../../config/data-fields-config';
import SelectDataEntry from '../data-components/select-data-entry';
import NumericDataEntry from '../data-components/numeric-data-entry';
import Verification from '../data-components/verification';
@ -42,6 +42,36 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified_as={props.user_verified.date_year}
verified_count={props.building.verified.date_year}
/>
<SelectDataEntry
title={dataFields.date_source.title}
slug="date_source"
value={props.building.date_source}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.date_source.tooltip}
options={dataFields.date_source.items}
placeholder={dataFields.date_source.example}
/>
{(props.building.date_source == dataFields.date_source.items[0] ||
props.building.date_source == dataFields.date_source.items[1] ||
props.building.date_source == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.date_link.title}
slug="date_link"
value={props.building.date_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.date_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<LogicalDataEntry
title={dataFields.has_extension.title}
slug="has_extension"
@ -73,6 +103,35 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified_as={props.user_verified.extension_year}
verified_count={props.building.verified.extension_year}
/>
<SelectDataEntry
title={dataFields.extension_source_type.title}
slug="extension_source_type"
value={props.building.extension_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.extension_source_type.tooltip}
options={dataFields.extension_source_type.items}
placeholder={dataFields.extension_source_type.example}
/>
{(props.building.extension_source_type == dataFields.extension_source_type.items[0] ||
props.building.extension_source_type == dataFields.extension_source_type.items[1] ||
props.building.extension_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.extension_source_links.title}
slug="extension_source_links"
value={props.building.extension_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.extension_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
</>
) : (null)}
</DataEntryGroup>
@ -96,18 +155,35 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified_as={props.user_verified.landowner}
verified_count={props.building.verified.landowner}
/>
<MultiDataEntry
title={dataFields.landowner_source_link.title}
slug="landowner_source_link"
value={props.building.landowner_source_link}
<SelectDataEntry
title={dataFields.landowner_source_type.title}
slug="landowner_source_type"
value={props.building.landowner_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.landowner_source_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
tooltip={dataFields.landowner_source_type.tooltip}
options={dataFields.landowner_source_type.items}
placeholder={dataFields.landowner_source_type.example}
/>
{(props.building.landowner_source_type == commonSourceTypes[0] ||
props.building.landowner_source_type == commonSourceTypes[1] ||
props.building.landowner_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.landowner_source_link.title}
slug="landowner_source_link"
value={props.building.landowner_source_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.landowner_source_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
</DataEntryGroup>
<DataEntryGroup name="Developer data">
<SelectDataEntry
@ -146,18 +222,35 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified_as={props.user_verified.developer_name}
verified_count={props.building.verified.developer_name}
/>
<MultiDataEntry
title={dataFields.developer_source_link.title}
slug="developer_source_link"
value={props.building.developer_source_link}
<SelectDataEntry
title={dataFields.developer_source_type.title}
slug="developer_source_type"
value={props.building.developer_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.developer_source_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
tooltip={dataFields.developer_source_type.tooltip}
options={dataFields.developer_source_type.items}
placeholder={dataFields.developer_source_type.example}
/>
{(props.building.developer_source_type == commonSourceTypes[0] ||
props.building.developer_source_type == commonSourceTypes[1] ||
props.building.developer_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.developer_source_link.title}
slug="developer_source_link"
value={props.building.developer_source_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.developer_source_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
</DataEntryGroup>
<DataEntryGroup name="Designer data">
<MultiDataEntry
@ -179,18 +272,7 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified_as={props.user_verified.designers}
verified_count={props.building.verified.designers}
/>
<MultiDataEntry
title={dataFields.designers_source_link.title}
slug="designers_source_link"
value={props.building.designers_source_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.designers_source_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
<SelectDataEntry
slug='lead_designer_type'
title={dataFields.lead_designer_type.title}
@ -208,6 +290,36 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified_as={props.user_verified.lead_designer_type}
verified_count={props.building.verified.lead_designer_type}
/>
<SelectDataEntry
title={dataFields.designers_source_type.title}
slug="designers_source_type"
value={props.building.designers_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.designers_source_type.tooltip}
options={dataFields.designers_source_type.items}
placeholder={dataFields.designers_source_type.example}
/>
{(props.building.designers_source_type == commonSourceTypes[0] ||
props.building.designers_source_type == commonSourceTypes[1] ||
props.building.designers_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.designers_source_link.title}
slug="designers_source_link"
value={props.building.designers_source_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.designers_source_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<LogicalDataEntryYesOnly
slug='designer_awards'
title={dataFields.designer_awards.title}
@ -270,17 +382,34 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified_as={props.user_verified.builder}
verified_count={props.building.verified.builder}
/>
<MultiDataEntry
title={dataFields.builder_source_link.title}
slug="builder_source_link"
value={props.building.builder_source_link}
<SelectDataEntry
title={dataFields.builder_source_type.title}
slug="builder_source_type"
value={props.building.builder_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
placeholder="https://..."
editableEntries={true}
isUrl={true}
tooltip={dataFields.builder_source_type.tooltip}
options={dataFields.builder_source_type.items}
placeholder={dataFields.builder_source_type.example}
/>
{(props.building.builder_source_type == commonSourceTypes[0] ||
props.building.builder_source_type == commonSourceTypes[1] ||
props.building.builder_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.builder_source_link.title}
slug="builder_source_link"
value={props.building.builder_source_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
</DataEntryGroup>
</form>
);

View File

@ -557,6 +557,19 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
tooltip: "Date of last major building refurbishment",
example: 1920,
},
sust_retrofit_source_type: {
category: Category.Team,
title: "Source type",
tooltip: "Source of last significant retrofit data",
example: "",
items: commonSourceTypes
},
sust_retrofit_source_links: {
category: Category.Team,
title: "Source links",
tooltip: "URL(s) for last significant retrofit data source(s)",
example: ["", "", ""],
},
sust_life_expectancy: {
category: Category.EnergyPerformance,
title: "Expected lifespan for typology",
@ -837,6 +850,19 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
tooltip_extension: "This should be the year the extension was built, not the original building",
example: 2020
},
extension_source_type: {
category: Category.Team,
title: "Source type",
tooltip: "Source type for extension data",
example: "",
items: commonSourceTypes
},
extension_source_links: {
category: Category.Team,
title: "Source link(s)",
tooltip: "Source link(s) for extension data",
example: ["", "", ""],
},
developer_type: {
category: Category.Team,
title: "What type of developer built the building?",
@ -858,6 +884,13 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
tooltip: "Free text. First name, space, then Last name",
example: ["", "", ""],
},
developer_source_type: {
category: Category.Team,
title: "Source type",
tooltip: "Source type for developer data",
example: "",
items: commonSourceTypes
},
developer_source_link: {
category: Category.Team,
title: "Source links for developer(s)",
@ -870,10 +903,17 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
tooltip: "Free text. First name, space, then Last name",
example: ["", "", ""],
},
landowner_source_type: {
category: Category.Team,
title: "Source type",
tooltip: "Source type for landowner data",
example: "",
items: commonSourceTypes
},
landowner_source_link: {
category: Category.Team,
title: "Source links for landowner(s)",
tooltip: "URL for source for landowner(s)",
title: "Source link(s)",
tooltip: "URL(s) for source for landowner data",
example: ["", "", ""],
},
designers: {
@ -882,6 +922,13 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
tooltip: "Free text. First name, space, then Last name",
example: ["", "", ""],
},
designers_source_type: {
category: Category.Team,
title: "Source type",
tooltip: "Source type for designer data",
example: "",
items: commonSourceTypes
},
designers_source_link: {
category: Category.Team,
title: "Source links for designer(s)",
@ -918,6 +965,13 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
title: "Name of builder/construction team",
example: ["", "", ""],
},
builder_source_type: {
category: Category.Team,
title: "Source type",
tooltip: "Source type for builder data",
example: "",
items: commonSourceTypes
},
builder_source_link: {
category: Category.Team,
title: "Source for builder/construction team",
@ -935,23 +989,26 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
},
disaster_type: {
category: Category.Resilience,
title: "What type of disaster management do you wish to collect data for?",
title: "Disaster type",
tooltip: "What type of disaster management do you wish to collect data for?",
example: "Flood"
},
disaster_severity: {
category: Category.Resilience,
title: "How severe do you assess the damage to be?",
tooltip: "Best estimate for the severity of damage to the building",
example: "Building destroyed"
},
disaster_assessment_method: {
category: Category.Resilience,
title: "Please add a method of assessment",
title: "Method of assessment",
tooltip: "Please add a Best estimate for the severity of damage to the building",
example: "Citizen/Passerby by eye"
},
disaster_source_link: {
category: Category.Resilience,
title: "Please add a source link to official documentation/photographic evidence where applicable",
tooltip: "URL for data sources(s)",
title: "Source link(s)",
tooltip: "Please add a source link(s) to official documentation/photographic evidence where applicable",
example: ["", "", ""],
},
disaster_start_date: {

View File

@ -14,3 +14,8 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS size_height_eaves;
ALTER TABLE buildings DROP COLUMN IF EXISTS size_width_frontage_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS size_width_frontage_source_links;
ALTER TABLE buildings DROP COLUMN IF EXISTS survival_source_links;
ALTER TABLE buildings DROP COLUMN IF EXISTS landowner_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS designers_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS builder_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS extension_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS extension_source_links;

View File

@ -16,3 +16,8 @@ ALTER TABLE buildings ADD COLUMN IF NOT EXISTS size_floor_area_source_links text
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS size_width_frontage_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS size_width_frontage_source_links text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS survival_source_links text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS landowner_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS designers_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS builder_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS extension_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS extension_source_links text[];