feat: Add LaTeX template-based form filling for G2210-11

Replace unreliable visual overlay mode with precise LaTeX templates:

- Add LaTeX template for G2210-11 (Ärztlicher Befundbericht der WAG)
- Create Python Flask backend for LaTeX compilation (latex_service.py, server.py)
- Add frontend latexService.ts for API communication
- Update ReviewPanel with LaTeX mode toggle and preview
- Enhance Gemini prompts with G2210-11 specific field extraction
- Add Dockerfile with TeX Live for Railway deployment
- Update railway.toml to use Docker builder

The LaTeX approach ensures accurate field placement and proper
formatting for German medical/insurance forms.

https://claude.ai/code/session_016pQhdznHZ74Fpkvwr3cLBq
This commit is contained in:
Claude 2026-01-29 18:29:22 +00:00
parent adf8f0240e
commit 19e96ef59b
No known key found for this signature in database
10 changed files with 1557 additions and 32 deletions

67
Dockerfile Normal file
View file

@ -0,0 +1,67 @@
# Multi-stage Dockerfile for AutoForm AI with LaTeX support
# Stage 1: Build Frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source files
COPY . .
# Build the frontend
RUN npm run build
# Stage 2: Production image with Python and LaTeX
FROM python:3.11-slim
# Install TeX Live (minimal installation for form generation)
RUN apt-get update && apt-get install -y --no-install-recommends \
texlive-latex-base \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-lang-german \
texlive-plain-generic \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy Python requirements and install
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Install serve for static file serving
RUN npm install -g serve
# Copy the built frontend
COPY --from=frontend-builder /app/dist ./dist
# Copy Python backend and LaTeX templates
COPY latex_service.py ./
COPY server.py ./
COPY templates ./templates
# Create startup script
RUN echo '#!/bin/bash\n\
python server.py &\n\
serve dist -l ${PORT:-3000}\n\
' > /app/start.sh && chmod +x /app/start.sh
# Expose ports
EXPOSE 3000 5000
# Environment variables
ENV PORT=3000
ENV FLASK_DEBUG=false
ENV VITE_LATEX_API_URL=http://localhost:5000
# Start both services
CMD ["/app/start.sh"]