Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#677] Replace selectielijst procestype with selectielijstklasse #685

Merged
merged 4 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions backend/docs/developers/logic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,15 @@ For each zaak that has been "rejected" by the reviewer, the record manager can:

In this case the selectielijstklasse is correct, but for whatever reason the zaak needs to be kept for longer.
Changing the archiefactiedatum for zaken with "waardering" equal to "blijven_bewaren" should not be possible.

Selectielijst
=============

Some aspects about the selectielijst resources that can be confusing:

- Each zaaktype has an associated selectielijstprocestype (a URL to a resource in the https://selectielijst.openzaak.nl/api/v1/procestypen API).
The procestype has a year associated to it, which is the version of the selectielijst.
- Each zaak has an associated selectielijstklasse (a URL to a resource in the https://selectielijst.openzaak.nl/api/v1/resultaten API).
Each selectielijstklasse is associated with a selectielijstprocestype.
The zaak can only be related to a selectielijstklasse whose procestype matches the procestype related to the zaaktype
of the zaak.
13 changes: 8 additions & 5 deletions backend/src/openarchiefbeheer/destruction/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ def test_generate_destruction_report(self):
"jaar": 2020,
},
},
"selectielijstklasse": "3.2 - Niet vastgesteld - vernietigen",
},
)
DestructionListItemFactory.create(
Expand Down Expand Up @@ -402,6 +403,7 @@ def test_generate_destruction_report(self):
"jaar": 2024,
},
},
"selectielijstklasse": "3.2 - Niet vastgesteld - vernietigen",
},
)
DestructionListItemFactory.create(
Expand All @@ -425,6 +427,7 @@ def test_generate_destruction_report(self):
"jaar": 2022,
},
},
"selectielijstklasse": "1.1 - Ingericht - vernietigen",
},
)

Expand All @@ -448,7 +451,7 @@ def test_generate_destruction_report(self):
"Zaak Identificatie",
"Zaak Startdatum",
"Zaak Einddatum",
"Selectielijst Procestype",
"Selectielijstklasse",
"Selectielijst versie",
),
)
Expand All @@ -467,7 +470,7 @@ def test_generate_destruction_report(self):
"ZAAK-01",
"2020-01-01",
"2022-01-01",
"1.1 - Plannen opstellen",
"3.2 - Niet vastgesteld - vernietigen",
2020,
),
)
Expand All @@ -482,7 +485,7 @@ def test_generate_destruction_report(self):
"ZAAK-02",
"2020-01-02",
"2022-01-02",
"1 - Beleid en regelgeving opstellen",
"3.2 - Niet vastgesteld - vernietigen",
2024,
),
)
Expand All @@ -497,7 +500,7 @@ def test_generate_destruction_report(self):
"ZAAK-03",
"2020-01-03",
"2022-01-03",
"1.0 - Instellen en inrichten organisatie",
"1.1 - Ingericht - vernietigen",
2022,
),
)
Expand Down Expand Up @@ -623,7 +626,7 @@ def test_generate_destruction_report_with_cases_excluded_from_list(self):
"Zaak Identificatie",
"Zaak Startdatum",
"Zaak Einddatum",
"Selectielijst Procestype",
"Selectielijstklasse",
"Selectielijst versie",
),
)
Expand Down

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions backend/src/openarchiefbeheer/destruction/tests/vcr/test_tasks.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.core.cache import cache
from django.test import TestCase, tag

from freezegun import freeze_time
Expand All @@ -7,6 +8,7 @@
from zgw_consumers.test.factories import ServiceFactory

from openarchiefbeheer.accounts.tests.factories import UserFactory
from openarchiefbeheer.config.models import APIConfig
from openarchiefbeheer.utils.utils_decorators import reload_openzaak_fixtures
from openarchiefbeheer.zaken.models import Zaak
from openarchiefbeheer.zaken.tasks import retrieve_and_cache_zaken_from_openzaak
Expand Down Expand Up @@ -96,6 +98,13 @@ def test_process_response(self):

@tag("vcr")
class DestructionTest(VCRMixin, TestCase):
def setUp(self):
super().setUp()

cache.clear()

self.addCleanup(cache.clear)

@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
Expand Down Expand Up @@ -127,6 +136,15 @@ def test_document_deleted(self):
After a relation object (ZIO/BIO) is deleted by OAB and before the
corresponding EIO is deleted by OAB, someone deletes the EIO in OZ.
"""
service = ServiceFactory(
slug="selectielijst",
api_type=APITypes.orc,
api_root="https://selectielijst.openzaak.nl/api/v1/",
)
config = APIConfig.get_solo()
config.selectielijst_api_service = service
config.save()

with freeze_time("2024-08-29T16:00:00+02:00"):
retrieve_and_cache_zaken_from_openzaak()

Expand Down
6 changes: 1 addition & 5 deletions backend/src/openarchiefbeheer/zaken/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ def format_selectielijstversie(field: dict, item: DestructionListItem) -> str:
{"name": "Zaak Identificatie", "path": "identificatie"},
{"name": "Zaak Startdatum", "path": "startdatum"},
{"name": "Zaak Einddatum", "path": "einddatum"},
{
"name": "Selectielijst Procestype",
"path": "zaaktype.selectielijst_procestype",
"format": format_selectielijst,
},
{"name": "Selectielijstklasse", "path": "selectielijstklasse"},
{
"name": "Selectielijst versie",
"path": "zaaktype.selectielijst_procestype",
Expand Down
12 changes: 12 additions & 0 deletions backend/src/openarchiefbeheer/zaken/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from rest_framework_gis.fields import GeometryField
from zgw_consumers.models import Service

from openarchiefbeheer.zaken.utils import get_selectielijstklasse_choices_dict

from ..models import Zaak


Expand Down Expand Up @@ -105,6 +107,7 @@ class ZaakMetadataSerializer(serializers.ModelSerializer):
zaaktype = serializers.SerializerMethodField()
resultaat = serializers.SerializerMethodField()
bronapplicatie = serializers.SerializerMethodField()
selectielijstklasse = serializers.SerializerMethodField()

class Meta:
model = Zaak
Expand All @@ -117,6 +120,7 @@ class Meta:
"identificatie",
"zaaktype",
"bronapplicatie",
"selectielijstklasse",
)

@extend_schema_field(serializers.JSONField)
Expand Down Expand Up @@ -152,3 +156,11 @@ def get_bronapplicatie(self, zaak: Zaak) -> str:

service = get_service(zaak_url.url)
return service.label

@extend_schema_field(serializers.CharField)
def get_selectielijstklasse(self, zaak: Zaak) -> str:
if not zaak.selectielijstklasse:
return ""

selectielijstklasse_choices_dict = get_selectielijstklasse_choices_dict()
return selectielijstklasse_choices_dict[zaak.selectielijstklasse]["label"]
Loading