jeudi 24 décembre 2020

Database schema and OOP model for sensors

Is there any design pattern for sensors? I'd like do collect data from various sensors. Some of them only measure temperature, others can measure temperature, humidity etc. I'm thinking about making a Sensor class which will contain 'name', 'description', 'location' (everything common for all sensors) and a collection of measurements. Data from this class will be stored in database in 'Sensor' table. This table will have so many rows as number of sensors. Column 'measurements' should point to next table with measurements. Every sensor will have its own table with measurements.

I'm not sure there aren't any "bad ideas" in my approach.

I'd like to use php, mysql and doctrine.

I would like to know if my approach is correct before I start writing the code. Maybe there is a better way?

Aucun commentaire:

Enregistrer un commentaire