Skip to content

Commit

Permalink
lmb-gr-tables: add IVGR7-LMB-3-verhindering-schepenen config
Browse files Browse the repository at this point in the history
  • Loading branch information
elpoelma committed Oct 11, 2024
1 parent 4459ac4 commit ca64f65
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/fresh-geese-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'frontend-gelinkt-notuleren': minor
---

**LMB IV GR tables**
Add a `IVGR7-LMB-3-verhindering-schepenen` config which lists the 'schepenen' who have a status of 'verhinderd'
11 changes: 11 additions & 0 deletions app/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,14 @@ export const BESTUURSPERIODES = {
export const LOKALE_VERKIEZINGEN = {
2024: 'http://data.lblod.info/id/rechtstreekse-verkiezingen/612a57de-7fc2-40af-a7dc-17d544e5de20',
};

export const MANDATARIS_STATUS_CODES = {
EFFECTIEF:
'http://data.vlaanderen.be/id/concept/MandatarisStatusCode/21063a5b-912c-4241-841c-cc7fb3c73e75',
TITELVOEREND:
'http://data.vlaanderen.be/id/concept/MandatarisStatusCode/aacb3fed-b51d-4e0b-a411-f3fa641da1b3',
VERHINDERD:
'http://data.vlaanderen.be/id/concept/MandatarisStatusCode/c301248f-0199-45ca-b3e5-4c596731d5fe',
WAARNEMEND:
'http://data.vlaanderen.be/id/concept/MandatarisStatusCode/e1ca6edd-55e1-4288-92a5-53f4cf71946a',
};
66 changes: 66 additions & 0 deletions app/config/mandatee-table-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
BESTUURSFUNCTIE_CODES,
BESTUURSPERIODES,
LOKALE_VERKIEZINGEN,
MANDATARIS_STATUS_CODES,
} from './constants';
import { promiseProperties } from '../utils/promises';

Expand All @@ -33,6 +34,7 @@ export const IVGR_TAGS = /** @type {const} */ ([
'IVGR5-LMB-3-samenstelling-fracties',
'IVGR7-LMB-1-kandidaat-schepenen',
'IVGR7-LMB-2-ontvankelijkheid-schepenen',
'IVGR7-LMB-3-verhindering-schepenen',
'IVGR8-LMB-1-verkozen-schepenen',
'IVGR8-LMB-2-coalitie',
]);
Expand Down Expand Up @@ -684,6 +686,70 @@ export const mandateeTableConfigIVGR = (meeting) => {
};
},
},

'IVGR7-LMB-3-verhindering-schepenen': {
query: () => {
const sparqlQuery = /* sparql */ `
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX ext: <http://mu.semte.ch/vocabularies/ext/>
PREFIX lmb: <http://lblod.data.gift/vocabularies/lmb/>
PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
PREFIX persoon: <http://data.vlaanderen.be/ns/persoon#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT ?mandataris ?mandataris_naam WHERE {
?bestuursorgaan lmb:heeftBestuursperiode <${BESTUURSPERIODES['2019-2025']}>.
?bestuursorgaan org:hasPost ?mandaat.
?mandaat org:role <${BESTUURSFUNCTIE_CODES.SCHEPEN}>.
?mandataris org:holds ?mandaat.
?mandataris mandaat:isBestuurlijkeAliasVan ?persoon.
?mandataris mandaat:status/skos:prefLabel <${MANDATARIS_STATUS_CODES.VERHINDERD}>.
?persoon persoon:gebruikteVoornaam ?voornaam.
?persoon foaf:familyName ?achternaam.
BIND(CONCAT(?voornaam, " ", ?achternaam) AS ?mandataris_naam)
}
`;
return executeQuery({
query: sparqlQuery,
endpoint: '/vendor-proxy/query',
});
},
updateContent: (pos, queryResult) => {
return (state) => {
const { doc, schema } = state;
const $pos = doc.resolve(pos);
const bindings = queryResult.results.bindings
.map((binding) => {
const { mandataris_rang } = bindingToObject(binding);
return {
...binding,
rangnummer: rangordeStringToNumber(mandataris_rang),
};
})
.sort((b1, b2) => {
return b1.rangnummer - b2.rangnummer;
});
const tableHeader = row(schema, [schema.text('Schepen')], true);
const rows = bindings.map((binding) => {
const { mandataris_naam } = bindingToObject(binding);
return row(schema, [schema.text(mandataris_naam)]);
});
const content = schema.nodes.table.create(null, [
tableHeader,
...rows,
]);
const transaction = replaceContent(state.tr, $pos, content);
return {
transaction: transaction,
result: true,
initialState: state,
};
};
},
},
/**
* **IVGR8: Aanduiding en eedaflegging van de aangewezen-burgemeester**
*
Expand Down

0 comments on commit ca64f65

Please sign in to comment.