Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Schema

Database schema

Rationale

This is a brief description and reason behind all the columns and data types.

LaundryLog

The log table. Uses composite primary key from pep_id and timestamp. Primary tracking table for all machines.

ColumnData TypePurpose
pep_idtextThe pep_id identifiy the machine in a location and position
timestampdatetimeThe time for when this line was entered in
time_remainingintHow many minutes left on the machine
not_available_reasontext nullableThe reason a machine is not available, will be null if available
door_closedboolIf the door is opened or closed
stateMachineStateWhat state the machine is in
settingsjsonThe settings for a current cycle

PhysicalEndpoint

A tracking table that combines location_id, room_id,machine_id, and sticker_number. The pep_id or physical endpoint is derived from 4 other columns. The initial byte slice comes from converting sticker to LE, the machine_id UUID to bytes, converting the room id string (hyphen included) to bytes then the location id UUID to bytes adding them in that order. Using this slice, then hashing using xxhash3 128-bit and base64 encoding it with url safe no padding. This implementation may differ across language which is a bug. See Cargo.toml for package versions. Table includes a added_on datetime column to be able to look up a machine only given 3 components of pep_id.

columnData TypePurpose
added_ondatetime2Maintain when the pep was added to the table
pep_idtextThe base64 encoded pep_id
machine_iduuidA FK to the machines table
location_iduuidA FK to the locations table
room_idtextA FK to the rooms table
sticker_numberintThe machines postional sticker number

Machines

Insight into all machine seen. Depends on API Producers machine_id to be a unique primary key.

ColumnData TypePurpose
machine_iduuidThe PK UUID returned from the API
qr_code_idtextThe qr code short code to the machine
nfc_idtextThe unique id given the nfc tag on the machine
controller_typetextThe controller controling the machine
typeMachineTypeWasher or dryer?
license_platevarchar(7)a license plate on the machine

Rooms

List of all tracked rooms. Depends on API Producer room_id to be a unique primary key.

ColumnData TypePurpose
room_idtextThe primary key from the API
descriptiontext nullableAn optional field describing the location
labeltextThe name of a location

Locations

A location has many Rooms. For helper functions and locale, each room also stores the timezone (timezone) it is in. Create constraint + function/procedure to check if valid timezone. Throw if not valid timezone. See pg_timezone_names or sys.time_zone_info. Has a label, description, and machine sum.

ColumnData TypePurpose
location_iduuidThe PK uuid from the API
descriptiontext nullableAn optional description
labeltextThe name of the location
timezonetextA convience field for converting times
2026-03-02 13:52:56 • commit: dd00d1f