You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: PLAN.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,13 +76,13 @@ All Python repos follow the same pattern: FastAPI service, structured as a packa
76
76
- Convert NSW API calls to async using `httpx` + `asyncio` # check with surveyor, bit of a big change and already runs API calls in parallel using ThreadPoolExecutor
77
77
78
78
### Definition of done
79
-
- All 3 GitHub issues closed with a PR each # no pr
79
+
- All 3 GitHub issues closed with a PR each # DONE
80
80
-`pytest tests/` passes with no live API calls # DONE
81
-
- Green CI badge visible on the GitHub repo # not done
82
-
-`docker build` succeeds # not tested
83
-
-`/mark/TS/2761` returns a SurveyMark JSON object # needs to be checked
84
-
-`/mark/TS/2761/sketch` returns a PDF # not done
85
-
- Surface level appears in the `search` block of GeoJSON output # needs to be checked
81
+
- Green CI badge visible on the GitHub repo # DONE
82
+
-`docker build` succeeds # DONE
83
+
-`/mark/TS/2761` returns a SurveyMark JSON object # DONE
84
+
-`/mark/TS/2761/sketch` returns a PDF # check with surveyor about doing this
85
+
- Surface level appears in the `search` block of GeoJSON output # DONE "surface_level_ahd" is reported
86
86
-`GET /history` returns the last 20 searches # DONE
2. Place `credentials.json`and `token.json`in the project root (obtain from project administrator)
20
+
2. Place `credentials.json` in the project root (obtain from project administrator)
21
21
22
22
3. Create and activate a virtual environment
23
23
@@ -37,34 +37,90 @@ source venv/bin/activate
37
37
pip install -r requirements.txt
38
38
```
39
39
40
+
5. Authenticate with Google Drive (first time only)
41
+
42
+
Run the console app once:
43
+
```
44
+
python console/run.py
45
+
```
46
+
47
+
A browser window will open asking you to authorise Google Drive access. Complete it and `token.json` will be created in the project root. You only need to do this once — the token is reused and auto-refreshed on every subsequent run.
48
+
40
49
## Running with Docker (recommended)
41
50
42
-
Docker is the easiest way to run the service without configuring a local Python environment.
51
+
Docker runs the FastAPI service in an isolated container with no local Python environment required. The console app still runs locally against the service over HTTP.
-[Docker Desktop](https://www.docker.com/products/docker-desktop/) installed and running
46
55
-`credentials.json` and `token.json` in the project root
47
56
48
-
### Start the service
57
+
`token.json` must exist before starting Docker — the container cannot run the interactive browser auth flow. Complete step 5 of [Setup](#setup) first if you haven't already.
58
+
59
+
### First run
60
+
61
+
Create an empty database file so Docker mounts it correctly:
62
+
```
63
+
touch mls_spatial.db
64
+
```
65
+
66
+
Then start the service:
49
67
```
50
68
docker compose up --build
51
69
```
52
70
53
-
The service will be available at `http://localhost:8000`.
71
+
The `--build` flag builds the image from the Dockerfile. The first run takes a minute or two to download the base image and install dependencies — subsequent starts are fast.
72
+
73
+
The FastAPI service will be available at `http://localhost:8000`.
54
74
55
-
To run in the background:
75
+
### Day-to-day usage
76
+
77
+
Start the service:
56
78
```
57
-
docker compose up --build -d
79
+
docker compose up
58
80
```
59
81
60
-
To stop:
82
+
Once you see this in the terminal, the service is running:
mls-spatial-mls-spatial-1 | INFO: Uvicorn running on http://0.0.0.0:8000
86
+
```
87
+
88
+
The FastAPI service is now running at `http://localhost:8000`. You can verify it's working by opening `http://localhost:8000/docs` in your browser — this shows the interactive API documentation where you can test endpoints directly.
89
+
90
+
To run the console app, open a separate terminal and run:
91
+
```
92
+
python console/run.py
93
+
```
94
+
95
+
To start the service in the background (no terminal output):
96
+
```
97
+
docker compose up -d
98
+
```
99
+
100
+
To stop the service:
61
101
```
62
102
docker compose down
63
103
```
64
104
105
+
Rebuild after code changes:
106
+
```
107
+
docker compose up --build
108
+
```
109
+
110
+
### What gets mounted
111
+
112
+
The container shares these paths with your local machine — no rebuild needed when these files change:
113
+
114
+
| Host path | Container path | Purpose |
115
+
|---|---|---|
116
+
|`./credentials.json`|`/app/credentials.json`| Google OAuth credentials |
117
+
|`./token.json`|`/app/token.json`| Google OAuth token (auto-refreshed) |
118
+
|`./output/`|`/app/output/`| Search results and generated files |
119
+
|`./mls_spatial.db`|`/app/mls_spatial.db`| Search history database |
120
+
65
121
## Usage
66
122
67
-
Run the console app:
123
+
With either the local server or Docker running, start the console app:
68
124
```
69
125
python console/run.py
70
126
```
@@ -91,7 +147,7 @@ Results are saved to `output/{address}-{date}/` containing:
91
147
92
148
## FastAPI Service
93
149
94
-
For programmatic access or the AutoCAD add-in:
150
+
For programmatic access or the AutoCAD add-in, the service can also be run locally without Docker:
0 commit comments