Major Upgrade: decoupling devices and sensors - geocryology/sensorDb Wiki

We need to handle cases where the device is moved to a different sensor (either because the sensors die, or for convenience instead of changing batteries in the field)

Stephan's Solution

Treat each devices.id as a unique combination of device + sensor. Create a new devices entry whenever the device + sensor combination is changed, and "move" the old device (with identical devices.serial_number) to a new location ("device nirvana") with record_observations=FALSE.

Database changes

PermafrostDB (R-package) changes

Behavioural Changes

SensorDB Changes

Microservices (PermafrostNet) changes

Link table Solution

Add a new table (devices_sensors) that links the devices and sensors tables with a timestamp, similar to the behaviour of devices_locations

Database changes

name type
id UUID
timestamp TIMESTAMP(6) WITH TIME ZONE
device_id UUID
sensor_id UUID
notes text

PermafrostDB (R-package) changes

Behavioural Changes

SensorDB Changes

Microservices (PermafrostNet) changes