Refactor CSV transformation to be handled by schemas
As mentioned here: https://git.ufz.de/rdm-software/svm/backend/-/merge_requests/61#note_79699 we brainstormed about that it is useful to have the transformation of the data to be handled by the schemas (instead of having only the very custom function that tries to handle every kind of json payload).
The idea was to have something like this:
class DeviceSchema(Schema):
class Meta:
# as before
id = # ...
description = # ...
# ...
def transform_to_series(self, model):
return pandas.Series({
"id": model.id,
"description": model.description,
# ...
# Some more logic
# maybe individual columns per property with the label in its column name
"property_" + property_x.label + "_unit": property_x.unit_name,
# some more fields
})
Edited by Nils Brinckmann