Upload a tender's BOQ and contractors' bids, get them read into one canonical table, compare them like-for-like, edit anything with a full audit trail, and ask questions or run reusable Playbooks.
- Upload – files go straight from the browser to Supabase Storage (no function size limit).
- Read – every Excel sheet / PDF / Word / CSV is read part by part (
/api/documents/:id/processruns one step per call). Pictures are pulled out of the file and stored in the publictender-imagesbucket. - Fill, convert, check – missing amounts/rates/quantities are calculated and tagged as autofill (with the formula), units are converted to the BOQ's unit, and unrealistic values are flagged.
- Review – nothing is "ready" until a person confirms it. Every filled/converted/flagged cell is highlighted.
- Edit – every cell is editable; formulas (
quantity * rate,[1.2].amount, …) can be applied to a row, section or the whole document, with an overlay showing rows whose existing values don't follow the formula. All changes are logged and undoable. Revised bids become new versions; old versions stay viewable. - Compare & ask – comparative statement is plain code (no AI). Reports / Playbooks use Groq on a compact facts pack.
- Export – Excel, PDF and CSV for requirements, each bid, the comparison, every report and a full tender pack.
cd app
cp .env.example .env.local # fill in Supabase + Groq
npm install
npm run dev # http://localhost:3000Database: apply app/supabase/migrations/*.sql (the base tables follow docs/design/01-canonical-schema.md).
Scripts: npx tsx scripts/test-calc.ts (formula/autofill/unit tests), npx tsx scripts/test-match.ts (matcher tests).
src/lib/formula.tssafe formula engine ·calc.tsautofill / conversion / plausibility / reviewsrc/lib/docOps.tsedits, formulas, undo, versions ·extract/pipeline.tsstepwise ingestion ·match.tsBOQ matchingsrc/lib/export/*Excel + PDF ·src/lib/analysis/*facts pack + Groq analysessrc/components/BoqGrid.tsxthe editable table ·src/app/tenders/[id]/*pages
The AI reads each sheet, but it is never the last word on a number:
- Upload-time audit (no AI). While the workbook is opened, every formula is re-checked against its own saved result with a small, deliberately narrow evaluator (
+ − × ÷, brackets,%, same-sheet cells,SUM(range)). The result is stored per sheet indocument_sheets.source_auditand turned into review issues:formula_mismatch(saved result ≠ recalculation, both numbers shown),excel_error(#VALUE!,#REF!…),formula_not_calculated(saved without a result) andformula_unverified(uses another function/sheet/workbook, so it cannot be re-checked). Nothing is silently "fixed". - Source check of every extracted number. After extraction, each quantity, rate and amount is compared with the numbers printed in the sheet row it came from (
source_row). A value that matches a cell (or is the product/quotient of two that do) is confirmed. A value that matches nothing is replaced by the sheet's own number when its column is unambiguous (the row is marked as corrected, with the cell address), otherwise it is flaggednot_in_source. - Blank names are restored from the sheet, not guessed.
- No auto-confirm over errors. A document cannot be confirmed while an error-level issue (unread sheet, formula mismatch, Excel error) is unacknowledged.
- Prompt hardening. Cell text is treated as untrusted data; instructions inside cells are ignored.
The raw rendered text of every sheet is kept in document_sheets.rendered_text, so what the file actually said can always be compared with what was stored. Manual edits stay in the edit history and never overwrite that text.
Check any workbook locally without the AI: npx tsx scripts/audit-file.ts path/to/file.xlsx.