stratified_packager.processing.dedup
Deduplication of packaged layers sharing one normalized data source (SPEC §12).
Groups packaged vector layers by their provider + normalized decodeUri components, merges
each group onto a primary member (whose table hosts the union of every member’s matches and
kept fields), and extends warm marking across a shared table. Runs on the algorithm thread
during Phase A; all user-facing messaging flows through the passed feedback.
Functions
|
Fold layers sharing one normalized data source into dedup groups (§12). |
|
Normalize a provider/source pair into the §12 dedup group key. |
|
Extend warm marking to whole dedup groups (§11/§12). |
|
Build the §12 dedup group key: provider + normalized |
- stratified_packager.processing.dedup._merge_group(members, feedback)[source]
Merge one dedup group onto its primary member (§12).
- Parameters:
members (
list[_LayerPrep]) – The group, in tree order (the first unfiltered member — else the first — becomes the primary).feedback (
QgsProcessingFeedback) – Execution feedback channel.
- Return type:
- stratified_packager.processing.dedup._subset_columns(subset_sql, layer)[source]
Name the layer fields referenced by a subset string (§12 kept-field rule).
A pragmatic identifier scan: a field counts as referenced when it appears quoted or as a standalone word inside the subset SQL.
- Parameters:
subset_sql (
str) – The provider-native subset SQL (possibly empty).layer (
QgsVectorLayer) – The layer whose field names are scanned for.
- Return type:
- Returns:
The referenced field names, in field order.
- stratified_packager.processing.dedup.apply_dedup(material, feedback)[source]
Fold layers sharing one normalized data source into dedup groups (§12).
The first unfiltered member in tree order becomes the primary (the first member when every member is filtered): its table hosts the union of every member’s match set and kept fields (always including the columns each member’s subset references). Runs before staging, so a staged group builds one staging copy through its primary instead of one per member (§8.2).
- Parameters:
material (
_Material) – The run material (preps mutated in place).feedback (
QgsProcessingFeedback) – Execution feedback channel.
- Return type:
- stratified_packager.processing.dedup.normalized_source_key(provider_type, source, label, feedback)[source]
Normalize a provider/source pair into the §12 dedup group key.
Path-typed components are resolved and case-folded (
decodeUridoes neither) and identifier quoting is stripped.- Parameters:
provider_type (
str) – The provider key (e.g.ogr,postgres).source (
str) – The provider source uri.label (
str) – A human label for debug messages (typically the layer name).feedback (
QgsProcessingFeedback) – Execution feedback channel.
- Return type:
- Returns:
The hashable key, or
Nonewhen the source cannot be decoded.
- stratified_packager.processing.dedup.promote_warm_groups(material, feedback)[source]
Extend warm marking to whole dedup groups (§11/§12).
Warm marking is effectively per exported table, and a dedup group shares one table: either it rides the warm cache or it does not. The §11 machinery caches only group primaries, so a mark on a non-primary member alone would otherwise vanish silently — promote the whole group instead.
- Parameters:
material (
_Material) – The run material (dedup already applied).feedback (
QgsProcessingFeedback) – Execution feedback channel.
- Return type:
- stratified_packager.processing.dedup.source_group_key(layer, feedback)[source]
Build the §12 dedup group key: provider + normalized
decodeUricomponents.- Parameters:
layer (
QgsVectorLayer) – The packaged layer.feedback (
QgsProcessingFeedback) – Execution feedback channel.
- Return type:
- Returns:
The hashable key, or
Nonewhen the source cannot be decoded.