Case study · Agritech
A farm plan where every number shows its source.
Piano Agricolo (Italian for farm plan) puts a whole agricultural venture in one place: what to grow, where, when, what it costs, what it might earn and which rules apply.

The problem
A new farm runs on estimates: yields from a course case study, planting windows from experience, prices from a few wholesale quotes. Spread across spreadsheets and notes, it becomes impossible to tell a measured number from a guess.
What was built
- Crop planning: pick a crop, an area in square metres and a start date, which must fall inside that crop's planting window.
- Projections: a cumulative balance in pessimistic, base and optimistic scenarios, over 1, 3 and 6 months and 1, 2 and 3 years.
- A mushroom pricing model: cost per kilo from the substrate bale, shipping, energy and water for the cycle, yield and waste, then a minimum price at the target margin. A variety is flagged as not profitable when that price is above the best wholesale price found.
- Expenses, a task calendar and a regulations page, so the rules sit next to the numbers they constrain.
- A public pre-order catalogue, clearly marked as provisional until the health authorisations arrive.
- A generated brand kit: logo in SVG and PNG, social images, a business card and an A5 flyer with a QR code.
Method: treat data like a lab notebook
Every figure carries its source and date. Estimates from a course case study are labelled “to confirm”; proposed planting windows and task timelines are labelled “to verify”.
A missing value is stored as null, never as zero, and the interface shows it as missing. Zero is a measurement; null is an honest gap. Mixing them up is how a plan starts lying.
The business rules for adding a crop are written twice, once as a Postgres function and once in TypeScript, and the tests run both against the same cases. If they ever disagree, the build fails.
Access and safety
Two roles: an admin who can change things, and read-only access for a partner, an agricultural advisory centre or a consultant. Every write goes through a Postgres function that checks the role, and row-level security only ever allows reads. The app also runs in an in-memory demo mode with exactly the same rules.