From ab3c4f68df5f838e2272d0ae2a1c19940986fff1 Mon Sep 17 00:00:00 2001 From: dominic Date: Thu, 23 Jan 2020 11:20:56 +0000 Subject: [PATCH] Testing and addition db changes - Added paragraph on testing for review - Suggest that for future attributes we add `source` and `verification` to the db on setup --- docs/adding-new-fields.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/adding-new-fields.md b/docs/adding-new-fields.md index 1995ad59..f487ad7d 100644 --- a/docs/adding-new-fields.md +++ b/docs/adding-new-fields.md @@ -1,13 +1,22 @@ ## Adding new building attribute fields -This document is a checklist for adding a new building attribute to the system. It's split into two sections - actions that apply when adding any field, and additional steps to add a field that will be visualised on the map. +This document is a checklist for adding a new building attribute to the system. It's split into three sections - actions that apply when adding any field, and additional steps to add a field that will be visualised on the map. The second section would be required when adding a new category or when changing which field should be visualised for a category. +The third section would appply to any data which can be ammended via the API. +When adding a new attribute a set of seed data should be identified, the base data set formany fields is Polly Hudsons PhD data set. This data set is required to; +- Test visualisation elements (map styling) +- Provide some data for users to relate to and encourage them to fill in the field +- Test the API and database elements. + ### Adding any attribute #### In database 1. Add a column to the `buildings` table in the database. 2. Add any check constraints or foreign key constraints on the column, if necessary (if the foreign key constraint is used to restrict the column to a set of values, the table with the values might need to be created from scratch) +3. If a source is being collected for field. Add a column `fieldName_source` to the `sources` table. +4. If verfication is being enabled. Add a column `bieldName_verifications` to the `verfication` table. + #### In API 1. Add field name to `BUILDING_FIELD_WHITELIST` in the building service to allow saving changes to the field @@ -32,4 +41,12 @@ All steps from the previous section need to be carried out first. #### In frontend 1. Update the category to field name mapping in the `tilesetByCat` object inside the `ColouringMap` React component (`map.tsx` file) -2. Add an entry for the field to the `LEGEND_CONFIG` object in `legend.tsx` file \ No newline at end of file +2. Add an entry for the field to the `LEGEND_CONFIG` object in `legend.tsx` file + + +### Testing + +Run tests on staging to confirm; +- Database changes accepted +- API is working and data is getting posted to the database +- Map styling is applied and style is appropriate way to visualise the data