Leistungsverzeichnis (LV) Editor
Relevant source files
The following files were used as context for generating this wiki page:
The Leistungsverzeichnis (LV) Editor is a core module within the LV.AI platform that enables the creation, management, and export of construction service directories. It manages bill of quantities (BoQ) data according to GAEB DA XML standards, covering essential phases of the Ausschreibung, Vergabe, und Abrechnung (AVA) workflow in the D/A/CH region.
The system processes LV data through two primary channels: manual editing via the user interface and automated importing from GAEB or text-based files. The editor maintains data integrity by strictly adhering to specific numbering systems (Ordnungszahlen) and German construction industry compliance rules like VOB, ÖNORM, and SIA.
Sources: README.md:1-15, app/(chat)/lv/[projectId]/page.tsx:30-40
Core Architecture and Data Flow
The LV Editor follows a multi-tiered architecture utilizing Next.js Server Components for data fetching and Server Actions for data mutations. The system organizes data around the LvDocument and LvPosition entities, which are linked to a specific Bauprojekt.
The data flow ensures that any change in positions triggers a revalidation of the project path to maintain a real-time view of totals and GAEB compliance.
Sources: app/(chat)/lv/[projectId]/page.tsx:1-50, app/(chat)/lv/import-actions.ts:130-150
Document and Position Management
The system represents an LV through a hierarchy of documents and positions. Each position contains detailed metadata required for accurate bidding and accounting.
Data Model Fields
The database schema defines the structure for LV entities.
| Entity | Field | Type | Description |
|---|---|---|---|
| LvDocument | titel | String | Title of the service directory. |
gaebFormat | Enum | GAEB phase (X81 to X89). | |
version | String | Document versioning (e.g., "1.0"). | |
| LvPosition | oz | String | Ordnungszahl (e.g., "1.6.10"). |
kurztext | String | Short description of the service. | |
langtext | String | Full technical specification. | |
menge | Decimal | Quantitative requirement. | |
einheit | String | Unit of measure (m, m², m³, Stk). | |
einheitspreis | Decimal | Unit price in EUR/CHF. |
Sources: lib/db/schema.test.ts:40-110, app/(chat)/lv/import-actions.ts:100-125
Manual Editing and Calculation
The Editor interface allows users to add, edit, or delete positions via the PositionEditor component. The system automatically calculates the gesamtpreis (GP) for each position by multiplying menge and einheitspreis. It then aggregates these into a Gesamtsumme (total sum) for the entire document.
Sources: app/(chat)/lv/[projectId]/page.tsx:110-150, lib/lv/pdf.ts:150-165
LV Import System
The import module processes external files into the internal database format. It uses a unified parser capable of detecting both GAEB DA XML and tabular text extracts.
The importLvFileAction handles the following logic:
- Validation: Checks for a valid session and specific upload domains.
- Format Detection: Distinguishes between GAEB XML and unstructured text extracts.
- Normalization: Fixes common errors in Ordnungszahlen, such as "double-dots" (5..40 converted to 5.40).
- Resilience: Skips invalid positions while collecting warnings for user feedback.
Sources: app/(chat)/lv/import-actions.ts:50-140, lib/gaeb/text-parser.ts:20-50
Output and Export
The LV Editor supports professional output formats required for formal bidding processes.
PDF Generation
The system generates DIN A4 compliant PDF documents server-side using pdf-lib. The generator produces a cover sheet and a professional position table.
- Layout: Uses standard margins (20mm) and specific column widths for OZ, Text, Menge, Unit, EP, and GP.
- Compliance: Includes footers with GAEB DA XML versioning and page numbering on every page.
- Formatting: Implements German localized currency and number formatting (e.g., "1.250,00 €").
Sources: lib/lv/pdf.ts:15-100, lib/lv/pdf.ts:210-240
GAEB Export
The module provides a dedicated route for GAEB DA XML export, primarily supporting phases:
- X83: Service Directory (Ausschreibungsverzeichnis)
- X84: Bid Submission (Angebotsabgabe)
The export route ensures the Content-Disposition header is set to attachment with a filename following GAEB naming conventions.
Sources: app/(chat)/lv/[projectId]/page.tsx:100-110, lib/db/schema.test.ts:45-55
Conclusion
The Leistungsverzeichnis (LV) Editor provides a robust framework for managing construction data in the D/A/CH region. By combining automated GAEB parsing with a manual editor and professional PDF generation, it bridges the gap between raw technical specifications and legally compliant bidding documents. Its modular design allows it to scale from simple cost estimates to complex GAEB-compliant tender processes.