Data model
Every API key / app token belongs to exactly ONE farm (workspace) — all data returned is already scoped to it. Every identifier is a UUID.
| Concept | ID | Service | Links to |
|---|---|---|---|
| Farm (workspace) | workspace_id | gis | Everything below |
| Zone | zone_id | gis | Farm; contains parcels, devices |
| Parcel | parcel_id | gis | Zone, owner household, crop type, seasons |
| Farmer household | farmer_id | gis | Parcels (owner) |
| Crop type | crop_type_id | gis | Parcels, seasons, harvest records |
| Season | season_id | gis | Parcel; harvest records, QR labels |
| Device / controller | device_id | iot | Zone, parcels; readings, alerts, commands |
| Sensor alert | alert_id | iot | Device; event iot.alert.raised |
| Harvest record | harvest_record_id | harvest | Parcel, crop type, season; traceability lot |
| Traceability lot / QR label | id · code | harvest | Harvest record; public scan page |
| Certificate | id | harvest | Farm; VietGAP, GlobalGAP, organic |
| Book / table / row | app_id · table_id · record_id | office | The farm's custom books; values keyed by field_id |
| Report | code (SX-01…) | report | Reads from the services above |