mirror of
https://github.com/ARUP-CAS/aiscr-qgis-amcr-viewer.git
synced 2026-10-09 20:37:37 +02:00
* fix: váha prvku komponent počítaná z komponent prošlých filtrem (#55) Váha prvku_vaha = 1/n se dosud počítala ze všech komponent dokumentační jednotky ještě před filtrem na období a areál, takže při aktivním filtru váhy prvků jedné DJ nedávaly v součtu 1 (DJ se 4 komponentami, filtru vyhoví 1 → váha 0,25 místo 1). - nová funkce _component_entries: nejdřív vyfiltruje komponenty, pak přidělí váhu 1/n z těch, které prošly; DJ bez komponent má váhu 1 - smoke test vaha_komponent (4×0,25; 1 ze 4 → 1; 2 ze 3 → 2×0,5; bez komponent → 1) - README: pole prvek_vaha v tabulce atributů komponent - changelog v2.2.0 doplněn (bez povýšení verze) - OpenSpec změna openspec/changes/fix-component-feature-weight Ověřeno: živá data (Praha, novověk) – 0 z 1204 DJ se součtem vah ≠ 1, původní kód 921; check_sources, bandit, detect-secrets, flake8, ruff, pyqgis4-checker, smoke test v qgis/qgis:ltr i :stable. Implementace připravena AI (Claude, subagent), ověřena a zkontrolována. * openspec: archivovat fix-component-feature-weight (#55) Ruční test v QGIS ověřen správcem: akce i lokality s Načíst komponenty, bez filtru i s filtrem období – váhy prvků jedné DJ dávají součet 1 a počítají se jen z vyfiltrovaných komponent. Úkol 3.2 odškrtnut, změna archivována přes openspec archive --skip-specs. Připraveno s pomocí AI (Claude).
43 lines
1.9 KiB
Markdown
43 lines
1.9 KiB
Markdown
## Why
|
||
|
||
Issue #55 added the `prvek_vaha` (feature weight) attribute: when *Načíst
|
||
komponenty* is on, every component of a documentation unit (DJ) becomes its
|
||
own feature on the same PIAN geometry, and the weight 1/*n* lets spatial
|
||
analyses count the geometry once. The unreleased implementation on
|
||
`version/v2.2.0` takes *n* from **all** components of the DJ, before the
|
||
period/area filter. With a component filter active the weights of one DJ no
|
||
longer sum to 1 (DJ with 4 components, 1 passes the Neolithic filter → one
|
||
feature with weight 0.25 instead of 1), so weighted counts are wrong exactly
|
||
when users filter. See the comment on #55.
|
||
|
||
## What Changes
|
||
|
||
- *n* in `prvek_vaha = 1/n` is the number of component features actually
|
||
created for the DJ, i.e. components that pass the period/area filters.
|
||
- The weights of all features created from one DJ sum to 1 with or without
|
||
filters.
|
||
- A DJ without components keeps its single feature with weight 1 (today the
|
||
value comes from a default; it becomes explicit).
|
||
- `README.md` documents `prvek_vaha` in the component fields table (it is
|
||
missing there today).
|
||
- Changelog entry under v2.2.0 in `amcr_viewer/metadata.txt` is extended
|
||
(the feature is unreleased, no separate version bump).
|
||
|
||
## Capabilities
|
||
|
||
### New Capabilities
|
||
- `component-features`: one feature per component of a fieldwork event or
|
||
site, and the weight attribute that de-duplicates shared geometries.
|
||
|
||
### Modified Capabilities
|
||
|
||
## Impact
|
||
|
||
- `amcr_viewer/amcr_tools.py` – component feature creation in
|
||
`load_amcr_data` (section B, attribute parsing).
|
||
- `tests/smoke_test.py` – offline check of the weights.
|
||
- `README.md`, `amcr_viewer/metadata.txt` (changelog only).
|
||
- No change to the digiarchiv API contract, layer schema or stored settings.
|
||
- `filter-components-via-component-endpoint` (#70) changes how components
|
||
are selected; it builds on this change and must keep the weight rule.
|