Repository navigation
feat: Add Attribute Rules - #32
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces an Attribute Rule toolkit for UTRANS, including Python scripts to deploy/manage ArcGIS attribute rules from .arcade files, a Node/Vitest-based test harness to validate Arcade expressions in CI, and initial Arcade rule scripts plus documentation.
Changes:
- Add Python deploy utilities (
deploy_ar.py,deploy_all_ar.py,new_ar.py) for idempotent / add-only / alter-only attribute rule management. - Add an
attribute-rules/Node workspace with Vitest tests that compile/execute Arcade via@arcgis/corein CI. - Add multiple
.arcadecalculation/constraint rules and update repo docs/editor/CI automation to support the new workflow.
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents attribute-rule scripts, modes, metadata, and enterprise geodatabase deployment guidance |
| attribute-rules/vitest.config.ts | Adds Vitest configuration for Node-based Arcade tests |
| attribute-rules/tsconfig.json | TS config for the attribute-rules test workspace |
| attribute-rules/test/text_calculations.test.ts | Tests text-oriented calculation rules (whitespace/fullname) |
| attribute-rules/test/spatial_calculations.test.ts | Tests spatial calculation rules and datastore contract setup |
| attribute-rules/test/remove_apostrophes_from_name.test.ts | Tests apostrophe removal calculation rule |
| attribute-rules/test/convert_to_null_if_no_value.test.ts | Tests calculation rule that coerces blank text fields to null |
| attribute-rules/test/constrain_to_attribute_domain.test.ts | Tests constraint rule against coded-value domains |
| attribute-rules/test/_helpers.ts | Shared test helpers for loading .arcade and building Arcade executors/features |
| attribute-rules/set_field_defaults.py | New utility to assign ArcGIS field defaults programmatically (dry-run/apply) |
| attribute-rules/new_ar.py | Compatibility wrapper forwarding to deploy script in add-only mode |
| attribute-rules/deploy_ar.py | Core deploy script supporting deploy/add/alter modes with diffing and safeguards |
| attribute-rules/deploy_all_ar.py | Batch deploys all .arcade scripts using per-script metadata headers |
| attribute-rules/constraint/Roads_Edit/constrain_to_attribute_domain.arcade | Adds constraint rule validating coded-value domain compliance |
| attribute-rules/calculation/Roads_Edit/unique_id.arcade | Adds calculation rule generating UNIQUE_ID from spatial/grid context |
| attribute-rules/calculation/Roads_Edit/spatial_assignments.arcade | Adds calculation rule populating multiple spatially-derived attributes |
| attribute-rules/calculation/Roads_Edit/remove_extra_whitespace.arcade | Adds calculation rule trimming/collapsing NAME whitespace |
| attribute-rules/calculation/Roads_Edit/remove_apostrophes_from_name.arcade | Adds calculation rule removing apostrophes from NAME |
| attribute-rules/calculation/Roads_Edit/fullname_calculation.arcade | Adds calculation rule building FULLNAME from normalized parts |
| attribute-rules/calculation/Roads_Edit/convert_to_null_if_no_value.arcade | Adds calculation rule converting blank/whitespace to null for select fields |
| attribute-rules/calculation/Roads_Edit/calculate_dot_owner.arcade | Adds calculation rule computing DOT_OWN_L/R (spatial logic) |
| attribute-rules/.gitignore | Ignores node_modules for the attribute-rules workspace |
| attribute-rules/pnpm-workspace.yaml | pnpm workspace policies for the attribute-rules workspace |
| attribute-rules/pnpm-lock.yaml | Locks Node dependencies for Arcade test harness |
| attribute-rules/package.json | Declares the attribute-rules test workspace and dependencies |
| .vscode/settings.json | Adds .arcade file association + Vitest root config for editor support |
| .github/workflows/pull_request.attribute-rules.yml | Adds CI workflow to run attribute-rules tests on PRs touching that directory |
| .github/dependabot.yml | Configures Dependabot updates for the attribute-rules npm workspace |
Files not reviewed (1)
- attribute-rules/pnpm-lock.yaml: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
58258fa to
38d78cf
Compare
stdavis
left a comment
There was a problem hiding this comment.
This is really cool! I feel like this will be useful in many other places in our office. Nice work!
What do you think of standardizing on two spaces for indentation in arcade scripts to match what we do with JS/TS? We usually use four spaces for python. There are some .py files here that need to be updated. I have a useful VSCode extension for doing this type of thing if you are interested.
Co-authored-by: Scott Davis <stdavis@utah.gov>
Thanks Scott! I just pushed some arcade updates to enforce 2-line tabs. |
|
Addressed the above comments and pushed changes. |
|
🦅 |
Adding attribute rules as per the specs for UTRANS