Add Disaster Management section to Resilience Category
This commit is contained in:
parent
bed7b43fd9
commit
906ebd7431
@ -913,6 +913,32 @@
|
||||
<LineSymbolizer stroke="#888" stroke-width="3.0"/>
|
||||
</Rule>
|
||||
</Style>
|
||||
<Style name="disaster_severity">
|
||||
<Rule>
|
||||
<Filter>[disaster_severity] = "Building destroyed"</Filter>
|
||||
<PolygonSymbolizer fill="#bd0026" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[disaster_severity] = "Very severe"</Filter>
|
||||
<PolygonSymbolizer fill="#e31a1c" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[disaster_severity] = "Severe"</Filter>
|
||||
<PolygonSymbolizer fill="#fc4e2a" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[disaster_severity] = "Moderate"</Filter>
|
||||
<PolygonSymbolizer fill="#fd8d3c" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[disaster_severity] = "Minimal"</Filter>
|
||||
<PolygonSymbolizer fill="#feb24c" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>[disaster_severity] = "No damage visible"</Filter>
|
||||
<PolygonSymbolizer fill="#fed976" />
|
||||
</Rule>
|
||||
</Style>
|
||||
<Style name="dynamics_demolished_count">
|
||||
<Rule>
|
||||
<Filter>[dynamics_has_demolished_buildings] = false</Filter>
|
||||
|
@ -407,8 +407,23 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
|
||||
other_team_source_link: {
|
||||
edit: true,
|
||||
verify: true
|
||||
}
|
||||
|
||||
},
|
||||
disaster_type: {
|
||||
edit: true,
|
||||
verify: true
|
||||
},
|
||||
disaster_severity: {
|
||||
edit: true,
|
||||
verify: true
|
||||
},
|
||||
disaster_assessment_method: {
|
||||
edit: true,
|
||||
verify: true
|
||||
},
|
||||
disaster_source_link: {
|
||||
edit: true,
|
||||
verify: true
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
|
@ -1,102 +1,188 @@
|
||||
import React from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import InfoBox from '../../components/info-box';
|
||||
|
||||
import { Category } from '../../config/categories-config';
|
||||
import { dataFields } from '../../config/data-fields-config';
|
||||
|
||||
import DataEntry from '../data-components/data-entry';
|
||||
import { DataEntryGroup } from '../data-components/data-entry-group';
|
||||
import { DynamicsBuildingPane, DynamicsDataEntry } from './dynamics/dynamics-data-entry';
|
||||
import { FieldRow } from '../data-components/field-row';
|
||||
import NumericDataEntry from '../data-components/numeric-data-entry';
|
||||
import SelectDataEntry from '../data-components/select-data-entry';
|
||||
import withCopyEdit from '../data-container';
|
||||
|
||||
import Verification from '../data-components/verification';
|
||||
import { CategoryViewProps } from './category-view-props';
|
||||
import { LogicalDataEntry } from '../data-components/logical-data-entry/logical-data-entry';
|
||||
import { useDisplayPreferences } from '../../displayPreferences-context';
|
||||
import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry';
|
||||
|
||||
/**
|
||||
* Dynamics view/edit section
|
||||
*/
|
||||
const ResilienceView: React.FunctionComponent<CategoryViewProps> = (props) => {
|
||||
|
||||
const { historicData, historicDataSwitchOnClick, darkLightTheme } = useDisplayPreferences();
|
||||
|
||||
return (<>
|
||||
<InfoBox>
|
||||
This section is under development.
|
||||
</InfoBox>
|
||||
<DataEntry
|
||||
title="Building age"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Typical typology lifespan"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Typology adaptability rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Physical adaptability rating - within plot"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Landuse adaptability rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Structural material lifespan rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Protection from demolition rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Flood risk rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Surface geology type"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Average community value rating for typology"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Other rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Total resilience rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntryGroup name="Disaster Management" collapsed={true} >
|
||||
<InfoBox>
|
||||
This feature is designed to help communities capture data on the state of buildings
|
||||
during major disasters, to support emergency services and to record damage to aid reconstruction programmes.
|
||||
</InfoBox>
|
||||
<button className={`map-switcher-inline ${historicData}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={historicDataSwitchOnClick}>
|
||||
{(historicData === 'enabled')?'Click here to hide disaster maps':'Click here to show disaster maps'}
|
||||
</button>
|
||||
<SelectDataEntry
|
||||
slug='disaster_type'
|
||||
title={dataFields.disaster_type.title}
|
||||
value={props.building.disaster_type}
|
||||
options={[
|
||||
'Flood',
|
||||
'Earthquake',
|
||||
'Hurricane',
|
||||
'Fire',
|
||||
'Extreme heat',
|
||||
'Political/war damage',
|
||||
'Other human (blast damage/spills etc.)',
|
||||
'Other'
|
||||
]}
|
||||
|
||||
onChange={props.onChange}
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
/>
|
||||
<SelectDataEntry
|
||||
slug='disaster_severity'
|
||||
title={dataFields.disaster_severity.title}
|
||||
value={props.building.disaster_severity}
|
||||
options={[
|
||||
'Building destroyed',
|
||||
'Very severe',
|
||||
'Severe',
|
||||
'Moderate',
|
||||
'Minimal',
|
||||
'No damage visible',
|
||||
]}
|
||||
|
||||
onChange={props.onChange}
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
/>
|
||||
<Verification
|
||||
slug="disaster_severity"
|
||||
allow_verify={props.user !== undefined && props.building.disaster_severity !== null && !props.edited}
|
||||
onVerify={props.onVerify}
|
||||
user_verified={props.user_verified.hasOwnProperty("disaster_severity")}
|
||||
user_verified_as={props.user_verified.disaster_severity}
|
||||
verified_count={props.building.verified.disaster_severity}
|
||||
/>
|
||||
<SelectDataEntry
|
||||
slug='disaster_assessment_method'
|
||||
title={dataFields.disaster_assessment_method.title}
|
||||
value={props.building.disaster_assessment_method}
|
||||
options={[
|
||||
'Citizen/Passerby by eye',
|
||||
'Government assessor',
|
||||
'Specialist emergency group/charity',
|
||||
'Other',
|
||||
]}
|
||||
|
||||
onChange={props.onChange}
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
/>
|
||||
<Verification
|
||||
slug="disaster_assessment_method"
|
||||
allow_verify={props.user !== undefined && props.building.disaster_assessment_method !== null && !props.edited}
|
||||
onVerify={props.onVerify}
|
||||
user_verified={props.user_verified.hasOwnProperty("disaster_assessment_method")}
|
||||
user_verified_as={props.user_verified.disaster_assessment_method}
|
||||
verified_count={props.building.verified.disaster_assessment_method}
|
||||
/>
|
||||
<MultiDataEntry
|
||||
title={dataFields.disaster_source_link.title}
|
||||
slug="disaster_source_link"
|
||||
value={props.building.disaster_source_link}
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
tooltip={dataFields.disaster_source_link.tooltip}
|
||||
placeholder="https://..."
|
||||
editableEntries={true}
|
||||
isUrl={true}
|
||||
/>
|
||||
</DataEntryGroup>
|
||||
<DataEntryGroup name="Resilience indicators" collapsed={true} >
|
||||
<InfoBox>
|
||||
This section is under development.
|
||||
</InfoBox>
|
||||
<DataEntry
|
||||
title="Building age"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Typical typology lifespan"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Typology adaptability rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Physical adaptability rating - within plot"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Landuse adaptability rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Structural material lifespan rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Protection from demolition rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Flood risk rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Surface geology type"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Average community value rating for typology"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Other rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
<DataEntry
|
||||
title="Total resilience rating"
|
||||
slug=""
|
||||
value=""
|
||||
mode='view'
|
||||
/>
|
||||
</DataEntryGroup>
|
||||
</>)
|
||||
};
|
||||
|
||||
|
@ -354,39 +354,69 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
|
||||
elements: []
|
||||
},
|
||||
}],
|
||||
[Category.Resilience]: [{
|
||||
mapStyle: 'dynamics_demolished_count',
|
||||
legend: {
|
||||
title: 'Resilience',
|
||||
description: 'Demolished buildings on the same site',
|
||||
elements: [
|
||||
{
|
||||
text: '7+',
|
||||
color: '#bd0026',
|
||||
}, {
|
||||
text: '6',
|
||||
color: '#e31a1c',
|
||||
}, {
|
||||
text: '5',
|
||||
color: '#fc4e2a',
|
||||
}, {
|
||||
text: '4',
|
||||
color: '#fd8d3c',
|
||||
}, {
|
||||
text: '3',
|
||||
color: '#feb24c',
|
||||
}, {
|
||||
text: '2',
|
||||
color: '#fed976',
|
||||
}, {
|
||||
text: '1',
|
||||
color: '#ffe8a9',
|
||||
}, {
|
||||
text: 'None',
|
||||
color: '#0C7BDC'
|
||||
}
|
||||
],
|
||||
[Category.Resilience]: [
|
||||
{
|
||||
mapStyle: 'disaster_severity',
|
||||
legend: {
|
||||
title: 'Severity of damage',
|
||||
description: 'Severity of damage to building',
|
||||
elements: [
|
||||
{
|
||||
text: 'Building destroyed',
|
||||
color: '#bd0026',
|
||||
}, {
|
||||
text: 'Very severe',
|
||||
color: '#e31a1c',
|
||||
}, {
|
||||
text: 'Severe',
|
||||
color: '#fc4e2a',
|
||||
}, {
|
||||
text: 'Moderate',
|
||||
color: '#fd8d3c',
|
||||
}, {
|
||||
text: 'Minimal ',
|
||||
color: '#feb24c',
|
||||
}, {
|
||||
text: 'No damage visible',
|
||||
color: '#fed976',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
}]
|
||||
{
|
||||
mapStyle: 'dynamics_demolished_count',
|
||||
legend: {
|
||||
title: 'Resilience',
|
||||
description: 'Demolished buildings on the same site',
|
||||
elements: [
|
||||
{
|
||||
text: '7+',
|
||||
color: '#bd0026',
|
||||
}, {
|
||||
text: '6',
|
||||
color: '#e31a1c',
|
||||
}, {
|
||||
text: '5',
|
||||
color: '#fc4e2a',
|
||||
}, {
|
||||
text: '4',
|
||||
color: '#fd8d3c',
|
||||
}, {
|
||||
text: '3',
|
||||
color: '#feb24c',
|
||||
}, {
|
||||
text: '2',
|
||||
color: '#fed976',
|
||||
}, {
|
||||
text: '1',
|
||||
color: '#ffe8a9',
|
||||
}, {
|
||||
text: 'None',
|
||||
color: '#0C7BDC'
|
||||
}
|
||||
],
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
};
|
||||
|
@ -811,6 +811,27 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
|
||||
title: "Source other significant team members",
|
||||
example: ["", "", ""],
|
||||
},
|
||||
disaster_type: {
|
||||
category: Category.Resilience,
|
||||
title: "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?",
|
||||
example: "Building destroyed"
|
||||
},
|
||||
disaster_assessment_method: {
|
||||
category: Category.Resilience,
|
||||
title: "Please add a method of assessment",
|
||||
example: "Citizen/Passerby by eye"
|
||||
},
|
||||
disaster_source_link: {
|
||||
category: Category.Resilience,
|
||||
title: "Please add a source link to official documentation where applicable",
|
||||
tooltip: "URL for data sources(s)",
|
||||
example: ["", "", ""],
|
||||
},
|
||||
};
|
||||
|
||||
export const allFieldsConfig = {...dataFields, ...buildingUserFields};
|
@ -21,6 +21,7 @@ export type BuildingMapTileset = 'date_year' |
|
||||
'building_attachment_form' |
|
||||
'landuse' |
|
||||
'dynamics_demolished_count' |
|
||||
'disaster_severity' |
|
||||
'team' |
|
||||
'survival_status';
|
||||
|
||||
|
@ -266,6 +266,13 @@ const LAYER_QUERIES = {
|
||||
buildings
|
||||
WHERE
|
||||
current_landuse_order IS NOT NULL`,
|
||||
disaster_severity: `
|
||||
SELECT
|
||||
geometry_id,
|
||||
disaster_severity
|
||||
FROM
|
||||
buildings
|
||||
WHERE disaster_severity IS NOT NULL`,
|
||||
dynamics_demolished_count: `
|
||||
SELECT
|
||||
geometry_id,
|
||||
|
@ -58,7 +58,11 @@ COPY (SELECT
|
||||
community_type_worth_keeping_total,
|
||||
likes_total,
|
||||
survival_status,
|
||||
survival_source
|
||||
survival_source,
|
||||
disaster_type,
|
||||
disaster_severity,
|
||||
disaster_assessment_method,
|
||||
disaster_source_link
|
||||
FROM buildings)
|
||||
TO '/tmp/building_attributes.csv'
|
||||
WITH CSV HEADER
|
||||
|
4
migrations/039.disaster_status.down.sql
Normal file
4
migrations/039.disaster_status.down.sql
Normal file
@ -0,0 +1,4 @@
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS disaster_type;
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS disaster_severity;
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS disaster_assessment_method;
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS disaster_source_link;
|
4
migrations/039.disaster_status.up.sql
Normal file
4
migrations/039.disaster_status.up.sql
Normal file
@ -0,0 +1,4 @@
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS disaster_type text;
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS disaster_severity text;
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS disaster_assessment_method text;
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS disaster_source_link text[];
|
Loading…
Reference in New Issue
Block a user