Commit Graph

140 Commits

Author SHA1 Message Date
865195ad16 Feature: Save AI parsing notes with receipt
Store user-provided parsing notes in the database so they persist
across parsing attempts. Notes are displayed in Receipt Information
and pre-populated in the textarea for future parses.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 20:49:31 -05:00
c5fad34658 Feature: Add Settings page with centralized AI model configuration
- Add Settings page for AI model selection with load status indicators
- Add ModelWarmupService to preload configured model on app startup
- Consolidate AI model config to single AI:ReceiptParsingModel setting
- Simplify ViewReceipt and AICategorizePreview to use Settings model
- Improve AI categorization confidence prompt for varied scores

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 18:06:02 -05:00
29d26b4771 Refactor: Consolidate AI endpoint config to AI:ModelsEndpoint
- Simplify model dropdown to single flat list with local models first
- Show loaded/unloaded status with bullet indicators
- Remove separate Ollama:BaseUrl and LlamaCpp:BaseUrl configs
- All AI vision clients now use AI:ModelsEndpoint (default: athena.lan:11434)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 23:41:05 -05:00
38b7d8a9ca Feature: Add dynamic model selection to ViewReceipt page
Enhance receipt parsing model selection:
- Fetch available models from LlamaCpp server dynamically
- Show loaded/unloaded status in model dropdown
- Persist selected model to appsettings.json
- Read default model from AI:ReceiptParsingModel config
- Inject LlamaCppVisionClient and IConfiguration dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:53:40 -05:00
fc4855bd1a Refactor: Use session-based TempData provider
Switch from cookie-based to session-based TempData to avoid
cookie size limits when storing AI categorization proposals.
Chain AddSessionStateTempDataProvider() to AddRazorPages().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:53:28 -05:00
9fbbeca1e6 Feature: Add AI-Powered Categorization section to Recategorize page
Add new card for AI categorization alongside rule-based:
- Rename existing section to "Rule-Based Categorization"
- Add "AI-Powered Categorization" section with provider badge
- Link to AICategorizePreview for AI category suggestions
- Display explanation of how AI categorization works
- Inject IConfiguration to read AI provider setting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:53:16 -05:00
f72c32c52f Feature: Add transaction multi-select for batch AI review
Add selection UI to Transactions page:
- Add checkbox column for selecting transactions
- Add sticky selection bar showing selected count
- Add Select All / Clear Selection controls
- Wire up form to send selected IDs to AICategorizePreview page
- Preserve row click navigation for unselected areas

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:53:05 -05:00
c43fe12124 Feature: Add LlamaCpp provider support to TransactionAICategorizer
Enhance AI categorization with multi-provider support:
- Add configurable AI:CategorizationProvider setting (OpenAI/LlamaCpp)
- Add CallLlamaCppAsync() for local LLM categorization
- Improve prompt with existing categories for consistency
- Include additional transaction context (card, account, transfer info)
- Fix batch processing to avoid DbContext concurrency issues
- Add model parameter to interface methods

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:52:54 -05:00
cba20f20fc Feature: Add LlamaCpp model discovery API
Add GetAvailableModelsAsync() to LlamaCppVisionClient that:
- Queries llama.cpp /v1/models endpoint for available models
- Filters out multimodal projector models (mmproj-*)
- Tracks loaded/unloaded status for each model
- Returns sorted list with loaded models first

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:52:41 -05:00
b5406106ec Feature: Add AICategorizePreview page for AI transaction categorization
Add new page that allows users to:
- Generate AI categorization suggestions for uncategorized transactions
- Review proposals with confidence levels before applying
- Select specific transactions from Transactions page for AI review
- Choose to create mapping rules for high-confidence matches
- Support both OpenAI and LlamaCpp providers with model selection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 22:52:30 -05:00
954af2f952 Chore: Rename docker-build-and-push.cmd to docker-publish.cmd
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 16:54:38 -05:00
541bbf01af Refactor: Simplify receipt storage path handling
Store only filename in database instead of full relative path.
GetReceiptPhysicalPath now combines config base path with filename.
AIReceiptParser uses ReceiptManager for consistent path resolution.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 16:54:27 -05:00
de5ee33a77 Feature: Add ReviewReceipts page for receipt-to-transaction mapping
New page shows unmapped receipts with scored transaction candidates,
allowing manual mapping or bulk auto-map. Displays confidence scores
and match quality indicators. Also shows recently mapped receipts
for verification with unmap option.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 16:54:15 -05:00
f3b847cc68 Feature: Enhanced receipt auto-mapping with weighted scoring
Replace simple matching with weighted scoring algorithm (40% amount,
25% date, 35% merchant, 10% due date). Uses confidence thresholds:
- 85%+ auto-maps immediately
- 50-85% uses LLM to decide
- Below 50% returns candidates for manual review

