Apps: - dwg-rooms: extract room numbers from DWG/DXF - dwg-counting: count symbols in PDF drawings (OpenCV template matching) - contract-check: review PDF contracts against a checklist (Claude vision + Tesseract OCR fallback) - email-drafter: bullet notes → polished Czech/English business emails - invoice-extractor: PDF/image invoice → structured data → Excel - translator: Czech-first translator across 19 languages with tone control - vv-check: find inconsistent unit prices across VV sheets in one workbook - vv-compare: diff original vs new VV files (changes / added / removed) - feature-request: portal users submit ideas + sample files Infrastructure: - LiteLLM gateway with per-app virtual keys + budgets - Langfuse observability - Geist font, shared theme, cross-subdomain back link + theme sync via cookie/URL - Caddy reverse proxy on *.klas.chat
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
"""Export room list to a styled Excel workbook."""
|
|
from openpyxl import Workbook
|
|
from openpyxl.styles import Alignment, Border, Font, PatternFill, Side
|
|
from openpyxl.utils import get_column_letter
|
|
|
|
|
|
def export_to_excel(rooms: list[dict], output_path: str) -> None:
|
|
wb = Workbook()
|
|
ws = wb.active
|
|
ws.title = "Místnosti"
|
|
|
|
hdr_fill = PatternFill("solid", fgColor="155AEF")
|
|
hdr_font = Font(bold=True, color="FFFFFF", size=10)
|
|
hdr_align = Alignment(horizontal="center", vertical="center")
|
|
row_border = Border(
|
|
bottom=Side(style="thin", color="D0D5DC"),
|
|
right=Side(style="thin", color="D0D5DC"),
|
|
)
|
|
alt_fill = PatternFill("solid", fgColor="F9FAFB")
|
|
|
|
headers = ["Č. místnosti", "Popis / účel", "Zdroj", "Spolehlivost"]
|
|
widths = [16, 52, 14, 16]
|
|
|
|
for col, (hdr, w) in enumerate(zip(headers, widths), 1):
|
|
c = ws.cell(row=1, column=col, value=hdr)
|
|
c.font = hdr_font
|
|
c.fill = hdr_fill
|
|
c.alignment = hdr_align
|
|
ws.column_dimensions[get_column_letter(col)].width = w
|
|
|
|
ws.row_dimensions[1].height = 22
|
|
ws.freeze_panes = "A2"
|
|
|
|
for row_num, room in enumerate(sorted(rooms, key=lambda r: str(r.get("room", ""))), 2):
|
|
values = [
|
|
room.get("room", ""),
|
|
room.get("description", ""),
|
|
"Pravidla" if room.get("source") == "rule" else "AI",
|
|
f"{room.get('confidence', 1.0) * 100:.0f} %",
|
|
]
|
|
for col, val in enumerate(values, 1):
|
|
c = ws.cell(row=row_num, column=col, value=val)
|
|
c.alignment = Alignment(vertical="center")
|
|
c.border = row_border
|
|
if row_num % 2 == 0:
|
|
c.fill = alt_fill
|
|
|
|
wb.save(output_path)
|