@@ -36,15 +36,73 @@ They will be set in a list for `celery`, which means that they will be processed
3636- You can track the progress in the logs under /var/lib/docker/containers for ori_backend_1 and ori_loader_1.
3737- Update the status per municipality (importing, finished) in the github issue tracker.
3838
39- ### Switching municipality to other supplier
39+ ### Switching municipality to another supplier
4040Configure and start a run that retrieves all data since 2010-01-01:
4141- Either delete old index or remove alias from existing index to keep the index:
4242 - e.g. ` curl -XDELETE "http://172.20.0.2:9200/ori_heemskerk_20250506181303/_aliases/ori_heemskerk" `
43- - ` sudo docker exec ori_redis_1 redis-cli -n 1 set _all.start_date "2010-01-01" `
44- - ` sudo docker exec ori_redis_1 redis-cli -n 1 set _all.end_date "2025-11-20" `
45- - Make sure the new key containing the new supplier is configured:
46- - ` sudo docker exec ori_redis_1 redis-cli -n 1 set ori.notubiz.heemskerk "all daily monthly" `
47- - ` sudo docker exec ori_backend_1 ./manage.py extract process all --source_path=ori.notubiz.heemskerk `
43+ - Make sure the new index will be found by OpenBesluitvorming.nl. See point ` 1 ` and ` 2 ` under ` Fix indices ` below.
44+ - Now start the indexing:
45+ - ` sudo docker exec ori_redis_1 redis-cli -n 1 set _all.start_date "2010-01-01" `
46+ - ` sudo docker exec ori_redis_1 redis-cli -n 1 set _all.end_date "2025-11-20" `
47+ - Make sure the new key containing the new supplier is configured:
48+ - ` sudo docker exec ori_redis_1 redis-cli -n 1 set ori.notubiz.heemskerk "all daily monthly" `
49+ - ` sudo docker exec ori_backend_1 ./manage.py extract process all --source_path=ori.notubiz.heemskerk `
50+ - Make sure the old index is not found anymore by OpenBesluitvorming.nl. If you have deleted the old index you're all set.
51+ Otherwise, see point ` 3 ` under ` Fix indices ` below.
52+
53+ #### Fix indices
54+ When switching a municipality to another supplier the following must be taken care of in order to return
55+ the new index to OpenBesluitvorming.nl.
56+
57+ 1 . OpenBesluitvorming.nl uses the following to retrieve the list of municipalities:
58+ ```
59+ curl https://api.openraadsinformatie.nl/v1/elastic/_search?pretty -H 'Content-type: application/json' -d '{
60+ "size": 500,
61+ "query": {
62+ "bool": {
63+ "must": {
64+ "match_all": {}
65+ },
66+ "filter": {
67+ "bool": {
68+ "should": [
69+ { "match": { "classification": "municipality" } },
70+ { "match": { "classification": "province" } },
71+ { "match": { "classification": "water" } }
72+ ],
73+ "minimum_should_match": 1
74+ }
75+ }
76+ }
77+ }
78+ }'
79+ ```
80+ So we need to make sure there is a doc in the new index that has ` classification ` set to "municipality", "province" or "water".
81+
82+ 2 . Such records are created when ` AllmanakMunicipalityExtractor.run ` yields. Due to the ` hash_for_item ` check it normally
83+ does not yield after first-time creation. So we must delete the entry from the ` item_hash ` table. First get the ` item_id ` . Example:
84+ ```
85+ - sudo docker exec -it ori_backend_1 sh
86+ - python
87+ - from ocd_backend.utils.misc import hash_utils
88+ - hash_key = hash_utils.create_hash_key('allmanak', 23365, 'municipality', 23365)
89+ ```
90+
91+ Then delete the row:
92+ ```
93+ - sudo docker exec -it ori_postgres_1 psql -U postgres
94+ - \c ori
95+ - delete from item_hash where item_id='<hash_key>';
96+ ```
97+
98+ Now the run can be started
99+
100+ 3 . Important: the old index is also still found by OpenBesluitvorming.nl. From the output of the Elasticsearch above find the ` id ` of the
101+ document with the classification for the old index. Delete it using (example):
102+ ` curl -XDELETE "https://api.openraadsinformatie.nl/v1/elastic/ori_heemskerk_20250506181303/_doc/4054973" `
103+
104+
105+
48106
49107### Celery
50108Some useful commands to see queues (run from ori_backend_1):
0 commit comments