Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Commit 3de274c

Browse files
Update docs
Readme to be cut down when ready
1 parent 5a82a98 commit 3de274c

File tree

2 files changed

+76
-48
lines changed

2 files changed

+76
-48
lines changed

README.md

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
API for supporting reef suitability assessments.
44

5+
[![Documentation](https://img.shields.io/badge/docs-dev-blue)](https://open-aims.github.io/ReefModEngine.jl/dev/)
6+
57
## Setup
68

79
Initialize the project the usual way:
@@ -27,6 +29,28 @@ TILE_SIZE = "256" # Optional, tile block size to use (defaults to 256)
2729

2830
By convention, this file is named `.config.toml` (note the leading `.`).
2931

32+
## JWT Auth configuration
33+
34+
The API can be additionally configured to expect a valid JWT in the `Authorization: Bearer <token>` header format.
35+
36+
Add the following to `.config.toml`:
37+
38+
```toml
39+
[jwt_auth]
40+
# Enable JWT auth : bool true/false
41+
JWT_ENABLED = true
42+
# Which iss to validate for the JWTs?
43+
JWT_ISS = "https://issuer.com"
44+
# WKT JWKS endpoint where public key can be retrieved
45+
WKT_ENDPOINT = "https://https://issuer.com/api/.well-known/jwks.json"
46+
```
47+
48+
Pay attention to the issuer and wkt endpoints. The first should exactly match the expected JWT issuer claim. The second should be web-resolvable and return a WKT JSON which provides the public key.
49+
50+
### Auth TODOs
51+
52+
- ensure health check route is not authorised
53+
3054
## Quickstart
3155

3256
```julia
@@ -87,28 +111,6 @@ Note that the server now caches the initially loaded spatial data in between ser
87111
launches to reduce downtime. It will be necessary to restart the Julia session to reload
88112
spatial data.
89113

90-
## JWT Auth configuration
91-
92-
The API can be configured to expect a valid JWT in the `Authorization: Bearer <token>` header format.
93-
94-
Add the following to your `.config.toml`:
95-
96-
```toml
97-
[jwt_auth]
98-
# Enable JWT auth : bool true/false
99-
JWT_ENABLED = true
100-
# Which iss to validate for the JWTs?
101-
JWT_ISS = "https://issuer.com"
102-
# WKT JWKS endpoint where public key can be retrieved
103-
WKT_ENDPOINT = "https://https://issuer.com/api/.well-known/jwks.json"
104-
```
105-
106-
Pay attention to the issuer and wkt endpoints. The first should exactly match the expected JWT issuer claim. The second should be web-resolvable and return a WKT JSON which provides the public key.
107-
108-
### Auth TODOs
109-
110-
- ensure health check route is not authorised
111-
112114
## Performance notes
113115

114116
The config setting `COG_THREADS` controls how many threads should be requested when writing
@@ -159,37 +161,37 @@ When running the below commands, it is assumed you have `data` available locally
159161

160162
### To build from src files using Docker
161163

162-
```
164+
```bash
163165
docker build . --target reefguide-src -t reefguide
164166
```
165167

166168
### To build from src files using Docker Compose
167169

168-
```
170+
```bash
169171
docker compose up --build reefguide-src
170172
```
171173

172174
### To run with mounted files (launch server) using Docker
173175

174-
```
176+
```bash
175177
docker run -p 8000:8000 -v ./data:/data/reefguide reefguide
176178
```
177179

178180
### To run with mounted files (launch server) using Docker Compose
179181

180-
```
182+
```bash
181183
docker compose up reefguide-src
182184
```
183185

184186
### To run with mounted files (interactive shell) using Docker
185187

186188
This will start a Julia shell where `ReefGuideAPI` is compiled and ready for use e.g.
187189

188-
```
190+
```julia
189191
using ReefGuideAPI
190192
ReefGuideAPI.start_server("/data/reefguide/config.toml")
191193
```
192194

193-
```
195+
```julia
194196
docker run --rm --interactive --entrypoint="julia" --tty -v ./data:/data/reefguide reefguide
195197
```

docs/src/getting_started.md

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ Initialize the project the usual way:
1111
A TOML file should be defined indicating location of the MPA dataset.
1212
These are currently the files/data created in Step/Script 1a in https://github.com/open-AIMS/GBR-reef-guidance-assessment
1313

14-
Other settings configure the server
15-
1614
```toml
1715
[prepped_data]
1816
PREPPED_DATA_DIR = "C:/some_path_to_data/MPA/"
@@ -31,6 +29,28 @@ By convention, this file is named `.config.toml` (note the leading `.`).
3129

3230
:::
3331

32+
## JWT Auth configuration
33+
34+
The API can be additionally configured to expect a valid JWT in the `Authorization: Bearer <token>` header format.
35+
36+
Add the following to `.config.toml`:
37+
38+
```toml
39+
[jwt_auth]
40+
# Enable JWT auth : bool true/false
41+
JWT_ENABLED = true
42+
# Which iss to validate for the JWTs?
43+
JWT_ISS = "https://issuer.com"
44+
# WKT JWKS endpoint where public key can be retrieved
45+
WKT_ENDPOINT = "https://https://issuer.com/api/.well-known/jwks.json"
46+
```
47+
48+
Pay attention to the issuer and wkt endpoints. The first should exactly match the expected JWT issuer claim. The second should be web-resolvable and return a WKT JSON which provides the public key.
49+
50+
### Auth TODOs
51+
52+
- ensure health check route is not authorised
53+
3454
## Quickstart
3555

3656
```julia
@@ -110,27 +130,33 @@ Note that the server now caches the initially loaded spatial data in between ser
110130
launches to reduce downtime. It will be necessary to restart the Julia session to reload
111131
spatial data.
112132

113-
## JWT Auth configuration
133+
## Performance notes
114134

115-
The API can be configured to expect a valid JWT in the `Authorization: Bearer <token>`
116-
header format.
135+
The config setting `COG_THREADS` controls how many threads should be requested when writing
136+
out COGs. Ideally this will be set to at least 2 (preferably 4).
137+
Higher values do seem to reduce write times but with diminishing returns (tested up to 8).
138+
Locally, write times with four threads configured range from 10 to 15 seconds.
117139

118-
Add the following to your `.config.toml`:
140+
## Reef edge alignment for site searching
119141

120-
```toml
121-
[jwt_auth]
122-
# Enable JWT auth : bool true/false
123-
JWT_ENABLED = true
124-
# Which iss to validate for the JWTs?
125-
JWT_ISS = "https://issuer.com"
126-
# WKT JWKS endpoint where public key can be retrieved
127-
WKT_ENDPOINT = "https://https://issuer.com/api/.well-known/jwks.json"
128-
```
142+
`identify_potential_sites_edges()` can be used to identify potential sites that only align with
143+
the nearest reef edge (or specified rotations away from this angle).
144+
This method works by identifying the closest edge of reef polygon geometries that have been
145+
converted into lines.
129146

130-
Pay attention to the issuer and wkt endpoints. The first should exactly match the expected
131-
JWT issuer claim. The second should be web-resolvable and return a WKT JSON which provides
132-
the public key.
147+
The following processing is required before use:
133148

134-
### Auth TODOs
149+
- Reef polygons should be simplified (`GO.simplify()`) and buffered to avoid matching possibly inaccurate reef edges.
150+
- Simplified reef polygons should be provided as vertex-vertex lines with `polygon_to_lines()`.
151+
- Require raster of target pixels to search, and their indices (currently a vector of `CartesianIndices` for identifying search pixels). Use `findall(bool_search_raster)` to return pixel indices.
152+
- Raster of search pixels should be masked by reef polygons or simplified reef polygons.
153+
- The target region name should be specified in GBRMPA format.
154+
- E.g. "Townsville/Whitsunday Management Area" rather than "Townsville-Whitsunday".
155+
156+
### Parquet assessment additional setup
135157

136-
- ensure health check route is not authorised
158+
- A parquet GeoDataFrame must be loaded and filtered for unsuitable pixels based on user criteria thresholds using a Dict and `within_thresholds()`.
159+
- `lon` and `lat` columns (FLoat64) must be added to the GeoDataFrame.
160+
- E.g. `valid_pixels.lon = first.(GI.coordinates.(valid_pixels.geometry))`
161+
The column used for masking should be the same as the column specified as geometry_col in
162+
`identify_potential_sites_edges` (default = `:geometry`).

0 commit comments

Comments
 (0)