New task was created
Community Portal
Develop standard unit conversion for datasets
Created on Saturday 9 October 2021, 14:37
Back to task list-
ID1004818
-
ProjectMetabolism of Cities Data Hub
-
StatusOpen
-
PriorityMedium
-
TypeProgramming work
-
TagsData Hub Priority Plan 2021 General data hub improvements
-
Assigned toNo one yet
-
SubscribersPaul Hoekman
Description
Currently, there is a UNIT field for every data point. This is recorded at that very same level - in the table with the actual data points. However, when you visualize or otherwise view a dataset, it would be helpful to view data in a certain unit. But in order to do that, we need to ensure that all the datapoints are converted into the same unit. Often, all datapoints in the same dataset will have the same unit, but we can't be sure of that. Also, you might want to visualize data from multiple datasets and thus need to settle on a single unit.
What needs to be done for this:
- UNIT field needs to be added to the DataViz table
- When configuring a data visualization, the user must be asked which unit they want to use. By default, it should simply get a single datapoint and present that unit as the selected option (which is oftentimes the only unit used, anyways).
- A query needs to run that checks the units of all datapoints in the visualization. If the units are of different types (e.g. mass and length) then an error should appear indicating that conversion is not possible and this can not be presented in a single visualization.
- There is this conversion table, which should be used as the basis for the conversion. Also, the only other units that are presented to the user as options to choose from should be those within the same group (e.g. if it's mass, it can show g/kg/t/kt etc).
- When visualizing the data, the multiplication_factor field in the Unit table should be used. This is ideally done at the SQL level, where the values are multiplied when retrieving the data (SELECT unit.multiplication_factordata.quantitychosen_unit.multiplication_factor -- something like that).