Repository navigation
feat(arcgis): full plain-text descriptions, data dates, source block (#32) - #38
Merged
Merged
Conversation
Descriptions were cut at 300 characters of raw HTML, hiding definitions and suppression rules; the only date shown was the Hub item's; answers carried nothing to cite. - core/portal_content.html_to_text (stdlib html.parser): block tags to lines, list bullets, entities decoded, script/style dropped. Applied to item descriptions, snippets, licence and access information. - get_dataset shows the whole description (capped at 12,000 characters with a truncation notice); search keeps a 300-character excerpt. - get_dataset adds the default layer's data and schema edit dates from editingInfo (HUD FMR: 2025-09-30). Layer descriptions are cached. - get_schema adds string field lengths and coded-value/range domains. - query_data and aggregate_data end with a source block: dataset title and Hub page, layer queried, data edit date (only from the cache, so no extra request), licence, retrieval time. ArcGIS metadata XML (field labels) is left for a follow-up. Closes #32 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Sep 25, 2026
sgarcese
added a commit
that referenced
this pull request
Sep 25, 2026
- ARCHITECTURE.md: the ArcGIS tool table listed four tools with their old arguments; it now lists get_schema and aggregate_data, the layer, paging and format arguments, and links to BUILT_IN_PLUGINS.md. - BUILT_IN_PLUGINS.md: search/aggregation tools take `query`, not `q`; replace the "appends /0" note with first-layer resolution and `layer`; schema fallback path uses the resolved layer; WHERE validation covers having and order_by; get_schema row mentions lengths and domains. - CUSTOM_PLUGINS.md: document render_rows. - SECURITY.md: ArcGIS order_by / aggregate_data / layer input checks, html_to_text, and render_rows in the structure-forgery row. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #32 (fork-side tracking for thealphacubicle#84).
Problem
editingInfo.dataLastEditDatehas the real one.Change
core/portal_content.html_to_text(stdlibhtml.parser; no new dependency)<li>becomes-bullets, entities are decoded,<script>/<style>content is dropped, and blank lines are collapsed.clean_textand the untrusted-data frame. Converting first also means markup can't split an injection phrase so the marker scan misses it (there's a test for this).get_dataset…[truncated, N more chars]notice. Search results keep a 300-character excerpt.Data last editedandSchema last editedfrom the default layer'seditingInfo. This costs one more request perget_datasetcall. It is best-effort, and the layer description is cached.get_schemaadds the length of string fields and coded-value or range domains when the service defines them. Long domains are capped at 30 values plus "… and N more".Source block at the end of
query_dataandaggregate_data:query_dataonly uses a layer description that is already cached (fromget_dataset,get_schemaor an earlier call), so the block never costs an extra request. Without one, the date line is left out.aggregate_datareads the description anyway, so it always has the date.portal_urland a validated item id.Other
_layer_url_fornow returns(layer_url, dataset);_layer_metadataholds the per-layer cache and_layer_fieldsuses it.docs/BUILT_IN_PLUGINS.mdis updated.Deferred: reading the item's ArcGIS metadata XML for field labels (optional in thealphacubicle#84) is left for a follow-up.
Tests
tests/unit/core/test_portal_content.py: 7html_to_texttests (blocks, lists, entities; script/style; table cells; pass-through; markup can't hide an injection phrase).tests/unit/plugins/arcgis/test_metadata.py(14 tests):get_dataset, and omitted when the layer can't be readget_dataset(and the request count); no extra request without the cache;aggregate_dataincludes the date and licence; unsafe ids give no linkpytest -n auto: 1241 passed, 95% coverage.ruff checkandruff formatare clean.Live against
hudgis-hud.opendata.arcgis.com(Fair Market Rents,12d25169…)Created: 2017-11-22 | Modified: 2026-04-20 | Data last edited: 2025-09-30 | Schema last edited: 2025-09-30. The data date matches the issue.query_datafooter is as shown above.🤖 Generated with Claude Code