diff --git a/app/src/api/config/dataFields.ts b/app/src/api/config/dataFields.ts index 3ecaf757..a1917f0f 100644 --- a/app/src/api/config/dataFields.ts +++ b/app/src/api/config/dataFields.ts @@ -79,6 +79,14 @@ export const buildingAttributesConfig = valueType()({ /* eslint edit: true, verify: true }, + location_address_source: { + edit: true, + verify: true + }, + location_address_links: { + edit: true, + verify: true + }, location_latitude: { edit: true, verify: true, @@ -87,6 +95,14 @@ export const buildingAttributesConfig = valueType()({ /* eslint edit: true, verify: true, }, + location_coordinates_source: { + edit: true, + verify: true + }, + location_coordinates_links: { + edit: true, + verify: true + }, date_year: { edit: true, verify: true, @@ -284,18 +300,24 @@ export const buildingAttributesConfig = valueType()({ /* eslint edit: true, verify: true }, - demolished_buildings: { edit: true, verify: false, asJson: true, sqlCast: 'jsonb', }, - is_domestic: { edit: true, verify: true }, + is_domestic_source: { + edit: true, + verify: true + }, + is_domestic_links: { + edit: true, + verify: true + }, survival_status: { edit: true, verify: true diff --git a/app/src/frontend/building/data-containers/land-use.tsx b/app/src/frontend/building/data-containers/land-use.tsx index 7c39176c..d72add63 100644 --- a/app/src/frontend/building/data-containers/land-use.tsx +++ b/app/src/frontend/building/data-containers/land-use.tsx @@ -38,7 +38,7 @@ const UseView: React.FunctionComponent = (props) => { title={dataFields.is_domestic.title} slug="is_domestic" value={props.building.is_domestic} - options={["yes", "no", "mixed domestic/non-domestic"]} + options={dataFields.is_domestic.items} mode={props.mode} copy={props.copy} onChange={props.onChange} @@ -55,29 +55,30 @@ const UseView: React.FunctionComponent = (props) => { - + {(props.building.is_domestic_source == "Expert knowledge" || + props.building.is_domestic_source == "Observed from the street" || + props.building.is_domestic_source == null) ? <> : + <> + + } = (props) => ( - = (props) => ( mode='view' tooltip="Not yet activated.

For security reasons, we do not allow the use of free text boxes and are currently looking into alternative ways to collect this data." /> - -
= (props) => ( onChange={props.onChange} maxLength={8} valueTransform={x=>x.toUpperCase()} - /> = (props) => ( user_verified_as={props.user_verified.location_postcode} verified_count={props.building.verified.location_postcode} /> - + + {(props.building.location_address_source == "Expert/personal knowledge of building" || + props.building.location_address_source == "Online streetview image" || + props.building.location_address_source == null) ? <> : + <> + + + }
= (props) => ( user_verified_as={props.user_verified.location_longitude} verified_count={props.building.verified.location_longitude} /> - + {(props.building.location_coordinates_source == "Expert/personal knowledge of building" || + props.building.location_coordinates_source == "Online streetview image" || + props.building.location_coordinates_source == null) ? <> : + <> + + + }
); diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index c29f452d..6174f0a4 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -15,7 +15,7 @@ export interface DataFieldDefinition { * A field could be displayed in several categories, but this value will be used * when a single category needs to be shown in the context of a field, e.g. * in the case of edit history or the copy-paste tool (multi-edit) - * */ + * */ category: Category; /** @@ -41,7 +41,7 @@ export interface DataFieldDefinition { /** * If the defined type is a dictionary, this describes the types of the dictionary's fields */ - fields?: { [key: string]: Omit} + fields?: { [key: string]: Omit } /** * The example is used to determine the runtime type in which the attribute data is stored (e.g. number, string, object) @@ -110,7 +110,7 @@ export const buildingUserFields = { other: false } }, - + community_local_significance: { perUser: true, category: Category.Community, @@ -163,13 +163,34 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ example: "W1W 6TR", //tooltip: , }, + location_address_source: { + category: Category.Location, + title: "Source", + example: "", + tooltip: "Source of address data.", + items: [ + "Expert/personal knowledge of building", + "Online streetview image", + "Open planning authority dataset", + "Open property tax dataset", + "Open housing dataset", + "Open address dataset", + "Other" + ] + }, + location_address_links: { + category: Category.Location, + title: "Source link(s)", + tooltip: "URL(s) for building address data source(s).", + example: ["", "", ""], + }, ref_toid: { category: Category.Location, title: "Building footprint ID", tooltip: "Ordnance Survey Topography Layer ID (TOID) [link]", example: "", }, - + /** * UPRNs is not part of the buildings table, but the string fields * are included here for completeness @@ -178,16 +199,16 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ category: Category.Location, title: "Unique Property Reference Number(s) (UPRN)", tooltip: "Unique Property Reference Numbers (to be filled automatically) [LINK]", - example: [{uprn: "", parent_uprn: "" }, {uprn: "", parent_uprn: "" }], + example: [{ uprn: "", parent_uprn: "" }, { uprn: "", parent_uprn: "" }], }, planning_data: { category: Category.Location, title: "PLANNING DATA", tooltip: "PLANNING DATA", - example: [{uprn: "", building_id: 1, data_source: ""}, - {uprn: "", building_id: 1, data_source: "", status: "", status_before_aliasing: "", decision_date: "", description: "", planning_application_link: "", registered_with_local_authority_date: "", last_synced_date: "", data_source_link: "", address: ""}, - ], + example: [{ uprn: "", building_id: 1, data_source: "" }, + { uprn: "", building_id: 1, data_source: "", status: "", status_before_aliasing: "", decision_date: "", description: "", planning_application_link: "", registered_with_local_authority_date: "", last_synced_date: "", data_source_link: "", address: "" }, + ], }, @@ -209,6 +230,27 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ tooltip: "Longitude of building centroid", example: 0.12124, }, + location_coordinates_source: { + category: Category.Location, + title: "Source", + example: "", + tooltip: "Source of lcoordinate data.", + items: [ + "Expert/personal knowledge of building", + "Online streetview image", + "Open planning authority dataset", + "Open property tax dataset", + "Open housing dataset", + "Open address dataset", + "Other" + ] + }, + location_coordinates_links: { + category: Category.Location, + title: "Source link(s)", + tooltip: "URL(s) for building coordinate data source(s).", + example: ["", "", ""], + }, current_landuse_group: { category: Category.LandUse, title: "Current land use(s)", @@ -223,7 +265,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ }, current_landuse_source: { category: Category.LandUse, - title: "Source of information", + title: "Source type", tooltip: "Source for the current land use", example: "", items: [ @@ -244,8 +286,8 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ }, current_landuse_link: { category: Category.LandUse, - title: "Source links", - tooltip: "URL for current land use reference", + title: "Source link(s)", + tooltip: "URL(s) for current land use reference", example: ["", "", ""], }, current_landuse_verified: { @@ -261,7 +303,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ }, date_change_building_use: { category: Category.Typology, - title:"When did use change?", + title: "When did use change?", tooltip: "This is the date the building stopped being used for for the function it was built for. I.e. if it was Victorian warehouse which is now an office this would be when it became an office or if it was something before that, maybe a garage then the date that happened", example: 1920, }, @@ -287,7 +329,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ tooltip: "Best estimate for construction of main body of the building.", example: 1924, }, - date_lower : { + date_lower: { category: Category.Age, title: "Earliest possible start year", tooltip: "This should be the earliest year in which construction could have started.", @@ -412,21 +454,21 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ construction_core_material: { category: Category.Construction, title: "Core material", - tooltip:"The main structural material", + tooltip: "The main structural material", example: "", }, construction_secondary_materials: { category: Category.Construction, title: "Main secondary construction material/s", - tooltip:"Other construction materials", + tooltip: "Other construction materials", example: "", }, construction_roof_covering: { category: Category.Construction, title: "Main roof covering", - tooltip:'Main roof covering material', + tooltip: 'Main roof covering material', example: "", }, @@ -602,13 +644,32 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ category: Category.Team, title: "Is the building a home/domestic building?", tooltip: "Note: Homes used as offices for working from home should be classified as domestic.", - example: "mixed domestic/non-domestic" + example: "mixed domestic/non-domestic", + items: [ + "Yes", + "No", + "Mixed domestic/non-domestic" + ] }, is_domestic_source: { category: Category.Team, title: "Source type", - tooltip: "", - example: "" + tooltip: "Source of domestic/non-domestic data", + example: "", + items: [ + "Expert knowledge", + "Observed from the street", + "Google or other photograph/satellite imagery", + "Government/public record/database", + "Independently managed record/database", + "Other type of record/database" + ] + }, + is_domestic_links: { + category: Category.Team, + title: "Source links", + tooltip: "URL(s) for domestic/non-domestic data source(s)", + example: ["", "", ""], }, likes_total: { category: Category.Community, @@ -705,7 +766,8 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ { year_constructed: { min: 1989, max: 1991 }, year_demolished: { min: 1993, max: 1994 }, - lifespan: "2-5", overlap_present: "50%", links: ["", ""]} + lifespan: "2-5", overlap_present: "50%", links: ["", ""] + } ] }, has_extension: { @@ -850,4 +912,4 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ }, }; -export const allFieldsConfig = {...dataFields, ...buildingUserFields}; \ No newline at end of file +export const allFieldsConfig = { ...dataFields, ...buildingUserFields }; \ No newline at end of file diff --git a/maintenance/extract_data/README.md b/maintenance/extract_data/README.md index a405dc1f..c2e4100e 100644 --- a/maintenance/extract_data/README.md +++ b/maintenance/extract_data/README.md @@ -39,8 +39,12 @@ This is the main table, containing almost all data collected by Colouring London - `location_line_two`: additional address line - `location_town`: town - `location_postcode`: postcode +- `location_address_source`: type of source used for address data +- `location_address_links`: link to source used for address data - `location_latitude`: latitude - `location_longitude`: longitude +- `location_coordinates_source`: source type of coordinate data +- `location_coordinates_links`: source links for coordinate data - `current_landuse_group`: current land use group - `current_landuse_order`: current land use order - `building_attachment_form`: building attachment form @@ -85,6 +89,9 @@ This is the main table, containing almost all data collected by Colouring London - `planning_local_list_url`: local list reference link - `planning_historic_area_assessment_url`: historic area assessment reference link - `likes_total`: number of times the building has been liked by Colouring London users +- `is_domestic`: is the building domestic/non-domestic/mixed +- `is_domestic_source`: domestic data source type, + -`is_domestic_links`: domestic data source links, ## Building UPRNs diff --git a/maintenance/extract_data/export_attributes.sql b/maintenance/extract_data/export_attributes.sql index e348fc37..370b2f8e 100644 --- a/maintenance/extract_data/export_attributes.sql +++ b/maintenance/extract_data/export_attributes.sql @@ -9,6 +9,8 @@ COPY (SELECT location_line_two, location_town, location_postcode, + location_address_source, + location_address_links, location_latitude, location_longitude, current_landuse_group, @@ -55,6 +57,8 @@ COPY (SELECT planning_local_list_url, planning_historic_area_assessment_url, is_domestic, + is_domestic_source, + is_domestic_links, community_type_worth_keeping_total, likes_total, survival_status, diff --git a/migrations/040.ui_revamp_sources.down.sql b/migrations/040.ui_revamp_sources.down.sql new file mode 100644 index 00000000..6fa76932 --- /dev/null +++ b/migrations/040.ui_revamp_sources.down.sql @@ -0,0 +1,6 @@ +ALTER TABLE buildings DROP COLUMN IF EXISTS location_address_source; +ALTER TABLE buildings DROP COLUMN IF EXISTS location_address_links; +ALTER TABLE buildings DROP COLUMN IF EXISTS location_coordinates_source; +ALTER TABLE buildings DROP COLUMN IF EXISTS location_coordinates_links; +ALTER TABLE buildings DROP COLUMN IF EXISTS is_domestic_source; +ALTER TABLE buildings DROP COLUMN IF EXISTS is_domestic_links; \ No newline at end of file diff --git a/migrations/040.ui_revamp_sources.up.sql b/migrations/040.ui_revamp_sources.up.sql new file mode 100644 index 00000000..7a08b6fd --- /dev/null +++ b/migrations/040.ui_revamp_sources.up.sql @@ -0,0 +1,6 @@ +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS location_address_source text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS location_address_links text[]; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS location_coordinates_source text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS location_coordinates_links text[]; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS is_domestic_source text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS is_domestic_links text[]; \ No newline at end of file