# Budget module PRD from Google Drive source files

Use this reference when the user asks for Finance System budget-module requirements based on Drive-held PRDs, CSV samples, and spreadsheet budget tools, especially before implementation.

## Safety boundaries

- Treat budget workbooks/CSVs as private financial data.
- Read source files only temporarily; do not copy real XLS/XLSX/CSV/PDF/DOCX into Git.
- Do not mutate the runtime DB for PRD/analysis tasks.
- Do not print real amounts, raw rows, account IDs, transaction IDs, or secrets in chat.
- Report structure, field names, source types, aggregate counts, quality flags, and modeling implications only.
- Clean temporary downloaded files after upload/verification.

## Recommended workflow

1. Load `finance-system-architecture` and `google-workspace`.
2. Locate the Google Drive folder(s), usually `Finanzen` and optionally a subfolder such as `03 Budget`.
3. List source files and classify file types: Google Docs, XLS/XLSX, CSV, PDFs or other notes.
4. Export/read the existing PRD and extract headings/coverage.
5. Download source files into a temp directory only.
6. Structurally inspect CSVs:
   - encoding
   - delimiter
   - header row
   - column names
   - inferred column types
   - row count excluding header
7. Structurally inspect workbooks:
   - sheet names, masked if sensitive
   - dimensions
   - label/header samples with numbers/dates/amounts redacted
   - formula-cell counts
   - category block names and planning patterns
8. Draft the final PRD as Markdown locally in `/tmp` or another temp path.
9. Upload the Markdown to the Drive target folder.
10. Create a Google Doc from the Markdown in the same Drive target folder.
11. Verify both Drive artifacts by ID/name/mime type.
12. Check repo status to confirm no code/repo changes if the task was document-only.
13. Delete temp source/download/generated files.

## Structural patterns observed for the budget module

### Excel/XLS budget tool

- Historically grown family/household budget with annual/versioned sheets.
- Columns for item number, description, monthly plan, yearly plan, amount, date, and effective expenses from a date.
- Category blocks such as insurance, living, housing, communication, mobility, health, children/family, household, food/shopping, leisure, and miscellaneous.
- Fix-cost/subscription-like rows and recurring obligations.
- Formulas for aggregation, annual/monthly conversion, and budget-vs-actual comparisons.
- Possible legacy/reference errors; model the target system as a ledger/review workflow, not a 1:1 spreadsheet clone.

### VISA CSV

Typical columns:

- `TransactionId`
- `CardId`
- `Date`
- `ValutaDate`
- `Amount`
- `Currency`
- `OriginalAmount`
- `OriginalCurrency`
- `MerchantName`
- `MerchantPlace`
- `MerchantCountry`
- `StateType`
- `Details`
- `Type`
- `Exchange Rate`

Modeling implications:

- Use `TransactionId` and `CardId` for stable dedupe.
- Preserve original and booked currency/amount plus source FX rate.
- Handle reservations/final bookings, refunds, fees, and foreign-currency transactions as first-class status/type variants.
- Merchant fields feed merchant normalization and deterministic rules.

### Migros/Cumulus CSV

Typical columns:

- `Datum`
- `Zeit`
- `Filiale`
- `Kassennummer`
- `Transaktionsnummer`
- `Artikel`
- `Menge`
- `Aktion`
- `Umsatz`

Modeling implications:

- Treat data as receipt/article-line source, not merely one merchant transaction row.
- Build a transaction header per receipt and store article lines separately.
- Derive splits only after plausibility checks and/or manual review.
- Dedupe using date, time, store, register number, transaction number, line count and sum plausibility.

## PRD sections to include

A final Budget Module PRD should cover:

- goals and non-goals
- account model
- transaction model
- split transactions
- categories/tags
- import engine
- VISA CSV import
- Migros/Cumulus import
- rule engine
- duplicate detection
- budget planning
- fixed costs/subscriptions
- analytics
- Vue dashboard UX
- API endpoints
- data model
- phased plan
- acceptance criteria
- safety/security rules
- integration with existing portfolio/crypto/cash system

## Reporting checklist

End with a compact status report:

- files analyzed: yes/no
- recognized file types
- recognized budget structures
- PRD created: yes/no and Drive location
- Google Doc saved: yes/no
- Markdown saved: yes/no
- no real values/secrets exposed: confirmed
- no repo changes if only Drive documents were requested
- runtime DB changed: no, unless explicitly authorized