Transactions can no longer match before receipt date since receipts
are issued at time of purchase.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 16:54:03 -05:00
dc56021a77 Feature: Add local LLM vision clients (llama.cpp and Ollama)
Add LlamaCppVisionClient and OllamaVisionClient for local AI inference
as alternatives to OpenAI and Claude. Includes text-only prompt support
for LLM-assisted receipt matching.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 16:53:51 -05:00
2c74e5e403 Docs: Document Financial Audit API in ARCHITECTURE.md
Add documentation for:
- FinancialAuditService responsibilities and methods
- Audit flag types and severities
- /api/audit endpoint with query parameters and response
- Version bump to 1.4 with recent changes section

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:08:19 -05:00
3ce91f4c07 Feature: Add Financial Audit API for AI analysis
Add /api/audit endpoint providing comprehensive financial data:
- Summary stats (income, expenses, net, daily average)
- Budget statuses with period info
- Category spending with budget correlation
- Top 20 merchants by spending
- Monthly trends with top categories
- Per-account summaries
- AI-friendly flags (over-budget, spending increases, etc.)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 20:07:29 -05:00
a3ca358e9a UI: Use dark text on yellow budget progress bars
Improves readability of percentage text when progress bar
is in warning state (80-99% of budget used).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 22:59:00 -05:00
3184545270 Fix: Add required attribute to pattern fields in CategoryMappings
Prevents form submission with empty pattern, keeping modal open
for validation instead of closing and showing error after redirect.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 22:24:17 -05:00
33a664a3e1 Feature: Add budget tracking with period-based spending limits
- Budget model with Weekly/Monthly/Yearly periods
- BudgetService for CRUD and spending calculations
- New /Budgets page for managing budgets
- Dashboard integration with progress bars
- Support for category-specific or total spending budgets
- Period boundaries calculated from budget start date

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-10 22:24:01 -05:00
f5cfd982cd UI: Replace cash flow bar chart with running balance line
- Add RunningBalance to SpendTrends model
- Calculate cumulative balance over 30 days
- Display as smooth filled line chart (neutral blue)
- Cleaner date labels (MMM d format)
- Better tooltip formatting with $ values

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-05 22:05:09 -05:00
55e758a42a UI: Add dark theme using Bootstrap 5 dark mode
- Enable data-bs-theme="dark" on html element
- Update navbar to dark variant
- Replace text-dark links with text-body (theme-aware)
- Replace bg-white/bg-light with bg-body/bg-body-secondary
- Update sticky table headers to dark theme
- Fix Chart.js legend and axis colors for dark backgrounds
- Adjust focus ring color for better visibility on dark

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-05 21:51:23 -05:00
65601c1fcb Chore: Improve Docker deployment configuration
- Use environment variables in docker-compose for secrets/paths
- Add .env.example template for required variables
- Add .env to .gitignore to prevent secret exposure
- Add docker-build-and-push.cmd helper script

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-05 21:33:17 -05:00
a5435b1549 Config: Set default culture to en-US for currency formatting
Ensures consistent $ currency display regardless of server locale

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-05 21:33:11 -05:00
7b0853b74c Feature: Add pagination to Receipts page
- Add PageNumber and PageSize query parameters (default 25 per page)
- Implement server-side pagination with Skip/Take
- Display "Showing X-Y of Z" count in header
- Add Bootstrap pagination controls with sliding page window

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-05 21:33:05 -05:00
101a340d8c Chore: Add Docker containerization support
- Add Dockerfile with multi-stage build for .NET 8
- Include ImageMagick dependencies for Magick.NET
- Add docker-compose.yml with volume mount for receipts
- Add .dockerignore to exclude build artifacts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 22:01:03 -05:00
3a817e0f3f UI: Convert receipt upload panel to modal dialog
Move the upload form from a card panel at the top of the page
to a modal triggered by an "Upload Receipt" button in the header.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 22:00:55 -05:00
36a044da4f Feature: Add category pie chart and case-insensitive search
- Add doughnut chart showing spending by category
- Fix search to use EF.Functions.Like for explicit case-insensitivity
- Include Chart.js CDN for chart rendering

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:12:13 -05:00
f42d5e87f9 Config: Update Program.cs with new service registrations
- Add AddMemoryCache() for TransactionCategorizer caching
- Register IPdfToImageConverter
- Register OpenAIVisionClient and ClaudeVisionClient with HttpClient
- Update AIReceiptParser registration to use scoped instead of HttpClient

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:12:04 -05:00
9f64c7784a Refactor: Extract AI vision clients from AIReceiptParser
Extract for better separation of concerns:
- Services/PdfToImageConverter.cs - PDF to image conversion using ImageMagick
- Services/AIVisionClient.cs - OpenAI and Claude vision API clients
  - IAIVisionClient interface
  - OpenAIVisionClient, ClaudeVisionClient implementations

