Switch backend from Python/Flask to Rust/Axum
https://claude.ai/code/session_015myTTMs6yDsAGarATe5ePZ
This commit is contained in:
parent
2b5a39a550
commit
235fbd226b
1 changed files with 11 additions and 9 deletions
20
PLAN.md
20
PLAN.md
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
| Layer | Technology |
|
||||
|-------------|-----------------------------|
|
||||
| Backend | Python + Flask |
|
||||
| Backend | Rust + Axum |
|
||||
| AI / OCR | Claude API (vision) |
|
||||
| Spreadsheet | openpyxl (Excel .xlsx) |
|
||||
| Spreadsheet | rust_xlsxwriter (Excel) |
|
||||
| Frontend | Mobile-friendly HTML |
|
||||
|
||||
---
|
||||
|
|
@ -33,11 +33,13 @@
|
|||
|
||||
```
|
||||
Driverthing/
|
||||
├── app.py # Flask server + Claude API call
|
||||
├── mileage.py # Excel read/write logic
|
||||
├── 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
|
||||
├── requirements.txt
|
||||
├── Cargo.toml
|
||||
└── mileage_log.xlsx # Generated, gitignored
|
||||
```
|
||||
|
||||
|
|
@ -47,7 +49,7 @@ Driverthing/
|
|||
|
||||
```
|
||||
Phone camera → upload photo
|
||||
→ Flask receives image
|
||||
→ Axum receives multipart/form-data
|
||||
→ Claude Vision: "What is the odometer reading?"
|
||||
→ Extract number
|
||||
→ Calculate delta from last reading
|
||||
|
|
@ -59,11 +61,11 @@ Phone camera → upload photo
|
|||
|
||||
## Implementation steps
|
||||
|
||||
1. Set up Flask app with a file upload endpoint
|
||||
2. Send uploaded image to Claude API with a vision prompt
|
||||
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 button for the Excel file
|
||||
8. Add a download endpoint for the Excel file
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue