18 Gas Readings
4 operations.
18.0.1 listDatasetGasReadings
GET /api/datasets/{slug}/gas-readings
Lists all gas readings recorded for a dataset, in time order.
Why it exists. ‡ Return the gas sensor readings taken during the survey this dataset came from, scoped through the joining view so a caller sees only readings belonging to datasets they may already see.
Called by — modules/gas-heatmap/hooks/use-dataset-gas-readings.ts
Reached from — /datasets/<slug> · /w/integrity/evidence-explorer
Returns all georeferenced gas sensor readings for a dataset (view v_dataset_gas_readings), ordered by timestamp. Returns an empty list when the dataset’s has_gas_readings flag is false. limit follows the documented lenient-pagination policy and is not runtime-validated here.
Authentication: SupabaseAuth, CookieAuth
Returns — success · readings · total · truncated · limit
Field names as the handler returns them; the source states no types for them.
Effect — reads datasets · v_dataset_gas_readings
Parameters
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
slug |
path | yes | string |
Responses
| Status | Meaning | Body |
|---|---|---|
200 |
Readings. | |
400 |
Missing dataset slug. | Error |
401 |
Not authenticated. | Error |
404 |
Dataset not found or access denied. | Error |
500 |
Failed to fetch gas readings. | Error |
18.0.2 checkDatasetHasGasReadings
GET /api/datasets/{slug}/has-gas-readings
Answers “are there gas readings near this dataset?” (within 10 km).
Why it exists. † Answer whether any gas readings were taken near this dataset, computed geospatially rather than trusted from a stored flag, so the interface can hide the gas panel when there is nothing to show.
Determines (via the check_gas_readings_near_dataset RPC, 10 km radius) whether gas readings exist near the dataset’s images, self-healing the cached has_gas_readings flag when it differs.
Authentication: CookieAuth, SupabaseAuth
Returns — hasGasReadings · count
Field names as the handler returns them; the source states no types for them.
Effect — writes (update) datasets · images
Parameters
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
slug |
path | yes | string |
Responses
| Status | Meaning | Body |
|---|---|---|
200 |
Result. | |
401 |
Unauthorized. | Error |
404 |
Dataset not found (also returned for a dataset outside the caller’s organizations — RLS makes the two indistinguishable). | Error |
500 |
Internal server error. | Error |
18.0.3 listGasReadings
GET /api/gas-readings
Lists the gas readings from the campaigns you can see.
Why it exists. † Return the gas readings the caller may already see, with usable coordinates, for plotting a survey as a whole rather than one dataset at a time.
Returns the gas readings with valid coordinates from campaigns the caller can see (the RLS-scoped v_dataset_gas_readings view, de-duplicated by reading), ordered by timestamp; totalCount reflects the pre-filter total and can exceed the returned length. limit follows the documented lenient-pagination policy (clamped, never rejected) and is not runtime-validated here.
Authentication: CookieAuth, SupabaseAuth
Returns — success · gasReadings · totalCount · truncated · limit
Field names as the handler returns them; the source states no types for them.
Effect — reads v_dataset_gas_readings
Responses
| Status | Meaning | Body |
|---|---|---|
200 |
All readings. | |
401 |
Unauthorized. | Error |
500 |
Failed to fetch gas readings. | Error |
18.0.4 listImageGasReadings
GET /api/images/{id}/gas-readings
Finds the gas readings taken nearest to a specific photo, if the photo is one you can see.
Why it exists. ‡ Find the gas readings taken nearest to where an image was captured, so a visual finding can be read alongside what the sensors measured at that spot.
Called by — modules/gallery/overlays/components/gas-readings-panel.tsx · modules/photo-map-3d/overlays/hooks/use-gas-readings.ts
Reached from — /datasets/<slug> · /w/data-explorer/anomalies/map · /w/data-explorer/assets · /w/integrity/assets · /w/integrity/evidence-explorer
Nearest gas readings to an image via the PostGIS find_nearest_gas_readings RPC. Authorized by the handler, not by the RPC: the function is SECURITY DEFINER and so does not apply RLS. The image is therefore read first through the caller’s RLS-scoped client, and one outside their organizations is a 404 — indistinguishable from one that does not exist.
Authentication: CookieAuth, SupabaseAuth
Returns — success · gasReadings · message · totalCount · searchRadius
Field names as the handler returns them; the source states no types for them.
Effect — reads images
Parameters
| Name | In | Required | Type | Notes |
|---|---|---|---|---|
id |
path | yes | string | |
maxDistance |
query | no | integer, nullable | |
limit |
query | no | integer, nullable |
Responses
| Status | Meaning | Body |
|---|---|---|
200 |
Nearest readings (totalCount/searchRadius are absent when there are no results). | |
400 |
Image ID is required, or maxDistance/limit is not a non-negative integer. | Error |
401 |
No session. | Error |
404 |
No such image, or one outside the caller’s organizations. | Error |
500 |
Failed to fetch gas readings. | Error |