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
This commit is contained in:
dominic 2020-01-23 11:20:56 +00:00 committed by GitHub
parent cb063b7fe4
commit ab3c4f68df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
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