Driverthing/PLAN.md

1.9 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 Rust + Axum
AI / OCR Claude API (vision)
Spreadsheet rust_xlsxwriter (Excel)
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/
├── src/
│   ├── main.rs         # Axum server + routes
│   ├── claude.rs       # Claude API vision call
│   └── excel.rs        # Excel read/write logic
├── templates/
│   └── index.html      # Mobile camera upload page
├── Cargo.toml
└── mileage_log.xlsx    # Generated, gitignored

Flow

Phone camera → upload photo
    → Axum receives multipart/form-data
        → 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 Axum server with a multipart file upload endpoint
  2. Send uploaded image (base64) 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 endpoint for the Excel file