Quick overview
This workflow collects a construction claim via an n8n form, validates an uploaded PDF and schedule CSV, computes schedule variances for a specific activity, retrieves reference passages (plus a Wikipedia glossary), and uses Google Gemini to generate a structured JSON assessment for download (optionally also sent to Telegram).
How it works
- Receives a claim submission through an n8n Form Trigger with project details, a claim PDF, an activity ID, and a schedule CSV.
- Validates the form fields and file uploads, then parses the schedule CSV for the given activity ID and calculates baseline-to-actual start and finish variance in calendar days.
- Extracts selectable text from the uploaded PDF and prepares a structured evidence payload and JSON response schema for Google Gemini.
- Builds a small reference library (including a case-law entry and guidance passages), fetches a German terminology glossary from Wikipedia, and selects the most relevant passages to attach as context.
- Calls Google Gemini three times to produce specialist findings (contract/notice review, delay/causality analysis, and evidence review), then combines them into a single synthesis request.
- Calls Google Gemini again to generate the final structured assessment, validates the returned JSON and any bracketed source IDs against the retrieved sources, and flags failures for manual review.
- Packages the result as a downloadable JSON file via the form completion page and optionally sends the JSON document to a fixed Telegram chat.
Setup
- Add Google Gemini (PaLM) API credentials (googlePalmApi) for the four HTTP Request steps that call the Gemini generateContent endpoint.
- Prepare inputs that match the workflow’s expectations: a text-based PDF up to 10 MiB, a UTF-8 schedule CSV up to 1 MiB with headers activity_id, baseline_start, baseline_finish, actual_start, actual_finish, and ISO dates (YYYY-MM-DD).
- Update or replace the entries in the built-in reference library (especially any test/example passages) with approved project excerpts or verified legal references as needed.
- (Optional) Add a Telegram bot credential and set the target chat ID and delivery toggle so successful JSON reports can be sent as a Telegram document.