math-a3k / covid-ht

covid-ht aims to provide a tool for implementing an AI layer on clinical classification effectively in order to improve detection, information availability and resource efficiency in medical environments.
https://covid-ht.herokuapp.com/
GNU Lesser General Public License v3.0
2 stars 3 forks source link

Centralize data validation in the Data model #8

Closed math-a3k closed 3 years ago

math-a3k commented 3 years ago

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

math-a3k commented 3 years ago

Implemented in 15eeb79d07818c5be857586f26f5152678daeb5f (this issue is related to #3 and some how #6)