# lagnadeep-samal/pocket_walk architecture

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

- Interactive diagram: https://gitdiagram.com/lagnadeep-samal/pocket_walk
- Repository: https://github.com/lagnadeep-samal/pocket_walk

## Overview

Pocket Walk is a local-first walk-planning web app: the user chooses a walk, receives species clues, puts the phone away during a timed walk, then records finds and gets a journal entry and grass ratio. Its core stages are field-guide retrieval, optional local-LLM text generation, walk-mode tracking, and post-walk reflection. The sampled Python source shows retrieval, Ollama calls, and HTTP routing; README statements support the browser workflow and local-only state. The browser implementation was not sampled, so its internal wiring is not detailed.

Main entry points: [`app.py`](https://github.com/lagnadeep-samal/pocket_walk/blob/main/app.py) (HTTP API), [`index.html`](https://github.com/lagnadeep-samal/pocket_walk/blob/main/index.html) (Pocket Walk UI), [`guide.json`](https://github.com/lagnadeep-samal/pocket_walk/blob/main/guide.json) (Field guide)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_planning["Planning and knowledge"]
  node_guide["Field guide<br/>[guide.json]"]
  node_retrieval["BM25 retrieval<br/>[app.py]"]
  node_planner["Walk planner<br/>[app.py]"]
end

subgraph group_service["Local service and AI"]
  node_api["HTTP API<br/>[app.py]"]
  node_ollama["Ollama model"]
end

subgraph group_walk["Walk experience"]
  node_browser["Pocket Walk UI<br/>[index.html]"]
  node_walkmode["Walk mode timer<br/>[index.html]"]
  node_localstate[("Browser walk state<br/>[index.html]")]
end

subgraph group_reflection["After the walk"]
  node_journal["Trail journal<br/>[app.py]"]
  node_grass["Grass ratio<br/>[index.html]"]
end

node_user(("Walker"))

node_user -->|"uses"| node_browser
node_browser -->|"requests plans"| node_api
node_api -->|"routes plan"| node_planner
node_planner -->|"selects species"| node_retrieval
node_retrieval -->|"searches notes"| node_guide
node_planner -->|"requests clues"| node_ollama
node_api -->|"checks status"| node_ollama
node_browser -->|"starts walk"| node_walkmode
node_walkmode -->|"stores timing"| node_localstate
node_browser -->|"submits finds"| node_api
node_api -->|"routes journal"| node_journal
node_journal -->|"requests entry"| node_ollama
node_localstate -->|"tracks screen and walk time"| node_grass
node_user -->|"logs discoveries"| node_browser

click node_browser "https://github.com/lagnadeep-samal/pocket_walk/blob/main/index.html"
click node_api "https://github.com/lagnadeep-samal/pocket_walk/blob/main/app.py"
click node_guide "https://github.com/lagnadeep-samal/pocket_walk/blob/main/guide.json"
click node_retrieval "https://github.com/lagnadeep-samal/pocket_walk/blob/main/app.py"
click node_planner "https://github.com/lagnadeep-samal/pocket_walk/blob/main/app.py"
click node_walkmode "https://github.com/lagnadeep-samal/pocket_walk/blob/main/index.html"
click node_localstate "https://github.com/lagnadeep-samal/pocket_walk/blob/main/index.html"
click node_journal "https://github.com/lagnadeep-samal/pocket_walk/blob/main/app.py"
click node_grass "https://github.com/lagnadeep-samal/pocket_walk/blob/main/index.html"

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_guide,node_retrieval,node_planner toneBlue
class node_api,node_ollama toneAmber
class node_browser,node_walkmode,node_localstate toneMint
class node_journal,node_grass toneRose
class node_user toneIndigo
```

## Components

### Planning and knowledge

- [Field guide](https://github.com/lagnadeep-samal/pocket_walk/blob/main/guide.json): `guide.json`
- [BM25 retrieval](https://github.com/lagnadeep-samal/pocket_walk/blob/main/app.py): `app.py`
- [Walk planner](https://github.com/lagnadeep-samal/pocket_walk/blob/main/app.py): `app.py`

### Local service and AI

- [HTTP API](https://github.com/lagnadeep-samal/pocket_walk/blob/main/app.py): `app.py`
- **Ollama model**

### Walk experience

- [Pocket Walk UI](https://github.com/lagnadeep-samal/pocket_walk/blob/main/index.html): `index.html`
- [Walk mode timer](https://github.com/lagnadeep-samal/pocket_walk/blob/main/index.html): `index.html`
- [Browser walk state](https://github.com/lagnadeep-samal/pocket_walk/blob/main/index.html): `index.html`

### After the walk

- [Trail journal](https://github.com/lagnadeep-samal/pocket_walk/blob/main/app.py): `app.py`
- [Grass ratio](https://github.com/lagnadeep-samal/pocket_walk/blob/main/index.html): `index.html`

### Other components

- **Walker**

## Connections

- Walker → Pocket Walk UI: uses (evidence: `README.md`)
- Pocket Walk UI → HTTP API: requests plans (evidence: `README.md`)
- HTTP API → Walk planner: routes plan (evidence: `app.py`)
- Walk planner → BM25 retrieval: selects species (evidence: `app.py`)
- BM25 retrieval → Field guide: searches notes (evidence: `app.py`)
- Walk planner → Ollama model: requests clues (evidence: `app.py`)
- HTTP API → Ollama model: checks status (evidence: `app.py`)
- Pocket Walk UI → Walk mode timer: starts walk (evidence: `README.md`)
- Walk mode timer → Browser walk state: stores timing (evidence: `README.md`)
- Pocket Walk UI → HTTP API: submits finds (evidence: `README.md`)
- HTTP API → Trail journal: routes journal (evidence: `app.py`)
- Trail journal → Ollama model: requests entry (evidence: `app.py`)
- Browser walk state → Grass ratio: tracks screen and walk time (evidence: `README.md`)
- Walker → Pocket Walk UI: logs discoveries (evidence: `README.md`)
