Centralize data validation in the Data model
Closed this issue · 1 comments
math-a3k commented
Currently there are the same validations done in the DataInputForm and the DataInputSerializer regarding percentage fields.
To avoid this duplication - which may pose a future problem - these should be done at a Model level.
The idea is define a 'main' field - those in Data.HEMOGRAM_FIELDS
- and record also fields expressing the same of the 'main' field but in other unit, which will populate the 'main' accordingly. Perhaps Data.CONVERSION_FIELDS
?
This wouldn't be a problem for the classifier, as for django_ai you have to select which fields to use in DataColumns; but the CSV output, table output, data detail and REST API output would need to be adjusted to not show Data.CONVERSION_FIELDS