AIReceiptParser now orchestrates using injected services.
Adds proper logging for auto-mapping operations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:11:56 -05:00
ea7b2c2a3c Refactor: Extract dashboard services from Index page
Extract to separate files for better maintainability:
- Models/Dashboard/DashboardModels.cs - Dashboard DTOs
- Services/DashboardService.cs - All dashboard-related services
  - IDashboardService, IDashboardStatsCalculator
  - ITopCategoriesProvider, IRecentTransactionsProvider
  - ISpendTrendsProvider

Reduces Index.cshtml.cs from 355 lines to 37 lines.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:11:48 -05:00
2ceb3a7b57 Refactor: Extract import services from Upload page
Extract to separate files for better maintainability:
- Models/Import/ImportContext.cs - Import context and PaymentSelectMode enum
- Models/Import/ImportResults.cs - Import result DTOs and TransactionKey
- Models/Import/PaymentResolutionResult.cs - Payment resolution DTO
- Services/TransactionImporter.cs - CSV import logic
- Services/CardResolver.cs - Payment method resolution

Reduces Upload.cshtml.cs from 615 lines to 216 lines.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:11:39 -05:00
a30e6ff089 Refactor: Extract CategoryMapping model and add caching
- Move CategoryMapping class to Models/CategoryMapping.cs
- Add IMemoryCache with 10-minute TTL for category mappings
- Add InvalidateMappingsCache() method for cache invalidation
- Reduces repeated DB queries during bulk categorization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:11:29 -05:00
625314d167 Refactor: Add structured error logging to TransactionAICategorizer
- Add ILogger for proper error logging
- Differentiate between HTTP, JSON parsing, and general errors
- Log errors with descriptive messages for debugging

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:11:21 -05:00
d9e883a9f3 Security: Add MIME type validation and logging to ReceiptManager
- Add magic bytes validation to prevent file extension spoofing
- Add ILogger for proper error logging in background parsing
- Log background parsing success/failure with receipt ID

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:11:13 -05:00
1de3920db4 Perf: Add composite database indexes for common queries
Add indexes for:
- (AccountId, Category) - account spending by category
- (AccountId, Date) - account transaction timelines
- (MerchantId, Date) - merchant spending trends
- (CardId, Date) - card activity analysis
- FileHashSha256 on Receipts - duplicate detection
- (TransactionId, ReceiptDate) on Receipts - receipt lookups

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:11:05 -05:00
53c674c6e0 Perf: Fix N+1 queries in entity services
- CardService.GetAllCardsWithStatsAsync: Use single query with Select projection
- AccountService.GetAccountDetailsAsync: Use single query with Select projection
- TransactionStatisticsService: Calculate stats at DB level, fix N+1 in GetCardStatsForAccountAsync

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 21:10:56 -05:00
AJ
a85de793d7 Feature: disable preview button until CSV file is selected
Added validation to prevent users from submitting the upload form without
selecting a file first. The preview button is now disabled by default and
only enables when a file is selected, improving user experience and
preventing empty form submissions.

