WIP - Survival Status data saving

Activate Survival Status drop down box on Age and History category. Allow it to be set, saved and visualised.
This commit is contained in:
Mike Simpson 2023-04-05 15:13:48 +01:00
parent ecb8f6b262
commit 8418b5f6c0
8 changed files with 167 additions and 69 deletions

View File

@ -623,6 +623,34 @@
<LineSymbolizer stroke="#888" stroke-width="3.0"/>
</Rule>
</Style>
<Style name="survival_status">
<Rule>
<Filter>[survival_status] = "Same as Historical Map (Unchanged)"</Filter>
<PolygonSymbolizer fill="#6ded45" />
</Rule>
<Rule>
<Filter>[survival_status] = "Similar to Historical Map (Some Changes)"</Filter>
<PolygonSymbolizer fill="#f7c725" />
</Rule>
<Rule>
<Filter>[survival_status] = "Historical Building Demolished"</Filter>
<PolygonSymbolizer fill="#ff2121" />
</Rule>
<Rule>
<Filter>[survival_status] = "Current Building on Previous Green Space"</Filter>
<PolygonSymbolizer fill="#CF26DF" />
</Rule>
<Rule>
<MaxScaleDenominator>17061</MaxScaleDenominator>
<MinScaleDenominator>4264</MinScaleDenominator>
<LineSymbolizer stroke="#888" stroke-width="1.0"/>
</Rule>
<Rule>
<MaxScaleDenominator>4264</MaxScaleDenominator>
<MinScaleDenominator>0</MinScaleDenominator>
<LineSymbolizer stroke="#888" stroke-width="3.0"/>
</Rule>
</Style>
<Style name="likes">
<Rule>
<Filter>[likes] &gt;= 100</Filter>

View File

