commit 2b5a39a550b8ebed013d1b584b591cda5ff467d1 Author: Claude Date: Wed Mar 18 18:12:38 2026 +0000 Add mileage tracking automation plan https://claude.ai/code/session_015myTTMs6yDsAGarATe5ePZ diff --git a/PLAN.md b/PLAN.md new file mode 100644 index 0000000..2918153 --- /dev/null +++ b/PLAN.md @@ -0,0 +1,69 @@ +# Mileage Tracking Automation — Plan + +## How it works + +1. Open the web app on your phone +2. Take a photo of the odometer +3. Claude Vision API reads the number automatically +4. The km driven is calculated and saved to an Excel sheet +5. Download the sheet anytime + +--- + +## Stack + +| Layer | Technology | +|-------------|-----------------------------| +| Backend | Python + Flask | +| AI / OCR | Claude API (vision) | +| Spreadsheet | openpyxl (Excel .xlsx) | +| Frontend | Mobile-friendly HTML | + +--- + +## Excel sheet columns + +| Date | Time | Odometer (km) | Trip (km) | Notes | +|------------|-------|---------------|-----------|-------| +| 2026-03-18 | 08:14 | 84 320 | 47 | Work | + +--- + +## Files to create + +``` +Driverthing/ +├── app.py # Flask server + Claude API call +├── mileage.py # Excel read/write logic +├── templates/ +│ └── index.html # Mobile camera upload page +├── requirements.txt +└── mileage_log.xlsx # Generated, gitignored +``` + +--- + +## Flow + +``` +Phone camera → upload photo + → Flask receives image + → Claude Vision: "What is the odometer reading?" + → Extract number + → Calculate delta from last reading + → Append row to Excel + → Show confirmation on screen +``` + +--- + +## Implementation steps + +1. Set up Flask app with a file upload endpoint +2. Send uploaded image to Claude API with a vision prompt +3. Parse the odometer number from the response +4. Read the last recorded odometer value from the Excel file +5. Calculate the difference (km driven) +6. Append a new row (date, time, odometer, trip km, notes) to the sheet +7. Return confirmation to the browser +8. Add a download button for the Excel file