docs: update CLAUDE.md indexes and README for OCR expansion (refs #137)

Add/update documentation across backend, Python OCR service, and frontend
for receipt scanning, manual extraction, and Gemini integration. Create
new CLAUDE.md files for engines/, fuel-logs/, documents/, and maintenance/
features.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eric Gullickson
2026-02-11 11:04:19 -06:00
parent 40df5e5b58
commit ab0d8463be
11 changed files with 385 additions and 45 deletions

View File

@@ -7,9 +7,9 @@
| `admin/` | Admin panel and catalog management | Admin UI, user management |
| `auth/` | Authentication pages and components | Login, logout, auth flows |
| `dashboard/` | Dashboard and fleet overview | Home page, summary widgets |
| `documents/` | Document management UI | File upload, document viewer |
| `fuel-logs/` | Fuel log tracking UI | Fuel entry forms, statistics |
| `maintenance/` | Maintenance record UI | Service tracking, reminders |
| `documents/` | Document management UI with maintenance manual extraction | File upload, document viewer, manual OCR extraction |
| `fuel-logs/` | Fuel log tracking UI with receipt OCR scanning | Fuel entry forms, receipt scanning, statistics |
| `maintenance/` | Maintenance record and schedule UI with OCR batch creation | Service tracking, extraction review, schedule management |
| `notifications/` | Notification display | Alert UI, notification center |
| `onboarding/` | Onboarding wizard | First-time user experience |
| `ownership-costs/` | Ownership cost tracking UI | Cost displays, expense forms |

View File

@@ -0,0 +1,49 @@
# documents/
Document management UI with maintenance manual extraction. Handles file uploads, document viewing, and PDF-based maintenance schedule extraction via Gemini.
## Subdirectories
| Directory | What | When to read |
| --------- | ---- | ------------ |
| `api/` | Document API endpoints | API integration |
| `components/` | Document forms, dialogs, preview, metadata display | UI changes |
| `hooks/` | Document CRUD, manual extraction, upload progress | Business logic |
| `mobile/` | Mobile-specific document layout | Mobile UI |
| `pages/` | DocumentsPage, DocumentDetailPage | Page layout |
| `types/` | TypeScript type definitions | Type changes |
| `utils/` | Utility functions (vehicle label formatting) | Helper logic |
## Key Files
| File | What | When to read |
| ---- | ---- | ------------ |
| `hooks/useManualExtraction.ts` | Manual extraction orchestration: submit PDF to /ocr/extract/manual, poll job status via /ocr/jobs/:jobId, return extraction results | Manual extraction flow, job polling |
| `components/DocumentForm.tsx` | Document metadata form with "Scan for Maintenance Schedule" checkbox (Pro tier) | Document upload, extraction trigger |
| `components/AddDocumentDialog.tsx` | Add document dialog integrating DocumentForm, upload progress, and manual extraction trigger | Document creation flow |
| `hooks/useDocuments.ts` | CRUD operations for documents | Document data management |
| `hooks/useUploadWithProgress.ts` | File upload with progress tracking | Upload UI |
| `components/DocumentPreview.tsx` | Document viewer/preview | Document display |
| `components/EditDocumentDialog.tsx` | Edit document metadata | Document editing |
| `types/documents.types.ts` | DocumentType, DocumentRecord, CreateDocumentRequest | Type definitions |
## Manual Extraction Flow
```
DocumentForm ("Scan for Maintenance Schedule" checkbox, Pro tier)
|
v
AddDocumentDialog -> useManualExtraction.submit(file, vehicleId)
|
v
POST /api/ocr/extract/manual (async job)
|
v
Poll GET /api/ocr/jobs/:jobId (progress: 10% -> 50% -> 95% -> 100%)
|
v
Job completed -> MaintenanceScheduleReviewScreen (in maintenance/ feature)
|
v
User selects/edits items -> Batch create maintenance schedules
```

View File

@@ -0,0 +1,48 @@
# fuel-logs/
Fuel log tracking UI with receipt OCR scanning. Captures fuel purchases, calculates statistics, and supports camera-based receipt scanning that auto-extracts fields and matches gas stations.
## Subdirectories
| Directory | What | When to read |
| --------- | ---- | ------------ |
| `api/` | Fuel log API endpoints | API integration |
| `components/` | Form components, receipt OCR UI, stats display | UI changes |
| `hooks/` | Data fetching, receipt OCR orchestration, user settings | Business logic |
| `pages/` | FuelLogsPage | Page layout |
| `types/` | TypeScript type definitions | Type changes |
## Key Files
| File | What | When to read |
| ---- | ---- | ------------ |
| `hooks/useReceiptOcr.ts` | Receipt OCR orchestration: camera capture, OCR extraction via /ocr/extract/receipt, station matching via /stations/match, field mapping | Receipt scanning flow, OCR integration |
| `components/ReceiptOcrReviewModal.tsx` | Modal for reviewing OCR-extracted receipt fields with confidence indicators, inline editing, station match display | Receipt review UI, field editing |
| `components/ReceiptCameraButton.tsx` | Button to trigger receipt camera capture (tier-gated) | Receipt capture entry point |
| `components/FuelLogForm.tsx` | Main fuel log form with OCR integration (setValue from accepted receipt) | Form fields, OCR field mapping |
| `components/ReceiptPreview.tsx` | Receipt image preview | Receipt display |
| `components/StationPicker.tsx` | Gas station selection with search | Station selection UI |
| `components/FuelLogsList.tsx` | Fuel log list display | Log listing |
| `components/FuelStatsCard.tsx` | Fuel statistics summary | Statistics display |
| `hooks/useFuelLogs.tsx` | CRUD operations for fuel logs | Data management |
| `types/fuel-logs.types.ts` | FuelLogResponse, CreateFuelLogRequest, LocationData, UnitSystem | Type definitions |
## Receipt OCR Flow
```
ReceiptCameraButton (tier check)
|
v
useReceiptOcr.startCapture() -> CameraCapture (shared component)
|
v
useReceiptOcr.processImage() -> POST /api/ocr/extract/receipt
|
v
ReceiptOcrReviewModal (display extracted fields, confidence indicators)
|
+-- POST /api/stations/match (merchantName -> station match)
|
v
useReceiptOcr.acceptResult() -> FuelLogForm.setValue() (pre-fill form)
```

View File

@@ -0,0 +1,51 @@
# maintenance/
Maintenance record and schedule management UI. Supports manual schedule creation and batch creation from OCR-extracted maintenance data. Three categories: routine maintenance, repair, performance upgrade.
## Subdirectories
| Directory | What | When to read |
| --------- | ---- | ------------ |
| `api/` | Maintenance API endpoints | API integration |
| `components/` | Forms, lists, review screen, subtype selection | UI changes |
| `hooks/` | Data fetching, batch schedule creation from extraction | Business logic |
| `mobile/` | Mobile-specific maintenance layout | Mobile UI |
| `pages/` | MaintenancePage (tabs: records, schedules) | Page layout |
| `types/` | TypeScript type definitions (categories, subtypes, schedules) | Type changes |
## Key Files
| File | What | When to read |
| ---- | ---- | ------------ |
| `hooks/useCreateSchedulesFromExtraction.ts` | Batch-creates maintenance schedules from OCR extraction results, maps MaintenanceScheduleItem to CreateScheduleRequest | OCR-to-schedule creation flow |
| `components/MaintenanceScheduleReviewScreen.tsx` | Dialog for reviewing OCR-extracted maintenance items: checkboxes for selection, confidence indicators, inline editing, batch create action | Extraction review UI, item editing |
| `components/MaintenanceScheduleForm.tsx` | Form for manual schedule creation | Schedule creation UI |
| `components/MaintenanceRecordForm.tsx` | Form for manual record creation | Record creation UI |
| `components/MaintenanceSchedulesList.tsx` | Schedule list with edit/delete | Schedule display |
| `components/MaintenanceRecordsList.tsx` | Record list display | Record display |
| `components/SubtypeCheckboxGroup.tsx` | Multi-select checkbox group for maintenance subtypes (27 routine, repair, performance) | Subtype selection UI |
| `hooks/useMaintenanceRecords.ts` | CRUD operations for maintenance records and schedules | Data management |
| `types/maintenance.types.ts` | MaintenanceCategory, ScheduleType, ROUTINE_MAINTENANCE_SUBTYPES, MaintenanceSchedule | Type definitions, subtype constants |
| `components/MaintenanceScheduleReviewScreen.test.tsx` | Tests for extraction review screen | Test changes |
## Extraction Review Flow
```
ManualExtractionResult (from documents/ feature useManualExtraction)
|
v
MaintenanceScheduleReviewScreen
- Displays extracted items with confidence scores
- Checkboxes for select/deselect
- Inline editing of service name, intervals, details
- Touch targets >= 44px for mobile
|
v
useCreateSchedulesFromExtraction.mutate(selectedItems)
|
v
POST /api/maintenance/schedules (batch create)
|
v
Query invalidation -> MaintenanceSchedulesList refreshes
```