Skip to content

Adding a New Bestuurseenheid

Riad Abdallah edited this page Jul 4, 2024 · 19 revisions

Query the bestuurseenheid from OP (Organisatie-Portaal)

The ticket description should either have the URI of the bestuurseenheid in OP or a link containing its UUID.

Query the relevant bestuursorganen and bestuursorganen in tijd

After obtaining the URI, you need to fetch the bestuursorganen and bestuursorganen in tijd.

Bestuursorganen

SELECT ?s WHERE {
  ?s <http://data.vlaanderen.be/ns/besluit#bestuurt> <BESTUURSEENHEID_URI> .
}

Where BESTUURSEENHEID_URI is the bestuurseenheid URI obtained above.

Bestuursorganen in Tijd

SELECT ?s WHERE {
  ?s <https://data.vlaanderen.be/ns/generiek#isTijdspecialisatieVan> <BESTUURSORGANEN_URI> .
}

or

SELECT DISTINCT ?s ?o WHERE {
  VALUES ?o {
    <BESTUURSORGANEN_URI_1>
    <BESTUURSORGANEN_URI_2>
    <BESTUURSORGANEN_URI_3>
  }

  ?s <https://data.vlaanderen.be/ns/generiek#isTijdspecialisatieVan> ?o .
}

Where BESTUURSORGANEN_URI is the bestuursorgaan URI obtained from the previous query.

The second query allows you to congregate all bestuursorganen URIs obtained from the previous step and obtain their respective bestuursorganen in tijd (if any exist).

Add aforementioned info to a new migration

⚠️ Some data types differ between Loket and OP:

Data Type Loket OP
Date http://www.w3.org/2001/XMLSchema#date http://www.w3.org/2001/XMLSchema#dateTime

The date coming from OP will look like this: "2019-01-01T00:00:00"^^xsd:dateTime. When copying it over to the Loket side, make sure to remove the time portion when using the xsd:date data type (i.e., "2019-01-01"^^xsd:date) ; otherwise, it will break automatic propagation to https://leidinggevenden.lokaalbestuur.vlaanderen.be/ and subsequently https://gelinkt-notuleren.vlaanderen.be/login.


⚠️ Some predicates differ between Loket and OP:

Predicate Loket OP
Classificatie http://data.vlaanderen.be/ns/besluit#classificatie http://www.w3.org/ns/org#classification
isTijdSpecialisatieVan http://data.vlaanderen.be/ns/mandaat#isTijdspecialisatieVan https://data.vlaanderen.be/ns/generiek#isTijdspecialisatieVan

The following PR file provides a reference.

Add personeelsaantallen

Personeelsaantallen can be added using loket-cli; this repository allows a user to define some organization parameters inside a .csv file; after which, the necessary .ttl and .graph files will be automatically generated.

As an example, this PR added a new OCMW vereniging. In order to generate the necessary data, you must first clone the loket-cli repo and make sure to have a personeelsaantallen.csv file inside data/. For the linked PR, this was the input data:

"http://data.lblod.info/id/bestuurseenheden/384b48dc-6860-49b4-a9ef-efa557299950","OCMW vereniging","Ter Lembeek","384b48dc-6860-49b4-a9ef-efa557299950"

This data corresponds to the following:

URI OF ORGANIZATION, TYPE OF ORGANIZATION, NAME OF ORGANIZATION, UUID OF ORGANIZATION

After filling the needed data, run the following command:

docker run -v $PWD/data:/data --rm -it lblod/loket-cli create_personeelsaantallen_for_csv

Running this will create a .ttl and .graph file inside data/; make sure to copy these files to your migration folder in app-digitaal-loket.

Add mock user rights to the bestuurseenheid

New organizations have to be given mock-user rights for them to show up when accessing /mock-login.

The migration query has the following form:

PREFIX mu:      <http://mu.semte.ch/vocabularies/core/>
PREFIX ext:     <http://mu.semte.ch/vocabularies/ext/>
PREFIX skos:    <http://www.w3.org/2004/02/skos/core#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX besluit: <http://data.vlaanderen.be/ns/besluit#>
PREFIX mandaat: <http://data.vlaanderen.be/ns/mandaat#>
PREFIX foaf:    <http://xmlns.com/foaf/0.1/>

INSERT {
  GRAPH ?g {
    ?persoon a foaf:Person ;
      mu:uuid ?uuidPersoon ;
      foaf:firstName ?classificatie ;
      foaf:familyName ?naam ;
      foaf:member <http://data.lblod.info/id/bestuurseenheden/UUID> ;
      foaf:account ?account .

    ?account a foaf:OnlineAccount ;
      mu:uuid ?uuidAccount ;
      foaf:accountServiceHomepage <https://github.com/lblod/mock-login-service> ;
      ext:sessionRole "LoketLB-toezichtGebruiker", "LoketLB-bbcdrGebruiker", "LoketLB-mandaatGebruiker", "LoketLB-berichtenGebruiker", "LoketLB-leidinggevendenGebruiker", "LoketLB-personeelsbeheer", "LoketLB-subsidies" .
  }
}
WHERE {
  <http://data.lblod.info/id/bestuurseenheden/UUID> a besluit:Bestuurseenheid ;
    skos:prefLabel ?naam ;
    besluit:classificatie/skos:prefLabel ?classificatie .

  BIND(CONCAT(?classificatie, " ", ?naam) AS ?volledigeNaam)
  BIND(MD5(?volledigeNaam) AS ?uuidPersoon)
  BIND(MD5(CONCAT(?volledigeNaam,"ACCOUNT")) AS ?uuidAccount)
  BIND(IRI(CONCAT("http://data.lblod.info/id/persoon/", ?uuidPersoon)) AS ?persoon)
  BIND(IRI(CONCAT("http://data.lblod.info/id/account/", ?uuidAccount)) AS ?account)

  VALUES ?g {
    <http://mu.semte.ch/graphs/organizations/UUID>
    <http://mu.semte.ch/graphs/public>
  }
}

Replace UUID with an actual generated UUID, or with the uuid provided to you in the ticket.

The following PR file provides a reference.