Skip to content

feat: Add Attribute Rules - #32

Merged
acneville merged 12 commits into
mainfrom
feat/attribute-rules
Sep 1, 2026
Merged

acneville merged 12 commits into
mainfrom
feat/attribute-rules

Conversation

@acneville

Copy link
Copy Markdown
Contributor

Adding attribute rules as per the specs for UTRANS

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/core in CI.
  • Add multiple .arcade calculation/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.

Comment thread attribute-rules/deploy_ar.py Outdated
Comment thread attribute-rules/deploy_ar.py Outdated
Comment thread attribute-rules/calculation/Roads_Edit/calculate_dot_owner.arcade Outdated
Comment thread attribute-rules/calculation/Roads_Edit/remove_apostrophes_from_name.arcade Outdated
@acneville
acneville force-pushed the feat/attribute-rules branch from 58258fa to 38d78cf Compare August 28, 2026 20:25
@acneville
acneville requested a review from stdavis August 28, 2026 20:26

@stdavis stdavis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread attribute-rules/calculation/Roads_Edit/calculate_dot_owner.arcade Outdated
Comment thread attribute-rules/calculation/Roads_Edit/calculate_dot_owner.arcade Outdated
Comment thread attribute-rules/calculation/Roads_Edit/calculate_dot_owner.arcade Outdated
Comment thread attribute-rules/calculation/Roads_Edit/spatial_assignments.arcade Outdated
Comment thread attribute-rules/calculation/Roads_Edit/spatial_assignments.arcade
Comment thread attribute-rules/calculation/Roads_Edit/unique_id.arcade Outdated
Comment thread attribute-rules/deploy_all_ar.py
Comment thread attribute-rules/new_ar.py Outdated
Comment thread README.md Outdated
Comment thread README.md
@acneville

Copy link
Copy Markdown
Contributor Author

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.

Thanks Scott! I just pushed some arcade updates to enforce 2-line tabs.

@acneville
acneville requested a review from stdavis September 1, 2026 17:24
@acneville

Copy link
Copy Markdown
Contributor Author

Addressed the above comments and pushed changes.

@stdavis stdavis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Comment thread .vscode/settings.json
@acneville
acneville merged commit 8e31305 into main Sep 1, 2026
2 checks passed
@acneville
acneville deleted the feat/attribute-rules branch September 1, 2026 17:45
@acneville

Copy link
Copy Markdown
Contributor Author

🦅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants