2 Commits

Author SHA1 Message Date
david 9a935261e6 Update metadata.txt 2026-06-03 13:42:46 +02:00
david a4e30bf334 hardcoded AND filtering when filtering by period AND activity area (#39) 2026-06-02 22:25:29 +02:00
2 changed files with 36 additions and 3 deletions
+25 -1
View File
@@ -142,6 +142,13 @@ def tr_code(code):
return ""
return TRANSLATIONS.get(code, code)
def komp_projde_filtrem(komp, filter_areal, filter_datace, filters):
if filter_areal and komp.get('komponenta_areal', {}).get('id', "") not in filters.get('f_areal', []):
return False
if filter_datace and komp.get('komponenta_obdobi', {}).get('id', "") not in filters.get('f_obdobi', []):
return False
return True
def load_amcr_data(canvas, bb, filters=None, typ_dat="akce", komponenty="false"):
"""
Main processing function:
@@ -203,6 +210,10 @@ def load_amcr_data(canvas, bb, filters=None, typ_dat="akce", komponenty="false")
# Check if we should skip negative results based on filter
skip_negativni = filters.get('posevidence') == 'true' if filters else False
# Check whether we should filter results based on component filters
filter_areal = "f_areal" in filters if filters else False
filter_datace = "f_obdobi" in filters if filters else False
# --- API PAGINATION LOOP ---
while True:
@@ -339,6 +350,14 @@ def load_amcr_data(canvas, bb, filters=None, typ_dat="akce", komponenty="false")
if skip_negativni and dj.get('dj_negativni_jednotka') is True:
continue
komps = dj.get('dj_komponenta', [])
if filter_areal or filter_datace:
if not komps:
continue
if not any(komp_projde_filtrem(komp, filter_areal, filter_datace, filters) for komp in komps):
continue
dj_id = dj.get('ident_cely')
dj_typ = dj.get('dj_typ')
@@ -361,9 +380,11 @@ def load_amcr_data(canvas, bb, filters=None, typ_dat="akce", komponenty="false")
if komponenty == "true":
# One feature per component — all data on a single row, no relations needed
komps = dj.get('dj_komponenta', [])
if komps:
for komp in komps:
if not komp_projde_filtrem(komp, filter_areal, filter_datace, filters):
continue
komp_meta = {
**dj_meta,
'komponenta_id': komp.get('ident_cely', ""),
@@ -374,6 +395,9 @@ def load_amcr_data(canvas, bb, filters=None, typ_dat="akce", komponenty="false")
target_pian_ids_count += 1
else:
# DJ without components — still include with empty component fields
if filter_areal or filter_datace:
continue
empty_meta = {
**dj_meta,
'komponenta_id': "",
+11 -2
View File
@@ -8,7 +8,7 @@ name=AMČR Viewer
qgisMinimumVersion=3.4.0
qgisMaximumVersion=4.99.0
description=Viewing and downloading the AMČR data.
version=2.0.0-alpha.3
version=2.0.0-alpha.4
author=David Spáčil
email=spacil@arub.cz
@@ -22,7 +22,16 @@ repository=https://github.com/ARUP-CAS/aiscr-qgis-amcr-viewer
hasProcessingProvider=no
# Uncomment the following line and add your changelog:
# changelog=
changelog=
v2.0.0-alpha.4 (2026-06-03)
* Backend filtering of the results based on the component-related filters improvement (plugin not only loads the results from API, it filters them further)
v2.0.0-alpha.23 (2026-05-19)
* Security vulnerabilities fix
v2.0.0-alpha.1 (2026-05-19):
* Attribute fields renamed to be ASCII compliant
* Codelist update; codelist can be recompiled from AMČR API
* Basic element changed from Documentation Unit to Component if user asks for components to simplify result filtering
* Plugin now supports logging with an AMČR account and enables the downloading of Events and Sites available to the roles Researcher and higher
# Tags are comma separated with spaces allowed
tags=python,AMCR,AIS CR,archaeology,PIAN,AMČR