er-smart-sync 0.3.2__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/PKG-INFO +2 -2
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/USAGE.md +43 -8
- er_smart_sync-0.4.0/docs/changelog.md +144 -0
- er_smart_sync-0.4.0/docs/cli-reference/copy-event-type.md +43 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/cli-reference/overview.md +1 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/concepts/choices.md +77 -18
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/concepts/event-type-version.md +1 -1
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/getting-started/config.md +2 -2
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/getting-started/first-run.md +1 -1
- er_smart_sync-0.4.0/docs/superpowers/specs/2026-09-25-smartconnect-configid-risks.md +108 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/troubleshooting.md +2 -2
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/workflows/inspect-datamodel.md +5 -3
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/workflows/populate-choices.md +2 -2
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/mkdocs.yml +1 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/pyproject.toml +1 -1
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/_version.py +3 -3
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/choices.py +110 -139
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/cli.py +22 -5
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/config.py +29 -1
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/smart_to_er.py +19 -3
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/smart_to_er_v2.py +27 -22
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync.egg-info/PKG-INFO +2 -2
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync.egg-info/SOURCES.txt +2 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync.egg-info/requires.txt +1 -1
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync.egg-info/scm_file_list.json +71 -69
- er_smart_sync-0.4.0/src/er_smart_sync.egg-info/scm_version.json +8 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/tests/test_choices.py +258 -20
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/tests/test_config.py +33 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/tests/test_smart_to_er.py +91 -2
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/tests/test_smart_to_er_v2.py +78 -24
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/uv.lock +6 -6
- er_smart_sync-0.3.2/docs/changelog.md +0 -7
- er_smart_sync-0.3.2/src/er_smart_sync.egg-info/scm_version.json +0 -8
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/.github/workflows/docs.yml +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/.github/workflows/release.yml +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/.gitignore +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/.python-version +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/.vscode/launch.json +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/.vscode/settings.json +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/AGENTS.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/CLAUDE.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/LICENSE +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/README.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/cli-reference/choices.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/cli-reference/config-template.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/cli-reference/datamodel.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/cli-reference/events.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/cli-reference/inspect-datamodel.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/cli-reference/list-cas.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/cli-reference/patrols.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/cli-reference/validate-config.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/concepts/ca-identifier.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/concepts/cm-variants.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/getting-started/install.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/images/.gitkeep +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/images/README.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/images/er-event-category-list.png +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/images/er-event-type-form-v2.png +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/images/er-event-type-with-choices.png +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/images/smart-ca-label-bracketed.png +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/index.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/plans/2026-05-13-er-v2-builder-rewrite.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/plans/2026-05-13-er-v2-choices-population.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/plans/2026-05-15-mkdocs-docs-site.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/plans/2026-05-27-cm-variant-event-types.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/plans/2026-06-10-er-to-er-event-type-copy.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/plans/archive/2026-05-12-er-v2-event-types-INCORRECT.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/specs/2026-05-12-er-v2-event-types-design.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/specs/2026-05-13-er-v2-choices-population-design.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/specs/2026-05-26-cm-variant-event-types-design.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/specs/2026-06-10-er-to-er-event-type-copy-design.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/superpowers/specs/archive/2026-05-12-er-v2-event-types-design-INCORRECT.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/workflows/push-datamodel.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/workflows/sync-events.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/docs/workflows/sync-patrols.md +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/setup.cfg +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/cdip_connector/__init__.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/cdip_connector/core/__init__.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/cdip_connector/core/schemas.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/__init__.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/defaults.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/er_to_er.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/protocols.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/state.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/synchronizer.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync/utils.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync.egg-info/dependency_links.txt +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync.egg-info/entry_points.txt +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/src/er_smart_sync.egg-info/top_level.txt +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/tests/__init__.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/tests/conftest.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/tests/test_cli.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/tests/test_er_to_er.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/tests/test_synchronizer.py +0 -0
- {er_smart_sync-0.3.2 → er_smart_sync-0.4.0}/tests/test_utils.py +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: er-smart-sync
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Synchronize SMART Connect data models, events, and patrols with EarthRanger
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Requires-Python: >=3.10
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Requires-Dist: earthranger-client
|
|
10
|
-
Requires-Dist: smartconnect-client<2.0,>=1.
|
|
10
|
+
Requires-Dist: smartconnect-client<2.0,>=1.14.0
|
|
11
11
|
Requires-Dist: gundi-core>=1.11.0
|
|
12
12
|
Requires-Dist: pydantic<2.0,>=1.10
|
|
13
13
|
Requires-Dist: packaging
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
- **`datamodel`** — push SMART conservation-area data models into EarthRanger as event categories and event types.
|
|
6
6
|
- **`events`** — poll EarthRanger events and publish them for routing to SMART.
|
|
7
7
|
- **`patrols`** — poll EarthRanger patrols (with track points, segment events, and attached files) and publish them for routing to SMART.
|
|
8
|
+
- **`copy-event-type`** — copy one event type (and, for v2, the choice lists its schema references) from one EarthRanger site to another.
|
|
8
9
|
- **`validate-config`**, **`list-cas`**, **`inspect-datamodel`** — read-only diagnostic commands intended for support work.
|
|
9
10
|
|
|
10
11
|
## Install
|
|
@@ -46,13 +47,24 @@ smart:
|
|
|
46
47
|
|
|
47
48
|
earthranger:
|
|
48
49
|
id: my-er-instance # opaque, used as the state-tracking key
|
|
49
|
-
endpoint: https://site.pamdas.org/api/v1.0
|
|
50
|
+
endpoint: site.pamdas.org # or https://site.pamdas.org, or the full /api/v1.0 root
|
|
50
51
|
token: er-api-token # or use login + password
|
|
51
52
|
client_id: das_web_client # optional, defaults to das_web_client
|
|
52
53
|
```
|
|
53
54
|
|
|
54
55
|
EarthRanger auth accepts either `--er-token` **or** the `--er-username`/`--er-password` pair. Token alone is preferred.
|
|
55
56
|
|
|
57
|
+
The EarthRanger endpoint accepts any of these forms — all normalize to the
|
|
58
|
+
full `https://site.pamdas.org/api/v1.0` service root:
|
|
59
|
+
|
|
60
|
+
- `site.pamdas.org` (bare domain)
|
|
61
|
+
- `https://site.pamdas.org` (scheme + host)
|
|
62
|
+
- `https://site.pamdas.org/api/v1.0` (full service root, as before)
|
|
63
|
+
|
|
64
|
+
An explicit `http://` scheme is preserved for development servers. The same
|
|
65
|
+
forms work for `--er-endpoint`, the YAML `earthranger.endpoint` key, and
|
|
66
|
+
`copy-event-type`'s `--source-endpoint`/`--dest-endpoint`.
|
|
67
|
+
|
|
56
68
|
## Global flags
|
|
57
69
|
|
|
58
70
|
```
|
|
@@ -89,7 +101,7 @@ er-smart-sync datamodel \
|
|
|
89
101
|
--smart-password SMART-PASS \
|
|
90
102
|
--smart-version 7.5.7 \
|
|
91
103
|
--smart-ca-uuid 0a1b2c3d-... \
|
|
92
|
-
--er-endpoint
|
|
104
|
+
--er-endpoint site.pamdas.org \
|
|
93
105
|
--er-token YOUR-ER-TOKEN
|
|
94
106
|
```
|
|
95
107
|
|
|
@@ -118,7 +130,7 @@ This:
|
|
|
118
130
|
er-smart-sync datamodel \
|
|
119
131
|
--from-file datamodel.xml \
|
|
120
132
|
--ca-label "[FOASF]" \
|
|
121
|
-
--er-endpoint
|
|
133
|
+
--er-endpoint site.pamdas.org \
|
|
122
134
|
--er-token YOUR-ER-TOKEN
|
|
123
135
|
```
|
|
124
136
|
|
|
@@ -133,7 +145,7 @@ er-smart-sync datamodel \
|
|
|
133
145
|
--from-file datamodel.xml \
|
|
134
146
|
--cm-from-file configurable_model.xml \
|
|
135
147
|
--ca-label "[FOASF]" \
|
|
136
|
-
--er-endpoint
|
|
148
|
+
--er-endpoint site.pamdas.org \
|
|
137
149
|
--er-token YOUR-ER-TOKEN
|
|
138
150
|
```
|
|
139
151
|
|
|
@@ -218,7 +230,7 @@ discriminator field and conditional sections. This flag is v2 only.
|
|
|
218
230
|
|
|
219
231
|
```bash
|
|
220
232
|
er-smart-sync datamodel --cm-from-file cm.xml --cm-variant-mode consolidate \
|
|
221
|
-
--er-endpoint
|
|
233
|
+
--er-endpoint site.pamdas.org --er-token YOUR-ER-TOKEN
|
|
222
234
|
```
|
|
223
235
|
|
|
224
236
|
See [CM variant groups](docs/concepts/cm-variants.md) for slug formats,
|
|
@@ -255,7 +267,7 @@ separately and want to push event types without re-upserting.
|
|
|
255
267
|
|
|
256
268
|
```bash
|
|
257
269
|
er-smart-sync events \
|
|
258
|
-
--er-endpoint
|
|
270
|
+
--er-endpoint site.pamdas.org \
|
|
259
271
|
--er-token YOUR-ER-TOKEN \
|
|
260
272
|
--topic projects/my-gcp-project/topics/er-events \
|
|
261
273
|
--state-file /var/lib/er-smart-sync/state.json
|
|
@@ -280,7 +292,7 @@ What happens:
|
|
|
280
292
|
|
|
281
293
|
```bash
|
|
282
294
|
er-smart-sync patrols \
|
|
283
|
-
--er-endpoint
|
|
295
|
+
--er-endpoint site.pamdas.org \
|
|
284
296
|
--er-token YOUR-ER-TOKEN \
|
|
285
297
|
--topic projects/my-gcp-project/topics/er-patrols \
|
|
286
298
|
--state-file /var/lib/er-smart-sync/state.json
|
|
@@ -306,6 +318,29 @@ Behavior:
|
|
|
306
318
|
|
|
307
319
|
---
|
|
308
320
|
|
|
321
|
+
## Copying an event type between ER sites
|
|
322
|
+
|
|
323
|
+
`copy-event-type` copies a single event type from a source EarthRanger site
|
|
324
|
+
to a destination site — for v2, it also copies the choice option-sets the
|
|
325
|
+
schema references. The target event category must already exist on the
|
|
326
|
+
destination.
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
er-smart-sync copy-event-type \
|
|
330
|
+
--source-endpoint source-site.pamdas.org --source-token SOURCE-TOKEN \
|
|
331
|
+
--dest-endpoint dest-site.pamdas.org --dest-token DEST-TOKEN \
|
|
332
|
+
--event-type-value jkperu_incidents_caza_furtiva \
|
|
333
|
+
--target-event-category monitoring \
|
|
334
|
+
--version v2
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
- Auth per side: `--source-token` or `--source-username`/`--source-password`
|
|
338
|
+
(same for `--dest-*`).
|
|
339
|
+
- `--version v1|v2` selects the event-type API used on both sites
|
|
340
|
+
(default `v2`).
|
|
341
|
+
- Honors the global `--dry-run` flag: reads from the source, logs what it
|
|
342
|
+
would write to the destination.
|
|
343
|
+
|
|
309
344
|
## Diagnostic commands
|
|
310
345
|
|
|
311
346
|
These are read-only and never write to EarthRanger.
|
|
@@ -345,7 +380,7 @@ er-smart-sync inspect-datamodel \
|
|
|
345
380
|
--from-file datamodel.xml \
|
|
346
381
|
--cm-from-file configurable_model.xml \
|
|
347
382
|
--ca-label "[FOASF]" \
|
|
348
|
-
--er-endpoint
|
|
383
|
+
--er-endpoint site.pamdas.org \
|
|
349
384
|
--er-token YOUR-ER-TOKEN
|
|
350
385
|
```
|
|
351
386
|
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Notable changes by version. Every release is also published to
|
|
4
|
+
[PyPI](https://pypi.org/project/er-smart-sync/) and tagged on
|
|
5
|
+
[GitHub Releases](https://github.com/PADAS/earthranger-smart-utils/releases),
|
|
6
|
+
which carry the full commit-level history.
|
|
7
|
+
|
|
8
|
+
## 0.4.0 — 2026-09-28
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
**Leaf categories that re-declare an inherited attribute no longer produce
|
|
13
|
+
rejected event types.** SMART lets a leaf category override an attribute it
|
|
14
|
+
inherits from a parent (commonly `isactive="false"` to disable it per
|
|
15
|
+
leaf). Both builders concatenated the leaf's own attributes with the
|
|
16
|
+
inherited ones, so the attribute appeared twice — ER rejected every such v2
|
|
17
|
+
event type with `Invalid JSON Schema: ... has non-unique elements at
|
|
18
|
+
ui.sections.section-1.leftColumn`, and the inherited active entry clobbered
|
|
19
|
+
the leaf's disable-override. First declaration (the leaf's own) now wins in
|
|
20
|
+
both the v2 and v1 builders.
|
|
21
|
+
|
|
22
|
+
**TREE attributes migrate identically from the base datamodel and a
|
|
23
|
+
Configurable Model (ERCS-8246).** The CM path previously surfaced only
|
|
24
|
+
top-level parent nodes — dropping every nested child option — while the
|
|
25
|
+
base path surfaced leaves only. smartconnect-client ≥ 1.13.0 flattens CM
|
|
26
|
+
tree curations to CM-leaves keyed by the same dotted paths as base-DM
|
|
27
|
+
options, and emits effective active flags (a leaf under a deactivated
|
|
28
|
+
branch arrives inactive). It also fixes MLIST attributes losing their
|
|
29
|
+
options entirely in file-based datamodel parses. The smartconnect-client
|
|
30
|
+
pin is now `>=1.14.0`, activating the converged behavior.
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
**The EarthRanger endpoint accepts a bare domain or scheme + host.**
|
|
35
|
+
`site.pamdas.org`, `https://site.pamdas.org`, and the full
|
|
36
|
+
`https://site.pamdas.org/api/v1.0` service root all normalize to the
|
|
37
|
+
service-root form, everywhere an ER endpoint is accepted: the YAML
|
|
38
|
+
`earthranger.endpoint` key, `--er-endpoint`, and `copy-event-type`'s
|
|
39
|
+
`--source-endpoint`/`--dest-endpoint`. An explicit `http://` scheme is
|
|
40
|
+
preserved for development servers.
|
|
41
|
+
|
|
42
|
+
**`copy-event-type` is now documented** — in the
|
|
43
|
+
[CLI reference](cli-reference/copy-event-type.md) and USAGE.md; the
|
|
44
|
+
command itself shipped earlier (#12).
|
|
45
|
+
|
|
46
|
+
## 0.3.3 — 2026-09-25
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
**Choice lists are now shared across the event types of a datamodel sync.**
|
|
51
|
+
Previously every event type got its own copy of each dropdown's Choice
|
|
52
|
+
records, even when the SMART data model defined one option list used by many
|
|
53
|
+
categories — a large CA could create thousands of duplicate Choice rows.
|
|
54
|
+
Choice `field` names now hash the (CA, CM) scope plus the attribute key
|
|
55
|
+
instead of the event-type value (`dm{8-hex}_{attr_key}` replacing
|
|
56
|
+
`et{8-hex}_{attr_key}`), so all event types built from one datamodel
|
|
57
|
+
reference a single list per attribute.
|
|
58
|
+
|
|
59
|
+
Sharing is deliberately bounded to one CA and one Configurable Model:
|
|
60
|
+
different CAs can define the same attribute key with different options, and
|
|
61
|
+
each CM curates its own option subsets, so neither shares lists with the
|
|
62
|
+
other. The consolidate-mode variant discriminator remains per-event-type.
|
|
63
|
+
|
|
64
|
+
Re-syncing an existing site re-points event-type schemas at the shared
|
|
65
|
+
lists and leaves the legacy `et*_` Choice records in place (active but
|
|
66
|
+
unreferenced); historical events are unaffected because stored option
|
|
67
|
+
values are identical under both naming schemes. See
|
|
68
|
+
[Concept: ER Choice records](concepts/choices.md#how-field-names-are-derived).
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
|
|
72
|
+
**Inactive SMART options no longer migrate as active (ERCS-8246).** The
|
|
73
|
+
v2 choices builder hardcoded `is_active=true` on the base-datamodel path,
|
|
74
|
+
so options deactivated in SMART arrived active in EarthRanger (366 of 470
|
|
75
|
+
species options on one reported migration). Choices now carry the SMART
|
|
76
|
+
active flag; existing ER records are deactivated in place on the next
|
|
77
|
+
sync. The v1 builder excludes inactive options from its inline enums,
|
|
78
|
+
mirroring what its CM path already did.
|
|
79
|
+
|
|
80
|
+
## 0.3.2 — 2026-08-05
|
|
81
|
+
|
|
82
|
+
### Fixed
|
|
83
|
+
|
|
84
|
+
**`smart.use_language_code` is now honored by file-based syncs.**
|
|
85
|
+
`datamodel --from-file`, `choices`, and `inspect-datamodel` built their SMART
|
|
86
|
+
XML parsers from the `--smart-language` flag, whose default was `en`, and never
|
|
87
|
+
read the value loaded from `--config`. Setting `use_language_code: es` in the
|
|
88
|
+
config had no effect on those commands, so a data model carrying no English
|
|
89
|
+
labels resolved every display name to the literal string `n/a` — and the sync
|
|
90
|
+
pushed those to EarthRanger as if they were real names. `--smart-language` now
|
|
91
|
+
overrides the config only when you pass it explicitly.
|
|
92
|
+
([#13](https://github.com/PADAS/earthranger-smart-utils/issues/13))
|
|
93
|
+
|
|
94
|
+
If a site was already populated with `n/a` labels, no manual cleanup is needed:
|
|
95
|
+
re-run with the correct language and the existing records are corrected in
|
|
96
|
+
place. Event types and choices are both compared on `display` and patched when
|
|
97
|
+
it differs.
|
|
98
|
+
|
|
99
|
+
**`--smart-version` is no longer ignored when `--config` is used.** The flag
|
|
100
|
+
carried a `7.0` default, so an explicitly passed value was indistinguishable
|
|
101
|
+
from an absent one, and the config loader never applied it on top of a config
|
|
102
|
+
read from file — `smart.version` from the YAML always won and the flag was
|
|
103
|
+
silently discarded. This is the mirror image of the `use_language_code` bug
|
|
104
|
+
above, where the flag won and the config value was dropped; both trace back to
|
|
105
|
+
the same root, a flag default that hid whether the user had passed anything.
|
|
106
|
+
|
|
107
|
+
The version one affected behavior rather than presentation: SMART versions
|
|
108
|
+
below 7.5.3 need `smart_observation_uuid` patched onto outgoing events, so a
|
|
109
|
+
silently discarded `--smart-version` could change what the sync actually sent.
|
|
110
|
+
|
|
111
|
+
### Added
|
|
112
|
+
|
|
113
|
+
**Data-model syncs warn when no display name resolves.** SMART substitutes the
|
|
114
|
+
literal `n/a` whenever no `<names>` entry matches the requested language; it
|
|
115
|
+
does not raise or warn, so an unmatched language code produced a complete,
|
|
116
|
+
valid-looking data model with every label set to `n/a`. `datamodel`, `choices`,
|
|
117
|
+
and `inspect-datamodel` now detect that and name the codes the model actually
|
|
118
|
+
declares:
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
WARNING: All 645 SMART display names resolved to "n/a": the data model has no
|
|
122
|
+
labels in language 'en'. Available language code(s): es. Set
|
|
123
|
+
smart.use_language_code in your config (or pass --smart-language) to one of
|
|
124
|
+
these and re-run.
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The warning requires a *wholesale* failure. A single untranslated label is
|
|
128
|
+
normal SMART data and stays silent.
|
|
129
|
+
|
|
130
|
+
### Documentation
|
|
131
|
+
|
|
132
|
+
- [Configuration](getting-started/config.md) gained a
|
|
133
|
+
[Display names and languages](getting-started/config.md#display-names-and-languages)
|
|
134
|
+
section covering how to read the `<languages>` block in a data-model XML
|
|
135
|
+
before the first run.
|
|
136
|
+
- `--smart-language` and `--smart-version` help text now states the actual
|
|
137
|
+
precedence: the flag overrides `--config`, and the built-in default applies
|
|
138
|
+
only when neither is set.
|
|
139
|
+
|
|
140
|
+
## Earlier releases
|
|
141
|
+
|
|
142
|
+
`v0.3.1` and earlier predate this file. See
|
|
143
|
+
[GitHub Releases](https://github.com/PADAS/earthranger-smart-utils/releases)
|
|
144
|
+
for their notes.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# `copy-event-type`
|
|
2
|
+
|
|
3
|
+
Copy one event type from a source EarthRanger site to a destination site.
|
|
4
|
+
For v2 event types, the choice option-sets the schema references are copied
|
|
5
|
+
too. The target event category must already exist on the destination.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
er-smart-sync copy-event-type \
|
|
9
|
+
--source-endpoint source-site.pamdas.org --source-token SOURCE-TOKEN \
|
|
10
|
+
--dest-endpoint dest-site.pamdas.org --dest-token DEST-TOKEN \
|
|
11
|
+
--event-type-value jkperu_incidents_caza_furtiva \
|
|
12
|
+
--target-event-category monitoring \
|
|
13
|
+
--version v2
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Options
|
|
17
|
+
|
|
18
|
+
| Option | Required | What it does |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| `--source-endpoint` | yes | Source ER site — bare domain, scheme + host, or full `/api/v1.0` root |
|
|
21
|
+
| `--source-token` / `--source-username` + `--source-password` | one of | Source auth (token preferred) |
|
|
22
|
+
| `--dest-endpoint` | yes | Destination ER site — same accepted forms |
|
|
23
|
+
| `--dest-token` / `--dest-username` + `--dest-password` | one of | Destination auth |
|
|
24
|
+
| `--event-type-value` | yes | `value` of the event type to copy from the source |
|
|
25
|
+
| `--target-event-category` | yes | `value` of the destination event category to attach the copy to (must already exist) |
|
|
26
|
+
| `--version v1\|v2` | no | Event-type API version used on both sites. Default `v2` |
|
|
27
|
+
|
|
28
|
+
## Behavior
|
|
29
|
+
|
|
30
|
+
- **v2**: reads the source event type's schema, extracts every
|
|
31
|
+
`choices.json?field=...` `$ref`, copies those Choice records to the
|
|
32
|
+
destination, then creates the event type attached to
|
|
33
|
+
`--target-event-category`.
|
|
34
|
+
- **v1**: copies the event type with its inline schema as-is.
|
|
35
|
+
- Honors the global `--dry-run` flag — reads from the source, logs the
|
|
36
|
+
writes it would send to the destination.
|
|
37
|
+
|
|
38
|
+
## Failure modes
|
|
39
|
+
|
|
40
|
+
| Error | Meaning |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `EventTypeNotFound` | No event type with `--event-type-value` on the source |
|
|
43
|
+
| `TargetCategoryMissing` | `--target-event-category` doesn't exist on the destination — create it there first |
|
|
@@ -24,6 +24,7 @@ er-smart-sync [GLOBAL FLAGS] <subcommand> [SUBCOMMAND FLAGS]
|
|
|
24
24
|
| [`inspect-datamodel`](inspect-datamodel.md) | Preview what `datamodel` would push, without making writes. |
|
|
25
25
|
| [`events`](events.md) | Poll events from EarthRanger and publish them via the message broker. |
|
|
26
26
|
| [`patrols`](patrols.md) | Poll patrols from EarthRanger and publish them via the message broker. |
|
|
27
|
+
| [`copy-event-type`](copy-event-type.md) | Copy one event type (and its v2 choice lists) from one ER site to another. |
|
|
27
28
|
| [`validate-config`](validate-config.md) | Check that SMART and EarthRanger credentials work. |
|
|
28
29
|
| [`list-cas`](list-cas.md) | List the conservation areas available on a SMART server. |
|
|
29
30
|
| [`config-template`](config-template.md) | Print a fully-commented YAML config template. |
|
|
@@ -17,7 +17,7 @@ each option is a row:
|
|
|
17
17
|
{
|
|
18
18
|
"id": "<uuid>",
|
|
19
19
|
"model": "activity.event",
|
|
20
|
-
"field": "
|
|
20
|
+
"field": "dm5e6b96f4_sector",
|
|
21
21
|
"value": "jk001",
|
|
22
22
|
"display": "Sector JK001",
|
|
23
23
|
"ordernum": 0,
|
|
@@ -41,23 +41,57 @@ duplicate options for the same dropdown collide.
|
|
|
41
41
|
|
|
42
42
|
## How `field` names are derived
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
Choice lists are **shared across the event types built from one datamodel
|
|
45
|
+
sync**. For every choice-bearing SMART attribute, we derive a single stable
|
|
46
|
+
`field` name:
|
|
46
47
|
|
|
47
48
|
```
|
|
48
|
-
|
|
49
|
+
dm{8-hex}_{attr_key}
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
The 8 hex chars are `sha256(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
The 8 hex chars are `sha256("{scope_key}:{attr_key}")[:8]`, where the scope
|
|
53
|
+
key is the CA UUID (or `{ca_uuid}_{cm_uuid}` when syncing a Configurable
|
|
54
|
+
Model). The attribute key is sanitized to `^\w+$`. The total is capped at 40
|
|
55
|
+
characters (ER's column limit); including the attribute key in the hash
|
|
56
|
+
keeps two long keys distinct even when the cap truncates their readable
|
|
57
|
+
suffixes to a shared prefix.
|
|
58
|
+
|
|
59
|
+
This mirrors SMART's own data model: options belong to the DM-level
|
|
60
|
+
attribute, not to the category, so every category that references
|
|
61
|
+
`signo_de_caza` sees the same option list — and in ER, every event type
|
|
62
|
+
built from that datamodel references the same Choice records.
|
|
63
|
+
|
|
64
|
+
The scope hash keeps sharing bounded:
|
|
65
|
+
|
|
66
|
+
- **Not across CAs.** Two conservation areas can define the same attribute
|
|
67
|
+
key with different options; their field names differ by CA UUID.
|
|
68
|
+
- **Not across CMs.** A Configurable Model curates its own option subsets
|
|
69
|
+
(filter, reorder, deactivate), so each CM's lists are scoped by CM UUID
|
|
70
|
+
— including apart from the plain-DM lists of the same CA.
|
|
71
|
+
|
|
72
|
+
One exception stays per-event-type: the consolidate-mode **variant
|
|
73
|
+
discriminator** (`et{8-hex}_variant`) — its options *are* the variant
|
|
74
|
+
identities of one event type, so there is nothing to share.
|
|
75
|
+
|
|
76
|
+
!!! note "Legacy `et*_` fields"
|
|
77
|
+
Before choice sharing, every event type got its own copy of each list,
|
|
78
|
+
named `et{8-hex}_{attr_key}` with the hash over the event-type value.
|
|
79
|
+
Re-syncing a site created under that scheme re-points the event-type
|
|
80
|
+
schemas at the shared `dm*_` lists and leaves the old `et*_` lists in
|
|
81
|
+
place (active but unreferenced). Historical events are unaffected —
|
|
82
|
+
stored option **values** are identical under both schemes — and the
|
|
83
|
+
orphaned lists can be cleaned up manually if desired.
|
|
84
|
+
|
|
85
|
+
!!! warning "Per-node CM curation is collapsed"
|
|
86
|
+
SMART allows a CM to curate the *same* attribute differently per node
|
|
87
|
+
(multiple `attributeConfig` entries for one `attributeKey`, referenced
|
|
88
|
+
via each node's `configId`). The smartconnect parser currently flattens
|
|
89
|
+
these to one config per key (first wins), so the sync — with or without
|
|
90
|
+
sharing — uploads a single option list per attribute per CM. Lifting
|
|
91
|
+
this requires smartconnect to expose the config identity; until then,
|
|
92
|
+
per-node curations of the same attribute are collapsed. The risks and
|
|
93
|
+
rollout order for that library change are captured in
|
|
94
|
+
[the smartconnect configId risk assessment](https://github.com/PADAS/earthranger-smart-utils/blob/main/docs/superpowers/specs/2026-09-25-smartconnect-configid-risks.md).
|
|
61
95
|
|
|
62
96
|
## How `value` is derived
|
|
63
97
|
|
|
@@ -183,7 +217,7 @@ In a v2 event-type schema, choice fields look like:
|
|
|
183
217
|
"items": {
|
|
184
218
|
"type": "string",
|
|
185
219
|
"anyOf": [
|
|
186
|
-
{"$ref": "/api/v2.0/schemas/choices.json?field=
|
|
220
|
+
{"$ref": "/api/v2.0/schemas/choices.json?field=dm5e6b96f4_signo_de_caza"}
|
|
187
221
|
]
|
|
188
222
|
}
|
|
189
223
|
}
|
|
@@ -235,6 +269,16 @@ SMART TREE attributes have parent/child option hierarchies (e.g. `africa →
|
|
|
235
269
|
africa.kenya → africa.kenya.nairobi`). `er-smart-sync` **flattens to leaves**
|
|
236
270
|
— only the deepest options become Choice records.
|
|
237
271
|
|
|
272
|
+
Both migration paths converge on that shape (ERCS-8246): the base data
|
|
273
|
+
model flattens to leaves here, and CM `attributeConfig` tree curations are
|
|
274
|
+
flattened to CM-leaves by the smartconnect parser (≥ 1.13.0), keyed by the
|
|
275
|
+
same dotted paths so the [CM overlay rules](#cm-overlay-rules) apply
|
|
276
|
+
unchanged. Each option's SMART active flag is honored **effectively**: a
|
|
277
|
+
leaf under a deactivated branch arrives with `is_active=false`. The
|
|
278
|
+
`smartconnect-client>=1.13.0` pin guarantees this parsing; older releases
|
|
279
|
+
surfaced only top-level parents for CM tree curations and dropped the
|
|
280
|
+
active flag for DM tree options.
|
|
281
|
+
|
|
238
282
|
Two practical consequences for TREE attributes:
|
|
239
283
|
|
|
240
284
|
- The flattened leaf's SMART `key` is the full dotted path
|
|
@@ -246,9 +290,24 @@ Two practical consequences for TREE attributes:
|
|
|
246
290
|
[`display` shortening](#how-display-is-derived) handles via the
|
|
247
291
|
last-segment rule.
|
|
248
292
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
293
|
+
!!! note "Decision (2026-09-28): the flat dropdown stays as-is"
|
|
294
|
+
In ER, a TREE attribute renders as a flat dropdown — SMART's hierarchy
|
|
295
|
+
(e.g. *Birds → Philippine Hawk-eagle*) is not shown, though the
|
|
296
|
+
depth-first option order is preserved via `ordernum`. We evaluated the
|
|
297
|
+
interim options and decided to leave it flat:
|
|
298
|
+
|
|
299
|
+
- **`Choice.sub_choice_of`** exists in ER's data model but is consumed
|
|
300
|
+
only by the Django-side choices machinery (admin optgroups); the
|
|
301
|
+
event-form renderer (das-web-react) never reads it, so populating it
|
|
302
|
+
from the sync would change nothing in the form.
|
|
303
|
+
- **Hierarchy-prefixed display labels** (`Birds › Philippine
|
|
304
|
+
Hawk-eagle …`) would make the flat list legible but eat into the
|
|
305
|
+
100-char display cap and leak the prefix into every place ER shows
|
|
306
|
+
the selected value (event details, feed, exports).
|
|
307
|
+
|
|
308
|
+
Real hierarchical dropdowns in the event form are core EarthRanger
|
|
309
|
+
work, tracked as **ERA-14005** (see also ERCS-8246, which requested
|
|
310
|
+
them). Revisit this decision when that lands.
|
|
252
311
|
|
|
253
312
|
## Related
|
|
254
313
|
|
|
@@ -63,7 +63,7 @@ For every event type, `er-smart-sync` emits a meta-schema-valid v2 schema:
|
|
|
63
63
|
"uniqueItems": true,
|
|
64
64
|
"items": {
|
|
65
65
|
"type": "string",
|
|
66
|
-
"anyOf": [{"$ref": "/api/v2.0/schemas/choices.json?field=
|
|
66
|
+
"anyOf": [{"$ref": "/api/v2.0/schemas/choices.json?field=dm5e6b96f4_sector"}]
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
},
|
|
@@ -27,7 +27,7 @@ smart:
|
|
|
27
27
|
|
|
28
28
|
earthranger:
|
|
29
29
|
id: my-tenant
|
|
30
|
-
endpoint:
|
|
30
|
+
endpoint: your-tenant.pamdas.org
|
|
31
31
|
token: ""
|
|
32
32
|
login: ""
|
|
33
33
|
password: ""
|
|
@@ -55,7 +55,7 @@ earthranger:
|
|
|
55
55
|
| Field | Required? | Notes |
|
|
56
56
|
|---|---|---|
|
|
57
57
|
| `id` | required | Any string — used as a state-store key |
|
|
58
|
-
| `endpoint` | required | EarthRanger
|
|
58
|
+
| `endpoint` | required | EarthRanger site: a bare domain (`site.pamdas.org`), scheme + host, or the full `.../api/v1.0` service root — all normalize to the service root |
|
|
59
59
|
| `token` | one of token / login+password | Preferred for service accounts |
|
|
60
60
|
| `login` + `password` | one of token / login+password | Falls back to OAuth |
|
|
61
61
|
| `client_id` | optional (default `das_web_client`) | OAuth client for password auth |
|
|
@@ -21,7 +21,7 @@ At minimum, set the `earthranger:` section:
|
|
|
21
21
|
```yaml
|
|
22
22
|
earthranger:
|
|
23
23
|
id: my-tenant # any identifier; used for state tracking
|
|
24
|
-
endpoint:
|
|
24
|
+
endpoint: your-tenant.pamdas.org
|
|
25
25
|
token: "<your token>" # OR provide login + password
|
|
26
26
|
```
|
|
27
27
|
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Risk assessment: exposing CM attributeConfig identity in smartconnect-client
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-09-25
|
|
4
|
+
**Status:** Risks accepted — proceed when scheduled
|
|
5
|
+
**Context:** Follow-up to shared choice lists (PR #16)
|
|
6
|
+
|
|
7
|
+
## Background
|
|
8
|
+
|
|
9
|
+
Shared choice lists (PR #16) scope `Choice.field` names per (CA, CM) and emit
|
|
10
|
+
one list per SMART attribute key. That is lossy for one SMART feature: a
|
|
11
|
+
Configurable Model can curate the *same* attribute differently per node —
|
|
12
|
+
multiple `<attributeConfig>` elements for one `attributeKey`, each node
|
|
13
|
+
referencing its curation via `configId`. Observed in a real CM
|
|
14
|
+
(Botswana Guardians): `nameofconservancy` has four configs actually in use
|
|
15
|
+
(6 areas / 4 areas / pinned to one area ×2); `otherspecies` has two
|
|
16
|
+
(7 of 15 options active vs 9 of 15).
|
|
17
|
+
|
|
18
|
+
The smartconnect-client parser (`ConfigurableModel.generate_attributes`)
|
|
19
|
+
flattens all configs to `{key, options}` and drops both the config `id` and
|
|
20
|
+
the node-level `configId` linkage, so er-smart-sync — before and after
|
|
21
|
+
choice sharing — collapses every key to its **first** config. Lifting this
|
|
22
|
+
requires smartconnect-client to expose the config identity, then extending
|
|
23
|
+
er-smart-sync's field derivation to it.
|
|
24
|
+
|
|
25
|
+
## Risks
|
|
26
|
+
|
|
27
|
+
### 1. Cached CM dicts (sharpest compatibility edge)
|
|
28
|
+
|
|
29
|
+
Both `SmartClient` and `AsyncSmartClient` round-trip the parsed CM through a
|
|
30
|
+
cache: `export_as_dict()` → JSON → cache, rehydrated later via
|
|
31
|
+
`import_from_dict()` (smartconnect/__init__.py:235–249,
|
|
32
|
+
async_client.py:271–285). After an upgrade, cached blobs written by the old
|
|
33
|
+
version hydrate **without** the new `config_id` keys.
|
|
34
|
+
|
|
35
|
+
- New code must treat the fields as optional, falling back to today's
|
|
36
|
+
first-config-wins behavior, or the first post-deploy runs fail (or
|
|
37
|
+
silently misbehave) until the cache expires.
|
|
38
|
+
- The reverse direction (new blobs, old reader) is safe — extra keys are
|
|
39
|
+
ignored.
|
|
40
|
+
|
|
41
|
+
### 2. `cm["attributes"]` shape is a de-facto public API
|
|
42
|
+
|
|
43
|
+
Duplicate entries per key already occur (one per attributeConfig);
|
|
44
|
+
er-smart-sync's `_options_config_for` takes the first. The safe change is
|
|
45
|
+
**strictly additive**: add `config_id` to each attributes entry and to each
|
|
46
|
+
node attribute dict, change nothing else. Precedent: smartconnect-client
|
|
47
|
+
v1.11.2 "expose CM node id on Category" (PR #37) used exactly this pattern.
|
|
48
|
+
Restructuring (keying by config id, nesting options under nodes) would break
|
|
49
|
+
er-smart-sync's parsing and any consumer we cannot see.
|
|
50
|
+
|
|
51
|
+
### 3. `get_list_options` works partly by accident
|
|
52
|
+
|
|
53
|
+
It iterates `attribute.children` — untangle's built-in list of **all** child
|
|
54
|
+
elements, including `<name>` — and relies on downstream `if not key:
|
|
55
|
+
continue` to discard the resulting `{key: None}` junk. It also does not
|
|
56
|
+
recurse into nested `<treeNode>` hierarchies (21 present in the Botswana
|
|
57
|
+
CM). Any change to this function needs characterization tests against a real
|
|
58
|
+
CM XML first; even without changes, TREE attributeConfigs may already be
|
|
59
|
+
handled incompletely.
|
|
60
|
+
|
|
61
|
+
### 4. Version coordination across consumers
|
|
62
|
+
|
|
63
|
+
- er-smart-sync pins `smartconnect-client>=1.11.2,<2.0`, so a minor release
|
|
64
|
+
(e.g. 1.12.0) flows in on the next resolve — er-smart-sync must tolerate
|
|
65
|
+
both old and new dict shapes when it lands.
|
|
66
|
+
- gundi-smart-dispatcher pins the v1.7.0 wheel and never touches
|
|
67
|
+
`ConfigurableModel`; das-smartconnect-provider shows no CM parsing.
|
|
68
|
+
Unaffected.
|
|
69
|
+
- Consumers not checked out locally are unknown — another reason to stay
|
|
70
|
+
strictly additive.
|
|
71
|
+
- Adding `Optional[str] config_id = None` to the shared Pydantic v1
|
|
72
|
+
`CategoryAttribute` model is safe (shared with the v1 sync path; optional
|
|
73
|
+
extra fields are ignored on both sides).
|
|
74
|
+
|
|
75
|
+
### 5. Field-name stability (the biggest risk, and it lives in er-smart-sync)
|
|
76
|
+
|
|
77
|
+
If the shared field derivation later hashes `config_id`, field names become
|
|
78
|
+
hostage to SMART's `attributeConfig id` UUIDs. **It is unverified whether
|
|
79
|
+
SMART keeps those ids stable** across CM edits, re-publishes, or
|
|
80
|
+
export/import in SMART desktop. If SMART regenerates them, every CM edit
|
|
81
|
+
mints new field names → recurring orphaned choice lists and schema
|
|
82
|
+
re-pointing (vs. the one-time `et*_` → `dm*_` migration).
|
|
83
|
+
|
|
84
|
+
**Must verify before deriving from config ids:** export the same CM twice;
|
|
85
|
+
edit an unrelated node and re-export; compare `attributeConfig id` values.
|
|
86
|
+
|
|
87
|
+
**Hedge:** keep the attr-key-based shared field for the `isDefault="true"`
|
|
88
|
+
config and give only non-default configs distinct fields — bounds any churn
|
|
89
|
+
to attributes an admin actually curated per-node.
|
|
90
|
+
|
|
91
|
+
### 6. Release logistics
|
|
92
|
+
|
|
93
|
+
smartconnect-client ships as wheels on GitHub releases: two repos, two PRs,
|
|
94
|
+
ordered rollout (library release first, then er-smart-sync pin bump +
|
|
95
|
+
derivation change), each with its own review cycle.
|
|
96
|
+
|
|
97
|
+
## Decision
|
|
98
|
+
|
|
99
|
+
Risks accepted (2026-09-25). The primary operator of er-smart-sync is the
|
|
100
|
+
maintainer and can manage the upgrade cases directly — in particular the
|
|
101
|
+
stale-cache window (Risk 1) and the one-time field migration if per-config
|
|
102
|
+
derivation lands (Risk 5). Order of work when picked up:
|
|
103
|
+
|
|
104
|
+
1. Verify `attributeConfig id` stability in SMART (Risk 5 checklist).
|
|
105
|
+
2. smartconnect-client: additive `config_id` exposure + characterization
|
|
106
|
+
tests for `get_list_options` against a real CM XML; minor version bump.
|
|
107
|
+
3. er-smart-sync: pin bump; extend field derivation to config identity
|
|
108
|
+
(default-config hedge unless step 1 proves ids stable).
|
|
@@ -8,7 +8,7 @@ trace or warning above the failure point.
|
|
|
8
8
|
|
|
9
9
|
```
|
|
10
10
|
WARNING: ERClient: Fail attempt 1 of 1: {"field": ["Select a valid choice.
|
|
11
|
-
|
|
11
|
+
dm5e6b96f4_sector is not one of the available choices."]}
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
**Cause:** ER's `/choices/?field=<X>` endpoint validates the `field=` query
|
|
@@ -152,7 +152,7 @@ ERClient: 401 Bad credentials
|
|
|
152
152
|
**Causes (in rough order of likelihood):**
|
|
153
153
|
|
|
154
154
|
1. Wrong or expired `token`.
|
|
155
|
-
2. `endpoint` is
|
|
155
|
+
2. `endpoint` points at the wrong site (a bare domain or scheme+host is fine — the `/api/v1.0` path is added automatically).
|
|
156
156
|
3. Username/password used with the wrong `client_id`.
|
|
157
157
|
|
|
158
158
|
**Diagnose with `validate-config`:**
|
|
@@ -54,7 +54,7 @@ Event types: 18
|
|
|
54
54
|
...
|
|
55
55
|
|
|
56
56
|
Choice sets: 60
|
|
57
|
-
- field:
|
|
57
|
+
- field: dm5e6b96f4_signo_de_caza
|
|
58
58
|
options (4):
|
|
59
59
|
- rastro: Rastro
|
|
60
60
|
- trampa: Trampa
|
|
@@ -62,8 +62,10 @@ Choice sets: 60
|
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
For each choice-bearing field, you'll see the derived `Choice.field` name
|
|
65
|
-
(the `
|
|
66
|
-
EarthRanger `Choice` records.
|
|
65
|
+
(the `dm<hash>_<attr>` part). This is what `datamodel` will POST as
|
|
66
|
+
EarthRanger `Choice` records. Choice lists are shared across the event
|
|
67
|
+
types of a sync, so the choice-set count reflects distinct SMART
|
|
68
|
+
attributes, not (event type × attribute) pairs.
|
|
67
69
|
|
|
68
70
|
## Reading v1 output
|
|
69
71
|
|