Changes:
- Added IDs to file input and preview button
- Button starts in disabled state
- JavaScript listener enables button when file is selected
- Button disables again if file selection is cleared
2025-11-16 12:07:17 -05:00
AJ
e0638039d8 Feature: order upload transaction preview by date descending
Transaction previews on the upload page now display with newest transactions
first, making it easier to review recent imports at the top of the list.
2025-11-16 11:54:13 -05:00
AJ
51c2ce2965 Config: exclude receipts folder from compilation
Added wwwroot/receipts to compilation exclusions to prevent build warnings
and improve build performance. Receipt files are user-uploaded content and
should not be included in the build process.
2025-11-16 11:54:07 -05:00
AJ
0a15d09db4 Refactor: separate JavaScript from HTML into external files
Extracted all inline JavaScript from Razor pages into dedicated external
files for better code organization and browser caching:
- upload.js: transaction preview, pagination, form handling
- transactions.js: date range filters, Bootstrap tooltips
- edit-transaction.js: category/merchant dropdowns, copy functionality
- merchants.js: modal handling for merchant management
- category-mappings.js: modal handling for category rules

Updated all affected .cshtml files to reference external scripts instead
of inline script blocks. This improves maintainability, enables browser
caching, and provides better separation of concerns.
2025-11-16 11:54:00 -05:00
AJ
1c28d9cc88 Refactor: remove unnecessary using directives
Removed unused using statements from page models and test files:
- Removed unused Microsoft.EntityFrameworkCore and MoneyMap.Data imports
- Removed redundant Xunit usings (already declared as global)

Fixes CS8019 and CS8933 hidden diagnostics.
2025-11-16 11:53:50 -05:00
AJ
22c60602df Fix: make Receipt property nullable in ViewReceiptModel
Changed Receipt property from non-nullable (null!) to nullable (?) to properly
handle cases where receipt is not found. Fixes CS8601 null reference assignment
warning.
2025-11-16 11:53:42 -05:00
AJ
f9cf709206 Fix: remove unnecessary async from OnPostRejectProposalAsync methods
Removed async/await keywords from methods that don't perform any async
operations. The methods were triggering CS1998 warnings and running
synchronously despite being marked async.
2025-11-16 11:53:36 -05:00
AJ
ea14466f57 Fix: add null checks in AIReceiptParser to prevent null reference warnings
Added validation to ensure messageContent is not null or whitespace before
deserializing JSON responses from OpenAI and Claude vision APIs. This fixes
CS8604 warnings about possible null reference arguments.
2025-11-16 11:53:28 -05:00
AJ
56089cc437 Fix: improve EditTransaction form handling and validation
- Add hidden fields for immutable transaction properties to preserve values during form submission
- Make category field optional by removing validation for empty values
- Simplify category input handling by removing duplicate hidden field
- Clean up JavaScript by using proper element IDs instead of querySelector

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 01:59:50 -04:00
AJ
4bd89a0ab5 Config: add dotnet test permissions to Claude Code settings
Add auto-approve permissions for dotnet test, new, and add commands to support test-driven development workflow.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 00:01:41 -04:00
AJ
af4a638b81 Test: add comprehensive unit test project for services
Add MoneyMap.Tests project with xUnit tests for all new services:

- AccountServiceTests: Account retrieval, stats, validation, deletion
- CardServiceTests: Card retrieval, stats, validation, deletion
- MerchantServiceTests: Merchant CRUD operations
- ReferenceDataServiceTests: Reference data retrieval
- TransactionServiceTests: Duplicate detection, retrieval, deletion
- TransactionStatisticsServiceTests: Statistics calculations
- ReceiptMatchingServiceTests: Receipt-to-transaction matching logic
- DbContextHelper: In-memory database context factory for test isolation

Uses xUnit, Moq, and EF Core InMemory database. Solution file updated to include test project.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 00:01:28 -04:00
AJ
f8bb5d5a82 Feature: add ability to unmap receipts from transactions
Add unmap functionality to allow users to disassociate receipts from transactions without deleting them:

- ReceiptManager: Add UnmapReceiptAsync method
- Receipts page: Add OnPostUnmapAsync handler
- Receipts view: Add Unmap button for mapped receipts with confirmation dialog

This provides a non-destructive alternative to deleting receipts when they need to be remapped to different transactions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 00:01:11 -04:00
AJ
b4a91d8b7f Docs: update ARCHITECTURE.md with new services and reorganization
Document the expanded service layer architecture:

- Reorganize service layer diagram by functional groups (Core Transaction, Entity Management, Receipt, Reference & Dashboard)
- Add comprehensive documentation for AccountService, CardService, ReferenceDataService, and TransactionStatisticsService
- Update MerchantService documentation with new CRUD operations
- Document all DTOs and design patterns

Maintains architectural documentation consistency as the service layer continues to grow.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 23:08:42 -04:00