-
Notifications
You must be signed in to change notification settings - Fork 2
docs: document gps_device_capture for FLCRM-20930 #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
openspec/changes/archive/2026-09-01-document-gps-device-capture/design.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # Design: GPS device capture docs | ||
|
|
||
| ## Context | ||
|
|
||
| `gps_device_capture` is a flexible JSON object on records. OpenAPI already defines `GpsDeviceCaptureBase` (response) and `GpsDeviceCaptureRequest` (create/update, nullable to clear). Known keys: `device_name`, `manufacturer`, `fix_type`, `satellite_count`, `hdop`, `vdop`, `pdop`, `differential_correction`, `antenna_height`, `firmware_version`, `geometry`. Additional device-specific keys are allowed. | ||
|
|
||
| Query API form tables expose the value as `_gps_device_capture` (schema v6+). Older form schemas may omit the column. | ||
|
|
||
| Ticket “Search API” means the Query API. | ||
|
|
||
| ## Goals / Non-Goals | ||
|
|
||
| **Goals:** | ||
|
|
||
| - Make the field discoverable without reading raw OpenAPI. | ||
| - Show a realistic create/update/get payload. | ||
| - Show JSONB queries on inner keys. | ||
| - Update `change-geometry` docs only with verified event data. | ||
|
|
||
| **Non-Goals:** | ||
|
|
||
| - Schema changes, backend changes, Cypress tests. | ||
| - Re-adding `geometry_matches_capture`. | ||
| - Inventing Data Events fields that are not in source or published docs. | ||
|
|
||
| ## Decisions | ||
|
|
||
| ### 1. Example payload | ||
|
|
||
| Use the backend spec example: | ||
|
|
||
| ```json | ||
| { | ||
| "device_name": "Trimble R2", | ||
| "manufacturer": "Trimble", | ||
| "fix_type": "RTK", | ||
| "satellite_count": 14, | ||
| "hdop": 0.8, | ||
| "geometry": { "type": "Point", "coordinates": [-82.637, 27.771] } | ||
| } | ||
| ``` | ||
|
|
||
| ### 2. Query examples | ||
|
|
||
| Document `_gps_device_capture` as jsonb. Examples: | ||
|
|
||
| ```sql | ||
| SELECT _record_id, _gps_device_capture | ||
| FROM "Form Name" | ||
| WHERE _gps_device_capture->>'device_name' = 'Trimble R2'; | ||
|
|
||
| SELECT _record_id | ||
| FROM "Form Name" | ||
| WHERE _gps_device_capture @> '{"fix_type": "RTK"}'; | ||
| ``` | ||
|
|
||
| Note that the column exists on schema v6 form tables. | ||
|
|
||
| ### 3. change-geometry | ||
|
|
||
| `fulcrum-core` only serializes record `gps_device_capture`; it does not define the Data Events payload. `fulcrum-expressions` `GeometryEvent` still types `name` / optional `field` / `value` (GeoJSON). | ||
|
|
||
| Verified from mobile clients: | ||
|
|
||
| - Android `GeometryChangeEventHelper` and iOS `NMEALocationEventPayload` attach optional top-level `gpsData` as a **sibling of `value`** when external GPS metadata is available. | ||
| - iOS event keys are camelCase (`deviceName`, `fixType`, `satellites`). Android `LocationInfo.toMap()` currently emits snake_case (`device_name`, `fix_type`, `satellite_count`) plus `deviceName`. | ||
|
|
||
| Public docs MUST: | ||
|
|
||
| - Keep `event.value` as the GeoJSON geometry. | ||
| - Document optional `event.gpsData` without claiming a single canonical key list. | ||
| - Not invent fields beyond `gpsData` / `value` / `field` / `name`. | ||
|
|
||
| ## File map | ||
|
|
||
| - `openspec/changes/document-gps-device-capture/` — this change | ||
|
sjperaltas marked this conversation as resolved.
|
||
| - `reference/RECORDS/records-intro.md` | ||
| - `reference/RECORDS/records-create.md` | ||
| - `reference/rest-api.json` (examples only) | ||
| - `reference/QUERY/query-intro.md` | ||
| - `docs/DATA EVENTS/data-events-reference/index.md` | ||
| - `docs/DATA EVENTS/data-events-reference/data-events-on.md` | ||
29 changes: 29 additions & 0 deletions
29
openspec/changes/archive/2026-09-01-document-gps-device-capture/proposal.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Change: Document GPS device capture in API docs | ||
|
|
||
| ## Why | ||
|
|
||
| Integrators need accurate Records v2, Query API, and Data Events docs for `gps_device_capture`. [api#75](https://github.com/fulcrumapp/api/pull/75) added the OpenAPI schema only. [FLCRM-20930](https://fulcrumapp.atlassian.net/browse/FLCRM-20930) still lacks human-readable field docs, request/response examples, Query API JSONB examples, and `change-geometry` event notes. | ||
|
|
||
| ## What Changes | ||
|
|
||
| - Document `gps_device_capture` on the Records API intro properties table. | ||
| - Add JSON request/response examples showing flexible, device-dependent metadata. | ||
| - Document Query API column `_gps_device_capture` and SQL examples that filter on inner keys. | ||
| - Document `change-geometry` event data only where the payload can be verified. | ||
| - Do not change the existing OpenAPI schema from api#75. Do not re-document `geometry_matches_capture`. | ||
|
|
||
| ## Capabilities | ||
|
|
||
| ### New Capabilities | ||
|
|
||
| - `gps-device-capture-docs`: Public developer documentation for GPS device capture on Records v2, Query API, and Data Events. | ||
|
|
||
| ### Modified Capabilities | ||
|
|
||
| - None. This is a documentation-only change in `fulcrumapp/api`. | ||
|
|
||
| ## Impact | ||
|
|
||
| - **Docs site**: Records intro, record create/update examples, Query intro, Data Events reference. | ||
| - **OpenAPI**: Example payloads only in `reference/rest-api.json`. | ||
| - **Backend / mobile**: No code changes. |
56 changes: 56 additions & 0 deletions
56
...ve/2026-09-01-document-gps-device-capture/specs/gps-device-capture-docs/spec.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # gps-device-capture-docs Specification | ||
|
|
||
| ## Purpose | ||
|
|
||
| Developer documentation for `gps_device_capture` on Records API v2, Query API, and Data Events. | ||
|
|
||
| ## Requirements | ||
|
|
||
| ### Requirement: Records intro documents gps_device_capture | ||
|
|
||
| The Records API intro properties table SHALL include `gps_device_capture` as an optional object. The description SHALL state that it is flexible device-dependent GPS metadata, additional keys are allowed, and `null` clears the value on write. | ||
|
|
||
| #### Scenario: Integrator looks up record properties | ||
|
|
||
| - **WHEN** a developer reads Records API intro | ||
| - **THEN** they see `gps_device_capture` listed with type object and a short description of known keys (`device_name`, `manufacturer`, `fix_type`, `satellite_count`, `hdop`, `vdop`, `pdop`, `geometry`) | ||
|
|
||
| ### Requirement: Request and response examples include GPS metadata | ||
|
|
||
| Create/update request examples and get-record response examples SHALL include a `gps_device_capture` object with device-dependent keys and nested GeoJSON `geometry`. | ||
|
|
||
| #### Scenario: Create record example includes GPS capture | ||
|
|
||
| - **WHEN** a developer copies the create-record example | ||
| - **THEN** the JSON includes `gps_device_capture` with at least `device_name`, `manufacturer`, `fix_type`, `satellite_count`, `hdop`, and `geometry` | ||
|
|
||
| ### Requirement: Query API documents JSONB filtering | ||
|
|
||
| The Query API form system-columns table SHALL include `_gps_device_capture` (jsonb). Docs SHALL include SQL examples that filter on inner keys with `->>` and `@>`. | ||
|
|
||
| #### Scenario: Query records by device name | ||
|
|
||
| - **WHEN** a developer wants records from a Trimble R2 | ||
| - **THEN** docs show `WHERE _gps_device_capture->>'device_name' = 'Trimble R2'` | ||
|
|
||
| #### Scenario: Query records by fix type containment | ||
|
|
||
| - **WHEN** a developer wants RTK fixes | ||
| - **THEN** docs show `WHERE _gps_device_capture @> '{"fix_type": "RTK"}'` | ||
|
|
||
| ### Requirement: change-geometry documents added event data | ||
|
|
||
| Data Events `change-geometry` docs SHALL keep `event.value` as the GeoJSON geometry and SHALL document optional top-level `event.gpsData` (sibling of `value`) when external GPS metadata is available. Docs SHALL NOT invent a canonical key list inside `gpsData`. | ||
|
|
||
| Verified: Android `GeometryChangeEventHelper`; iOS `NMEALocationEventPayload` event destination. Gaps: `fulcrum-core` has no Data Events payload; `fulcrum-expressions` `GeometryEvent` does not declare `gpsData`; iOS camelCase vs Android snake_case keys. | ||
|
|
||
| #### Scenario: Developer handles geometry changes | ||
|
|
||
| - **WHEN** a developer reads `change-geometry` in the Data Events reference or `ON` docs | ||
| - **THEN** they still see `ON('change-geometry', callback)` | ||
| - **AND** they learn that `event.value` is the geometry and `event.gpsData` may be present | ||
| - **AND** they are pointed to record `gps_device_capture` for persisted snake_case metadata | ||
|
|
||
| ### Requirement: OpenAPI schema is not rewritten | ||
|
|
||
| This change SHALL NOT remove or rename `GpsDeviceCaptureBase` / `GpsDeviceCaptureRequest`. It SHALL NOT document `geometry_matches_capture`. |
9 changes: 9 additions & 0 deletions
9
openspec/changes/archive/2026-09-01-document-gps-device-capture/tasks.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Tasks | ||
|
|
||
| - [x] 1. OpenSpec artifacts for `document-gps-device-capture` | ||
| - [x] 2. Add `gps_device_capture` to Records intro properties table | ||
| - [x] 3. Add GPS payload to create/update/partial-update library examples | ||
| - [x] 4. Add GPS payload to OpenAPI get/create/update examples | ||
| - [x] 5. Add `_gps_device_capture` Query API column and JSONB examples | ||
| - [x] 6. Update `change-geometry` Data Events docs with verified `gpsData` only | ||
| - [x] 7. Validate `reference/rest-api.json` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.