geigercrowd / geigercrowd_on_rails

crowd-sourcing radiation sensor data
http://www.geigercrowd.net
19 stars 7 forks source link

output conversion logic #7

Open ruebezahl opened 13 years ago

ruebezahl commented 13 years ago

we will need to have some kind of conversion for the different input-datatypes (millisievert, microsievert, rem, etc). on each export request all data needs to be converted to the desired output format

wikipedia has the formulas

ruebezahl commented 13 years ago

@rausch| we could add all possible units in the associated dropdown in the instruments form and map them internally to the one we will save and show

ruebezahl commented 13 years ago

alternative: storing data in a default-unit datatype and converting to it when submitting new data

problem: what about unknown/unconfigured input data units/types?

tsujigiri commented 13 years ago

I would say we won't allow them as they are of no use.

Regarding the dimension of a value, we can parse the input before we save it as float, render an appended 'm', 'u', or 'n' to the respective dimension and multiply it with the value.

E.g.: 1.234u => 1.234e-6

tsujigiri commented 13 years ago

As we save data types in a model, we need some kind of conversion management. Something like a many-to-many association model (say, Formula) with DataType on both ends.

Further we have to think about how to handle the conversion logic from a user's perspective.