@ -296,6 +296,10 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true
},
survival_status: {
edit: true,
verify: true
},
likes_total: {
edit: false,
derivedEdit: true,

View File

@ -20,10 +20,11 @@ import { CategoryViewProps } from './category-view-props';
import { LogicalDataEntry } from '../data-components/logical-data-entry/logical-data-entry';
import { useDisplayPreferences } from '../../displayPreferences-context';
const HistoricalStatusOptions = [
'The current footprint matches/almost exactly matches the historical map beneath, and/or is known to have been built before the map was made',
'The building core is the same as the historical map but has had multiple additions/changes',
'The building no longer exists',
const SurvivalStatusOptions = [
'Same as Historical Map (Unchanged)',
'Similar to Historical Map (Some Changes)',
'Historical Building Demolished',
'Current Building on Previous Green Space'
];
/**
@ -227,26 +228,32 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
</DataEntryGroup>
<DataEntryGroup name="Survival and Loss tracked using Historical Maps" collapsed={true} >
<InfoBox>
This section is under development.
Can you help us create a map that shows how many buildings in London have survived since the 1890s?
Choose a colour to indicate whether the building has survived.
</InfoBox>
<button className={`map-switcher-inline ${historicData}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={historicDataSwitchOnClick}>
{(historicData === 'enabled')?'Click here to hide historical maps':'Click here to show historical maps'}
</button>
<SelectDataEntry
title={dataFields.historical_status.title}
slug="historical_status"
value={""}
tooltip={dataFields.historical_status.tooltip}
options={HistoricalStatusOptions}
title={dataFields.survival_status.title}
slug="survival_status"
value={props.building.survival_status}
tooltip={dataFields.survival_status.tooltip}
options={SurvivalStatusOptions}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<DataEntry
title="Historical land use change"
slug=""
value=""
mode='view'
<SelectDataEntry
title={dataFields.survival_source.title}
slug="survival_source"
value={props.building.survival_source}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.survival_source.tooltip}
placeholder={dataFields.survival_source.example}
options={dataFields.survival_source.items}
/>
</DataEntryGroup>
</Fragment>
@ -496,26 +503,32 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
</DataEntryGroup>
<DataEntryGroup name="Survival and Loss tracked using Historical Maps" collapsed={true} >
<InfoBox>
This section is under development.
Can you help us create a map that shows how many buildings in London have survived since the 1890s?
Choose a colour to indicate whether the building has survived.
</InfoBox>
<button className={`map-switcher-inline ${historicData} btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={historicDataSwitchOnClick}>
<button className={`map-switcher-inline ${historicData}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={historicDataSwitchOnClick}>
{(historicData === 'enabled')?'Click here to hide historical maps':'Click here to show historical maps'}
</button>
<SelectDataEntry
title={dataFields.historical_status.title}
slug="historical_status"
title={dataFields.survival_status.title}
slug="survival_status"
value={""}
tooltip={dataFields.historical_status.tooltip}
options={HistoricalStatusOptions}
tooltip={dataFields.survival_status.tooltip}
options={SurvivalStatusOptions}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<DataEntry
title="Historical land use change"
slug=""
value=""
mode='view'
<SelectDataEntry
title={dataFields.survival_source.title}
slug="survival_source"
value={props.building.survival_source}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.survival_source.tooltip}
placeholder={dataFields.survival_source.example}
options={dataFields.survival_source.items}
/>
</DataEntryGroup>
</Fragment>

View File

@ -24,7 +24,8 @@ export interface CategoryMapDefinition {
export const defaultMapCategory = Category.Age;
export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} = {
[Category.Age]: [{
[Category.Age]: [
{
mapStyle: 'date_year',
legend: {
title: 'Age',
@ -46,8 +47,22 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
{ color: '#d0c291', text: '<1700' },
]
},
}],
[Category.Size]: [{
},
{
mapStyle: 'survival_status',
legend: {
title: 'Survival status',
elements: [
{ color: '#6ded45', text: 'Same as Historical Map (Unchanged)' },
{ color: '#f7c725', text: 'Similar to Historical Map (Some Changes)' },
{ color: '#ff2121', text: 'Historical Building Demolished' },
{ color: '#CF26DF', text: 'Current Building on Previous Green Space' },
]
}
},
],
[Category.Size]: [
{
mapStyle: 'size_height',
legend: {
title: 'Height to apex',
@ -62,7 +77,8 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
{ color: '#980043', text: '≥152'}
]
},
}],
}
],
[Category.Team]: [{
mapStyle: 'team',
legend: {

View File

@ -460,10 +460,37 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
//tooltip: ,
},
historical_status: {
survival_status: {
category: Category.Age,
title: "Historical Status",
title: "Survival status",
tooltip: "Survival and Loss tracked using Historical Maps",
items: [
"Same as Historical Map (Unchanged)",
"Similar to Historical Map (Some Changes)",
"Historical Building Demolished",
"Current Building on Previous Green Space"
],
example: "",
},
survival_source: {
category: Category.Age,
title: "Source of survival information",
tooltip: "Source for the survival status",
items: [
"Matched by comparing maps",
"Checked using streetview images",
"Historical publication or archive document",
"Other"
],
example: "",
},
survival_link: {
category: Category.Age,
title: "Please add any additional text or image links providing historical information on this building",
tooltip: "URL for age and date reference",
example: ["", "", ""],
},
edit_history: {

View File

@ -21,7 +21,8 @@ export type BuildingMapTileset = 'date_year' |
'building_attachment_form' |
'landuse' |
'dynamics_demolished_count' |
'team';
'team' |
'survival_status';
export type SpecialMapTileset = 'base_light' | 'base_night' | 'base_night_outlines' | 'highlight' | 'number_labels' | 'base_boroughs';

View File

@ -125,6 +125,14 @@ const LAYER_QUERIES = {
buildings
WHERE
is_domestic IS NOT NULL`,
survival_status: `
SELECT
geometry_id,
survival_status
FROM
buildings
WHERE
survival_status IS NOT NULL`,
likes: `
SELECT
geometry_id,

View File

@ -56,7 +56,8 @@ COPY (SELECT
planning_historic_area_assessment_url,
is_domestic,
community_type_worth_keeping_total,
likes_total
likes_total,
survival_status
FROM buildings)
TO '/tmp/building_attributes.csv'
WITH CSV HEADER