Driverthing/PLAN.md

1.8 KiB

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