# jkhamanishi/odometer-app architecture

> Architecture diagram of the GitHub repository jkhamanishi/odometer-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jkhamanishi/odometer-app
- Repository: https://github.com/jkhamanishi/odometer-app

## Overview

This is an odometer-reading capture and submission app. A user selects a photo, adjusts a crop around the digits, and the frontend processes the image and recognizes digits; the user can review and submit the reading with date, time, and record type. The backend accepts a payload, saves an optional image to Drive, and appends reading metadata and its image link to a Sheet. The excerpts support the frontend processing and backend storage stages, but do not show the API transport wiring between them.

Main entry points: [`frontend/src/fileHandler/index.ts`](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/index.ts) (File Handlers), [`frontend/src/fileHandler/fileSelection.ts`](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/fileSelection.ts) (File Selection), [`frontend/src/fileHandler/fileAnalysis.ts`](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/fileAnalysis.ts) (File Analysis), [`frontend/src/formHandler/formSubmitHandler.ts`](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/formHandler/formSubmitHandler.ts) (Submission Workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Photo Capture"]
  node_app["App Startup<br/>[main.ts]"]
  node_fileinit["File Handlers<br/>[index.ts]"]
  node_selection["File Selection<br/>[fileSelection.ts]"]
  node_fileanalysis["File Analysis<br/>[fileAnalysis.ts]"]
  node_filestate["Selected File State<br/>[fileState.ts]"]
  node_datefields["File Date Time<br/>[fileDateTime.ts]"]
end

subgraph group_imaging["Image Recognition"]
  node_cropper["Crop Selection<br/>[cropperManager.ts]"]
  node_preview["Image Previews"]
  node_previewhide["Preview Hiding"]
  node_imageprocess["Image Processing<br/>[processImage.ts]"]
  node_processorbase["Processor Framework<br/>[processor.ts]"]
  node_processors["Image Processors"]
  node_ocr["Digit Recognition<br/>[sevenSegmentOcr.ts]"]
end

subgraph group_submission["Reading Submission"]
  node_forminit["Form Handlers<br/>[index.ts]"]
  node_submit["Submission Workflow"]
  node_fileread["Image Encoding<br/>[fileToBase64.ts]"]
  node_api["API Client<br/>[api.ts]"]
end

subgraph group_backend["Recording Backend"]
  node_entry["Request Dispatcher<br/>[index.ts]"]
  node_post["Record Handler<br/>[doPost.ts]"]
  node_drive[("Google Drive")]
  node_sheets[("Google Sheets")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"initializes"| node_fileinit
node_app -->|"initializes"| node_forminit
node_fileinit -->|"initializes"| node_selection
node_fileinit -->|"initializes"| node_fileanalysis
node_fileinit -->|"uses"| node_filestate
node_fileinit -->|"resets"| node_filestate
node_selection -->|"updates"| node_filestate
node_selection -->|"uses"| node_datefields
node_selection -->|"uses"| node_imageprocess
node_fileanalysis -->|"uses"| node_imageprocess
node_fileanalysis -->|"renders"| node_preview
node_fileanalysis -->|"hides"| node_previewhide
node_imageprocess -->|"creates processors"| node_processorbase
node_imageprocess -->|"runs pipeline"| node_processors
node_processors -->|"extends"| node_processorbase
node_forminit -->|"registers"| node_submit
node_submit -->|"calls"| node_api
node_submit -->|"encodes image"| node_fileread
node_submit -->|"reads and resets"| node_fileinit
node_api -.->|"sends request"| node_entry
node_entry -->|"dispatches"| node_post
node_post -->|"writes image"| node_drive
node_post -->|"appends reading"| node_sheets

click node_app "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/main.ts"
click node_fileinit "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/index.ts"
click node_selection "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/fileSelection.ts"
click node_fileanalysis "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/fileAnalysis.ts"
click node_filestate "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/fileState.ts"
click node_datefields "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/fileDateTime.ts"
click node_cropper "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/imageProcessing/cropperManager.ts"
click node_preview "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/filePreviewRendering.ts"
click node_previewhide "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/filePreviewHiding.ts"
click node_imageprocess "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/imageProcessing/processImage.ts"
click node_processorbase "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/imageProcessing/processors/processor.ts"
click node_processors "https://github.com/jkhamanishi/odometer-app/tree/master/frontend/src/imageProcessing/processors"
click node_ocr "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/imageProcessing/ocr/sevenSegmentOcr.ts"
click node_forminit "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/formHandler/index.ts"
click node_submit "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/formHandler/formSubmitHandler.ts"
click node_fileread "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/formHandler/fileToBase64.ts"
click node_api "https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/formHandler/api.ts"
click node_entry "https://github.com/jkhamanishi/odometer-app/blob/master/backend/src/index.ts"
click node_post "https://github.com/jkhamanishi/odometer-app/blob/master/backend/src/doPost.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_fileinit,node_selection,node_fileanalysis,node_filestate,node_datefields,node_user toneBlue
class node_cropper,node_preview,node_previewhide,node_imageprocess,node_processorbase,node_processors,node_ocr toneAmber
class node_forminit,node_submit,node_fileread,node_api toneMint
class node_entry,node_post,node_drive,node_sheets toneRose
```

## Components

### Photo Capture

- [App Startup](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/main.ts): `frontend/src/main.ts`
- [File Handlers](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/index.ts): `frontend/src/fileHandler/index.ts`
- [File Selection](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/fileSelection.ts): `frontend/src/fileHandler/fileSelection.ts`
- [File Analysis](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/fileAnalysis.ts): `frontend/src/fileHandler/fileAnalysis.ts`
- [Selected File State](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/fileState.ts): `frontend/src/fileHandler/fileState.ts`
- [File Date Time](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/fileDateTime.ts): `frontend/src/fileHandler/fileDateTime.ts`

### Image Recognition

- [Crop Selection](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/imageProcessing/cropperManager.ts): `frontend/src/imageProcessing/cropperManager.ts`
- [Image Previews](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/filePreviewRendering.ts): `frontend/src/fileHandler/filePreviewRendering.ts`
- [Preview Hiding](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/fileHandler/filePreviewHiding.ts): `frontend/src/fileHandler/filePreviewHiding.ts`
- [Image Processing](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/imageProcessing/processImage.ts): `frontend/src/imageProcessing/processImage.ts`
- [Processor Framework](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/imageProcessing/processors/processor.ts): `frontend/src/imageProcessing/processors/processor.ts`
- [Image Processors](https://github.com/jkhamanishi/odometer-app/tree/master/frontend/src/imageProcessing/processors): `frontend/src/imageProcessing/processors`
- [Digit Recognition](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/imageProcessing/ocr/sevenSegmentOcr.ts): `frontend/src/imageProcessing/ocr/sevenSegmentOcr.ts`

### Reading Submission

- [Form Handlers](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/formHandler/index.ts): `frontend/src/formHandler/index.ts`
- [Submission Workflow](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/formHandler/formSubmitHandler.ts): `frontend/src/formHandler/formSubmitHandler.ts`
- [Image Encoding](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/formHandler/fileToBase64.ts): `frontend/src/formHandler/fileToBase64.ts`
- [API Client](https://github.com/jkhamanishi/odometer-app/blob/master/frontend/src/formHandler/api.ts): `frontend/src/formHandler/api.ts`

### Recording Backend

- [Request Dispatcher](https://github.com/jkhamanishi/odometer-app/blob/master/backend/src/index.ts): `backend/src/index.ts`
- [Record Handler](https://github.com/jkhamanishi/odometer-app/blob/master/backend/src/doPost.ts): `backend/src/doPost.ts`
- **Google Drive**
- **Google Sheets**

### Other components

- **User**

## Connections

- User → App Startup: uses (evidence: `frontend/src/main.ts`)
- App Startup → File Handlers: initializes (evidence: `frontend/src/main.ts`)
- App Startup → Form Handlers: initializes (evidence: `frontend/src/main.ts`)
- File Handlers → File Selection: initializes (evidence: `frontend/src/fileHandler/index.ts`)
- File Handlers → File Analysis: initializes (evidence: `frontend/src/fileHandler/index.ts`)
- File Handlers → Selected File State: uses (evidence: `frontend/src/fileHandler/index.ts`)
- File Handlers → Selected File State: resets (evidence: `frontend/src/fileHandler/index.ts`)
- File Selection → Selected File State: updates (evidence: `frontend/src/fileHandler/fileSelection.ts`)
- File Selection → File Date Time: uses (evidence: `frontend/src/fileHandler/fileSelection.ts`)
- File Selection → Image Processing: uses (evidence: `frontend/src/fileHandler/fileSelection.ts`)
- File Analysis → Image Processing: uses (evidence: `frontend/src/fileHandler/fileAnalysis.ts`)
- File Analysis → Image Previews: renders (evidence: `frontend/src/fileHandler/fileAnalysis.ts`)
- File Analysis → Preview Hiding: hides (evidence: `frontend/src/fileHandler/fileAnalysis.ts`)
- Image Processing → Processor Framework: creates processors (evidence: `frontend/src/imageProcessing/processImage.ts`)
- Image Processing → Image Processors: runs pipeline (evidence: `frontend/src/imageProcessing/processImage.ts`)
- Image Processors → Processor Framework: extends (evidence: `frontend/src/imageProcessing/processors/noiseReduction.ts`)
- Form Handlers → Submission Workflow: registers (evidence: `frontend/src/formHandler/index.ts`)
- Submission Workflow → API Client: calls (evidence: `frontend/src/formHandler/formSubmitHandler.ts`)
- Submission Workflow → Image Encoding: encodes image (evidence: `frontend/src/formHandler/formSubmitHandler.ts`)
- Submission Workflow → File Handlers: reads and resets (evidence: `frontend/src/formHandler/formSubmitHandler.ts`)
- API Client → Request Dispatcher: sends request
- Request Dispatcher → Record Handler: dispatches (evidence: `backend/src/index.ts`)
- Record Handler → Google Drive: writes image (evidence: `backend/src/doPost.ts`)
- Record Handler → Google Sheets: appends reading (evidence: `backend/src/doPost.ts`)
