Merge branch 'feature/disaster-management' into feature/ui-refactor

This commit is contained in:
Mike Simpson 2023-05-11 22:13:24 +01:00
commit 2c266d0c28
12 changed files with 517 additions and 120 deletions

View File

@ -913,6 +913,32 @@
<LineSymbolizer stroke="#888" stroke-width="3.0"/> <LineSymbolizer stroke="#888" stroke-width="3.0"/>
</Rule> </Rule>
</Style> </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"> <Style name="dynamics_demolished_count">
<Rule> <Rule>
<Filter>[dynamics_has_demolished_buildings] = false</Filter> <Filter>[dynamics_has_demolished_buildings] = false</Filter>

140
app/package-lock.json generated
View File

@ -33,6 +33,7 @@
"pg-promise": "^10.11.1", "pg-promise": "^10.11.1",
"query-string": "^6.13.1", "query-string": "^6.13.1",
"react": "^17.0.2", "react": "^17.0.2",
"react-datepicker": "^4.11.0",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-leaflet": "^3.1.0", "react-leaflet": "^3.1.0",
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",
@ -2646,6 +2647,15 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/@popperjs/core": {
"version": "2.11.7",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.7.tgz",
"integrity": "sha512-Cr4OjIkipTtcXKjAsm8agyleBuDHvxzeBoa1v543lbv1YaIwQjESsVcmjiWiPEbC1FIeHOG/Op9kdCmAmiS3Kw==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/popperjs"
}
},
"node_modules/@react-leaflet/core": { "node_modules/@react-leaflet/core": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@react-leaflet/core/-/core-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@react-leaflet/core/-/core-1.1.1.tgz",
@ -4897,6 +4907,11 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/classnames": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz",
"integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw=="
},
"node_modules/clean-css": { "node_modules/clean-css": {
"version": "4.2.4", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz",
@ -5940,6 +5955,18 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/date-fns": {
"version": "2.29.3",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz",
"integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==",
"engines": {
"node": ">=0.11"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/date-fns"
}
},
"node_modules/debug": { "node_modules/debug": {
"version": "4.3.3", "version": "4.3.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
@ -14834,6 +14861,23 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/react-datepicker": {
"version": "4.11.0",
"resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-4.11.0.tgz",
"integrity": "sha512-50n93o7mQwBEhg05tbopjFKgs8qgi8VBCAOMC4VqrKut72eAjESc/wXS/k5hRtnP0oe2FCGw7MJuIwh37wuXOw==",
"dependencies": {
"@popperjs/core": "^2.9.2",
"classnames": "^2.2.6",
"date-fns": "^2.24.0",
"prop-types": "^15.7.2",
"react-onclickoutside": "^6.12.2",
"react-popper": "^2.3.0"
},
"peerDependencies": {
"react": "^16.9.0 || ^17 || ^18",
"react-dom": "^16.9.0 || ^17 || ^18"
}
},
"node_modules/react-dev-utils": { "node_modules/react-dev-utils": {
"version": "11.0.4", "version": "11.0.4",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-11.0.4.tgz", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-11.0.4.tgz",
@ -15244,6 +15288,11 @@
"integrity": "sha512-mKR90fX7Pm5seCOfz8q9F+66VCc1PGsWSBxKbITjfKVQHMNF2zudxHnMdJiB1fRCb+XsbQV9sO9DCkgsMQgBIA==", "integrity": "sha512-mKR90fX7Pm5seCOfz8q9F+66VCc1PGsWSBxKbITjfKVQHMNF2zudxHnMdJiB1fRCb+XsbQV9sO9DCkgsMQgBIA==",
"dev": true "dev": true
}, },
"node_modules/react-fast-compare": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.1.tgz",
"integrity": "sha512-xTYf9zFim2pEif/Fw16dBiXpe0hoy5PxcD8+OwBnTtNLfIm3g6WxhKNurY+6OmdH1u6Ta/W/Vl6vjbYP1MFnDg=="
},
"node_modules/react-is": { "node_modules/react-is": {
"version": "16.13.1", "version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@ -15262,6 +15311,33 @@
"react-dom": "^17.0.1" "react-dom": "^17.0.1"
} }
}, },
"node_modules/react-onclickoutside": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/react-onclickoutside/-/react-onclickoutside-6.13.0.tgz",
"integrity": "sha512-ty8So6tcUpIb+ZE+1HAhbLROvAIJYyJe/1vRrrcmW+jLsaM+/powDRqxzo6hSh9CuRZGSL1Q8mvcF5WRD93a0A==",
"funding": {
"type": "individual",
"url": "https://github.com/Pomax/react-onclickoutside/blob/master/FUNDING.md"
},
"peerDependencies": {
"react": "^15.5.x || ^16.x || ^17.x || ^18.x",
"react-dom": "^15.5.x || ^16.x || ^17.x || ^18.x"
}
},
"node_modules/react-popper": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/react-popper/-/react-popper-2.3.0.tgz",
"integrity": "sha512-e1hj8lL3uM+sgSR4Lxzn5h1GxBlpa4CQz0XLF8kx4MDrDRWY0Ena4c97PUeSX9i5W3UAfDP0z0FXCTQkoXUl3Q==",
"dependencies": {
"react-fast-compare": "^3.0.1",
"warning": "^4.0.2"
},
"peerDependencies": {
"@popperjs/core": "^2.0.0",
"react": "^16.8.0 || ^17 || ^18",
"react-dom": "^16.8.0 || ^17 || ^18"
}
},
"node_modules/react-refresh": { "node_modules/react-refresh": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.9.0.tgz", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.9.0.tgz",
@ -18822,6 +18898,14 @@
"makeerror": "1.0.12" "makeerror": "1.0.12"
} }
}, },
"node_modules/warning": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz",
"integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==",
"dependencies": {
"loose-envify": "^1.0.0"
}
},
"node_modules/watchpack": { "node_modules/watchpack": {
"version": "2.4.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",
@ -22102,6 +22186,11 @@
"rimraf": "^3.0.2" "rimraf": "^3.0.2"
} }
}, },
"@popperjs/core": {
"version": "2.11.7",
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.7.tgz",
"integrity": "sha512-Cr4OjIkipTtcXKjAsm8agyleBuDHvxzeBoa1v543lbv1YaIwQjESsVcmjiWiPEbC1FIeHOG/Op9kdCmAmiS3Kw=="
},
"@react-leaflet/core": { "@react-leaflet/core": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@react-leaflet/core/-/core-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@react-leaflet/core/-/core-1.1.1.tgz",
@ -23929,6 +24018,11 @@
} }
} }
}, },
"classnames": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz",
"integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw=="
},
"clean-css": { "clean-css": {
"version": "4.2.4", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz", "resolved": "https://registry.npmjs.org/clean-css/-/clean-css-4.2.4.tgz",
@ -24753,6 +24847,11 @@
"whatwg-url": "^8.0.0" "whatwg-url": "^8.0.0"
} }
}, },
"date-fns": {
"version": "2.29.3",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz",
"integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA=="
},
"debug": { "debug": {
"version": "4.3.3", "version": "4.3.3",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz",
@ -31508,6 +31607,19 @@
"object-assign": "^4.1.1" "object-assign": "^4.1.1"
} }
}, },
"react-datepicker": {
"version": "4.11.0",
"resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-4.11.0.tgz",
"integrity": "sha512-50n93o7mQwBEhg05tbopjFKgs8qgi8VBCAOMC4VqrKut72eAjESc/wXS/k5hRtnP0oe2FCGw7MJuIwh37wuXOw==",
"requires": {
"@popperjs/core": "^2.9.2",
"classnames": "^2.2.6",
"date-fns": "^2.24.0",
"prop-types": "^15.7.2",
"react-onclickoutside": "^6.12.2",
"react-popper": "^2.3.0"
}
},
"react-dev-utils": { "react-dev-utils": {
"version": "11.0.4", "version": "11.0.4",
"resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-11.0.4.tgz", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-11.0.4.tgz",
@ -31839,6 +31951,11 @@
"integrity": "sha512-mKR90fX7Pm5seCOfz8q9F+66VCc1PGsWSBxKbITjfKVQHMNF2zudxHnMdJiB1fRCb+XsbQV9sO9DCkgsMQgBIA==", "integrity": "sha512-mKR90fX7Pm5seCOfz8q9F+66VCc1PGsWSBxKbITjfKVQHMNF2zudxHnMdJiB1fRCb+XsbQV9sO9DCkgsMQgBIA==",
"dev": true "dev": true
}, },
"react-fast-compare": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.1.tgz",
"integrity": "sha512-xTYf9zFim2pEif/Fw16dBiXpe0hoy5PxcD8+OwBnTtNLfIm3g6WxhKNurY+6OmdH1u6Ta/W/Vl6vjbYP1MFnDg=="
},
"react-is": { "react-is": {
"version": "16.13.1", "version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@ -31852,6 +31969,21 @@
"@react-leaflet/core": "^1.1.1" "@react-leaflet/core": "^1.1.1"
} }
}, },
"react-onclickoutside": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/react-onclickoutside/-/react-onclickoutside-6.13.0.tgz",
"integrity": "sha512-ty8So6tcUpIb+ZE+1HAhbLROvAIJYyJe/1vRrrcmW+jLsaM+/powDRqxzo6hSh9CuRZGSL1Q8mvcF5WRD93a0A==",
"requires": {}
},
"react-popper": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/react-popper/-/react-popper-2.3.0.tgz",
"integrity": "sha512-e1hj8lL3uM+sgSR4Lxzn5h1GxBlpa4CQz0XLF8kx4MDrDRWY0Ena4c97PUeSX9i5W3UAfDP0z0FXCTQkoXUl3Q==",
"requires": {
"react-fast-compare": "^3.0.1",
"warning": "^4.0.2"
}
},
"react-refresh": { "react-refresh": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.9.0.tgz", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.9.0.tgz",
@ -34711,6 +34843,14 @@
"makeerror": "1.0.12" "makeerror": "1.0.12"
} }
}, },
"warning": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz",
"integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==",
"requires": {
"loose-envify": "^1.0.0"
}
},
"watchpack": { "watchpack": {
"version": "2.4.0", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz",

View File

@ -37,6 +37,7 @@
"pg-promise": "^10.11.1", "pg-promise": "^10.11.1",
"query-string": "^6.13.1", "query-string": "^6.13.1",
"react": "^17.0.2", "react": "^17.0.2",
"react-datepicker": "^4.11.0",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-leaflet": "^3.1.0", "react-leaflet": "^3.1.0",
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",

View File

@ -407,8 +407,31 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
other_team_source_link: { other_team_source_link: {
edit: true, edit: true,
verify: 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
},
disaster_start_date : {
edit: true,
verify: true
},
disaster_end_date : {
edit: true,
verify: true
} }
}); });

View File

@ -1,102 +1,222 @@
import React from 'react'; import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import InfoBox from '../../components/info-box'; import InfoBox from '../../components/info-box';
import { Category } from '../../config/categories-config';
import { dataFields } from '../../config/data-fields-config'; import { dataFields } from '../../config/data-fields-config';
import DataEntry from '../data-components/data-entry'; import DataEntry from '../data-components/data-entry';
import { DataEntryGroup } from '../data-components/data-entry-group'; import { DataEntryGroup } from '../data-components/data-entry-group';
import { DynamicsBuildingPane, DynamicsDataEntry } from './dynamics/dynamics-data-entry'; import SelectDataEntry from '../data-components/select-data-entry';
import { FieldRow } from '../data-components/field-row';
import NumericDataEntry from '../data-components/numeric-data-entry';
import withCopyEdit from '../data-container'; import withCopyEdit from '../data-container';
import Verification from '../data-components/verification';
import { CategoryViewProps } from './category-view-props'; 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';
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
/** /**
* Dynamics view/edit section * Dynamics view/edit section
*/ */
const ResilienceView: React.FunctionComponent<CategoryViewProps> = (props) => { const ResilienceView: React.FunctionComponent<CategoryViewProps> = (props) => {
const { historicData, historicDataSwitchOnClick, darkLightTheme } = useDisplayPreferences();
const [ startDate, setStartDate ] = useState(null);
const [ endDate, setEndDate ] = useState(null);
return (<> return (<>
<InfoBox> <DataEntryGroup name="Building Damage Assessment Tool" collapsed={true} >
This section is under development. <InfoBox>
</InfoBox> This feature is designed as an assessment tool to help communities capture data on the state of buildings following major disasters.
<DataEntry It is intended to help support emergency services, to record damage, and to aid reconstruction programmes.
title="Building age" </InfoBox>
slug="" <button className={`map-switcher-inline ${historicData}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={historicDataSwitchOnClick}>
value="" {(historicData === 'enabled')?'Click here to hide disaster maps':'Click here to show disaster maps'}
mode='view' </button>
/> <p>Date of Disaster</p>
<DataEntry <div>
title="Typical typology lifespan" <DatePicker
slug="" showIcon
value="" dateFormat="dd/MM/yyyy"
mode='view' slug="disaster_start_date"
/> selected={startDate}
<DataEntry onChange={(date) => setStartDate(date)}
title="Typology adaptability rating" title={dataFields.disaster_start_date.title}
slug="" //value={props.building.disaster_start_date}
value="" isClearable
mode='view' placeholderText="Select Start Date"
/> maxDate={new Date()}
<DataEntry />
title="Physical adaptability rating - within plot" </div>
slug="" <div>
value="" <DatePicker
mode='view' showIcon
/> dateFormat="dd/MM/yyyy"
<DataEntry slug="disaster_end_date"
title="Landuse adaptability rating" selected={endDate}
slug="" onChange={(date) => setEndDate(date)}
value="" title={dataFields.disaster_end_date.title}
mode='view' //value={props.building.disaster_end_date}
/> isClearable
<DataEntry placeholderText="Select End Date"
title="Structural material lifespan rating" maxDate={new Date()}
slug="" />
value="" </div>
mode='view' <SelectDataEntry
/> slug='disaster_type'
<DataEntry title={dataFields.disaster_type.title}
title="Protection from demolition rating" value={props.building.disaster_type}
slug="" options={[
value="" 'Flood',
mode='view' 'Earthquake',
/> 'Hurricane',
<DataEntry 'Fire',
title="Flood risk rating" 'Extreme heat',
slug="" 'Political/war damage',
value="" 'Other human (blast damage/spills etc.)',
mode='view' 'Other'
/> ]}
<DataEntry
title="Surface geology type" onChange={props.onChange}
slug="" mode={props.mode}
value="" copy={props.copy}
mode='view' />
/> <SelectDataEntry
<DataEntry slug='disaster_severity'
title="Average community value rating for typology" title={dataFields.disaster_severity.title}
slug="" value={props.building.disaster_severity}
value="" options={[
mode='view' 'Building destroyed',
/> 'Very severe',
<DataEntry 'Severe',
title="Other rating" 'Moderate',
slug="" 'Minimal',
value="" 'No damage visible',
mode='view' ]}
/>
<DataEntry onChange={props.onChange}
title="Total resilience rating" mode={props.mode}
slug="" copy={props.copy}
value="" />
mode='view' <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 and risk assessment" 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>
</>) </>)
}; };

View File

@ -354,39 +354,69 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
elements: [] elements: []
}, },
}], }],
[Category.Resilience]: [{ [Category.Resilience]: [
mapStyle: 'dynamics_demolished_count', {
legend: { mapStyle: 'disaster_severity',
title: 'Resilience', legend: {
description: 'Demolished buildings on the same site', title: 'Severity of damage',
elements: [ description: 'Severity of damage to building',
{ elements: [
text: '7+', {
color: '#bd0026', text: 'Building destroyed',
}, { color: '#bd0026',
text: '6', }, {
color: '#e31a1c', text: 'Very severe',
}, { color: '#e31a1c',
text: '5', }, {
color: '#fc4e2a', text: 'Severe',
}, { color: '#fc4e2a',
text: '4', }, {
color: '#fd8d3c', text: 'Moderate',
}, { color: '#fd8d3c',
text: '3', }, {
color: '#feb24c', text: 'Minimal ',
}, { color: '#feb24c',
text: '2', }, {
color: '#fed976', text: 'No damage visible',
}, { color: '#fed976',
text: '1', },
color: '#ffe8a9', ],
}, { },
text: 'None',
color: '#0C7BDC'
}
],
}, },
}] {
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'
}
],
},
}
]
}; };

View File

@ -811,6 +811,37 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
title: "Source other significant team members", title: "Source other significant team members",
example: ["", "", ""], 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/photographic evidence where applicable",
tooltip: "URL for data sources(s)",
example: ["", "", ""],
},
disaster_start_date: {
category: Category.Resilience,
title: "What was the start date of the disaster?",
example: "01/04/2023"
},
disaster_end_date: {
category: Category.Resilience,
title: "What was the end date of the disaster? (if applicable)",
example: "03/04/2023"
},
}; };
export const allFieldsConfig = {...dataFields, ...buildingUserFields}; export const allFieldsConfig = {...dataFields, ...buildingUserFields};

View File

@ -21,6 +21,7 @@ export type BuildingMapTileset = 'date_year' |
'building_attachment_form' | 'building_attachment_form' |
'landuse' | 'landuse' |
'dynamics_demolished_count' | 'dynamics_demolished_count' |
'disaster_severity' |
'team' | 'team' |
'survival_status'; 'survival_status';

View File

@ -266,6 +266,13 @@ const LAYER_QUERIES = {
buildings buildings
WHERE WHERE
current_landuse_order IS NOT NULL`, current_landuse_order IS NOT NULL`,
disaster_severity: `
SELECT
geometry_id,
disaster_severity
FROM
buildings
WHERE disaster_severity IS NOT NULL`,
dynamics_demolished_count: ` dynamics_demolished_count: `
SELECT SELECT
geometry_id, geometry_id,

View File

@ -58,7 +58,13 @@ COPY (SELECT
community_type_worth_keeping_total, community_type_worth_keeping_total,
likes_total, likes_total,
survival_status, survival_status,
survival_source survival_source,
disaster_type,
disaster_severity,
disaster_assessment_method,
disaster_source_link,
disaster_start_date,
disaster_end_date
FROM buildings) FROM buildings)
TO '/tmp/building_attributes.csv' TO '/tmp/building_attributes.csv'
WITH CSV HEADER WITH CSV HEADER

View File

@ -0,0 +1,6 @@
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;
ALTER TABLE buildings DROP COLUMN IF EXISTS disaster_start_date;
ALTER TABLE buildings DROP COLUMN IF EXISTS disaster_end_date;

View File

@ -0,0 +1,6 @@
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[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS disaster_start_date date;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS disaster_end_date date;