Skip to content

Transmission MVP - #463

Open
castelao wants to merge 100 commits into
mainfrom
transmission
Open

Transmission MVP#463
castelao wants to merge 100 commits into
mainfrom
transmission

Conversation

@castelao

@castelao castelao commented Jun 3, 2026

Copy link
Copy Markdown
Member

Implementing high-voltage tansmission lines.

@castelao castelao self-assigned this Jun 3, 2026
@castelao castelao added the enhancement Update to logic or general code improvements label Jun 3, 2026
@codecov-commenter

codecov-commenter commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.18182% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.34%. Comparing base (41d1273) to head (a1a09de).

Files with missing lines Patch % Lines
compass/plugin/one_shot/components.py 44.44% 5 Missing ⚠️
compass/plugin/one_shot/base.py 84.61% 1 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (68.18%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #463      +/-   ##
==========================================
+ Coverage   63.30%   63.34%   +0.04%     
==========================================
  Files          78       78              
  Lines        7211     7233      +22     
  Branches      725      729       +4     
==========================================
+ Hits         4565     4582      +17     
- Misses       2505     2510       +5     
  Partials      141      141              
Flag Coverage Δ
unittests 63.34% <68.18%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread compass/extraction/transmission/plugin_config.yaml Outdated
@castelao
castelao marked this pull request as ready for review July 15, 2026 21:53
Copilot AI review requested due to automatic review settings July 15, 2026 21:53

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

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds a new “transmission” one-shot extraction plugin and introduces a standardized scope field (with sentinel values) across schema validation and output finalization.

Changes:

  • Added a new transmission extraction schema + plugin configuration and registered the extractor.
  • Introduced scope support: injects all/other sentinels into schema enums and applies default scope values in plugin output.
  • Updated finalization column sets and added unit tests around scope-sentinel injection.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/python/unit/plugin/test_plugin_one_shot.py Adds unit tests for _inject_scope_sentinels behavior and legacy no-op behavior.
compass/utilities/finalize.py Adds scope to parsed/output column definitions.
compass/plugin/one_shot/components.py Applies default scope values and includes scope in output column candidates.
compass/plugin/one_shot/base.py Injects all/other scope sentinels into the configured schema’s scope.enum.
compass/extraction/transmission/transmission_schema.json5 Introduces the transmission extraction schema used by the new plugin.
compass/extraction/transmission/plugin_config.yaml Provides transmission plugin config (schema path, queries, keywords, heuristics).
compass/extraction/transmission/init.py Instantiates and exposes COMPASSTransmissionExtractor.
compass/extraction/init.py Registers the transmission extractor in the package exports.

Comment thread compass/plugin/one_shot/base.py Outdated
Comment thread compass/plugin/one_shot/components.py Outdated
Comment thread compass/utilities/finalize.py Outdated
Comment thread compass/extraction/transmission/transmission_schema.json5 Outdated
Comment thread compass/extraction/transmission/transmission_schema.json5 Outdated
Comment thread compass/extraction/transmission/transmission_schema.json5 Outdated
Comment thread compass/extraction/transmission/transmission_schema.json5 Outdated

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (2)

compass/extraction/transmission/transmission_schema.json5:215

  • $definitions.numerical_features documents a "maximum-height" feature, but that feature ID does not exist in the schema's feature.enum. Keeping a non-existent feature name in the schema guidance can lead the model to output invalid feature values; remove this entry (the existing maximum tower height / maximum structure height entries already cover the intent).
        "maximum-height": {
          "description": "Extract maximum structure height allowed."
        }

compass/utilities/finalize.py:41

  • QUAL_OUT_COLS is derived via slicing _PARSED_COLS, which is brittle (any insert/remove in _PARSED_COLS changes qualitative outputs implicitly and requires re-counting indices, as with the :6:7 update here). Defining the qualitative columns explicitly by name makes future column evolution safer and more readable.
QUAL_OUT_COLS = _PARSED_COLS[:7] + _PARSED_COLS[-5:-1]

Comment thread compass/extraction/transmission/transmission_schema.json5 Outdated
Comment thread compass/extraction/transmission/transmission_schema.json5 Outdated
Comment thread compass/extraction/transmission/transmission_schema.json5 Outdated
Comment thread compass/extraction/transmission/transmission_schema.json5
Comment thread compass/extraction/transmission/transmission_schema.json5 Outdated
@ppinchuk ppinchuk linked an issue Jul 21, 2026 that may be closed by this pull request
8 tasks
@castelao
castelao force-pushed the transmission branch 4 times, most recently from e569497 to 2e3d43a Compare July 27, 2026 03:21
@castelao

Copy link
Copy Markdown
Member Author

@ppinchuk , I would like to merge this one and start a following PR with fine-tuning transmission. Let me know if you have anything against merging this MVP as it is.

@ppinchuk ppinchuk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Couple of questions, everything else looks good!

Comment thread compass/utilities/finalize.py Outdated
Comment thread compass/plugin/one_shot/base.py
Comment thread compass/plugin/one_shot/components.py
ppinchuk
ppinchuk previously approved these changes Jul 27, 2026

@ppinchuk ppinchuk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

OK, after discussion, everything looks good. I just highly recommend adding a blurb about the "subarea" column, and especially explain to the users that "all" and :"other" categories will be added, so they don't nee to use other things like "any" or "undefined"

- `schema`: A dictionary representing the schema of the
output. Can also be a path to a file that contains the
schema (supported formats: JSON, JSON5, YAML, TOML). See
the wind ordinance schema for an example.

castelao added 24 commits July 29, 2026 12:05
Current name is _inject_subarea_sentinels().
When moving to subarea, left behind this _schema_with_scope.
Following the pattern used in GHP.
We already use scope in another context, so let's avoid confusion here.
Ordering good_tech_acronyms definition to match previous techs.
It gets more complex but the overall collection is more efficient if we
combine the regular ordinances with franchise in a single run.
Left this one behind when I transitioned from scope to subarea.
…tion

- Tighten 'structures distance' description to explicitly include generic
  'building setback line' clauses tied to a transmission-line easement,
  right-of-way, or centerline when the building is not qualified as
  residential.
- Tighten 'residential buildings distance' description with an exclusion
  redirecting generic unqualified building setback lines to
  'structures distance'.
- Add a $examples entry demonstrating a voltage-tiered building setback
  table (Roane County TN 5.2.6.2 pattern), routing it to
  'structures distance' with subarea='all' and applying numeric
  prioritization to select the largest tier (75 ft).
- Uncomment definition_v_rule_test in $core_principles.
- Extend 'bond' description to include subdivision-scale
  utility-infrastructure completion bonds when the provision does not
  carve out electric infrastructure and is not restricted to
  lower-voltage electric infrastructure only (distribution, service,
  secondary, sub-transmission).
- Clarify that qualitative bond rows are permitted; a numeric amount is
  not required when the provision imposes an enforceable obligation.
Introduce first-class $scope key consumed by COMPASS's dedicated
per-chunk scope-check step (see compass/plugin/one_shot/components.py).
This gate renders only the $scope string (not the full schema) into
its prompt and admits chunks with inclusive-by-default framing, so
mixed-voltage setback tables that include HV tiers pass through to
the content-relevance filter instead of being rejected wholesale.
Using double quotes to define jurisdiction context, then using single
quotes as overall query. It used to cause errors using the single quotes.
The site:municode.com and site:codelibrary.amlegal.com queries were
returning zero results for jurisdictions where the publisher indexes
under an alternate name than `full_name` (e.g., 'Evangeline Parish
Police Jury, LA' on municode vs. 'Evangeline Parish, Louisiana' in
COMPASS).

The phrase-lock is retained on free-form queries where it prevents
cross-state noise (Humphreys TN was previously polluted by Moab UT
before quoting was introduced). On site:-scoped queries the domain
restriction already bounds the result set to a legitimate ordinance
publisher, so phrase-locking adds no protection and blocks legitimate
matches whenever the publisher's title differs from full_name.
…sment

Treat transmission-line and franchise content as two kinds of content
that may appear separately or together in one document, rather than as
two distinct document types. Keep franchise as the primary output with
its verbatim-name and granting-clause guidance, and allow content-(1)
features to be extracted from a franchise document when provisions
apply to the grantee's electric infrastructure and, by encompassment,
would apply to its high-voltage transmission lines.
Extend the decommissioning feature to cover obligations to remove
facilities and restore the site upon termination, forfeiture, or
expiration of a franchise or grant, in addition to abandonment on
retirement or failure. The global encompassment_scope rules supply
the voltage floor.
Define the traffic disruption feature under operational_features.
This closes the gap that caused the feature to be missed on franchise
documents.
Extend the permit feature beyond discretionary land-use approvals to
also cover street-opening, road-cut, right-of-way, and encroachment
permits issued by a road or public-works authority. The global
encompassment_scope rules supply the voltage floor.
Broaden the transmission schema 'franchise' feature so a codified
'List of Franchises' index that names electric utilities as grantees
(grantee, duration, originating-ordinance reference) is treated as
substantive content to collect and extract, rather than being dropped
by the content gate as a citation-only index. Add a matching $examples
row modeled on the St. Helena Parish electric-franchise list so the
collection gate has a positive exemplar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Update to logic or general code improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add collection of Transmission Line ordinances

4 participants