OP-3784: added query to check missing addressregister URI's
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
# Changelog
|
||||
## Unreleased
|
||||
- Query to check missing address URI's [OP-3784]
|
||||
|
||||
### Deploy notes
|
||||
```
|
||||
drc restart report-generation
|
||||
```
|
||||
|
||||
## 1.39.1 (2026-04-24)
|
||||
- OP-3771: Adds labels for: EredienstBeroepen and TypeBetrokkenheid
|
||||
- Bump to kbo-data-sync [OP-3765]
|
||||
|
||||
@@ -5,6 +5,7 @@ import OrganizationsDetailReport from './organizations-detail-report'
|
||||
import OrganizationsPlatformReport from './organizations-platform-report'
|
||||
import AdministrativeUnitsReport from "./administrative-units-report";
|
||||
import ChangeEventsReport from "./change-events-report";
|
||||
import OrganizationsNoAddressReport from "./organizations-no-address-report";
|
||||
|
||||
export default [
|
||||
OrganizationsReport,
|
||||
@@ -14,4 +15,5 @@ export default [
|
||||
OrganizationsPlatformReport,
|
||||
AdministrativeUnitsReport,
|
||||
ChangeEventsReport,
|
||||
OrganizationsNoAddressReport,
|
||||
];
|
||||
|
||||
98
config/reports/organizations-no-address-report.js
Normal file
98
config/reports/organizations-no-address-report.js
Normal file
@@ -0,0 +1,98 @@
|
||||
import { generateReportFromData, batchedQuery } from "../helpers.js";
|
||||
import { PREFIXES } from "./utils";
|
||||
|
||||
export default {
|
||||
cronPattern: "0 00 23 * * *",
|
||||
name: "organizationsNoAddressregister",
|
||||
execute: async () => {
|
||||
const reportData = {
|
||||
title: "organisations in database with no link to Addressregister",
|
||||
description: "List of the Organisations in the database with no link to Addressregister",
|
||||
filePrefix: "exports/organizations-no-addressregister",
|
||||
};
|
||||
|
||||
console.log("Generating organizationsNoAddressregister report");
|
||||
|
||||
const queryString = `
|
||||
${PREFIXES}
|
||||
PREFIX org: <http://www.w3.org/ns/org#>
|
||||
PREFIX adms: <http://www.w3.org/ns/adms#>
|
||||
PREFIX generiek: <https://data.vlaanderen.be/ns/generiek#>
|
||||
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
|
||||
SELECT DISTINCT
|
||||
?bestuur
|
||||
?label
|
||||
?classification
|
||||
?status
|
||||
?street
|
||||
?number
|
||||
?bus
|
||||
?postal
|
||||
?location
|
||||
WHERE {
|
||||
?bestuur a org:Organization .
|
||||
|
||||
OPTIONAL {
|
||||
?bestuur <http://www.w3.org/ns/org#hasPrimarySite> ?site .
|
||||
?site <https://data.vlaanderen.be/ns/organisatie#bestaatUit> ?address .
|
||||
OPTIONAL{?address <https://data.vlaanderen.be/ns/adres#verwijstNaar> ?adressenregister .}
|
||||
OPTIONAL{?address <http://www.w3.org/ns/locn#thoroughfare> ?street . }
|
||||
OPTIONAL{?address <https://data.vlaanderen.be/ns/adres#Adresvoorstelling.huisnummer> ?number . }
|
||||
OPTIONAL{?address <https://data.vlaanderen.be/ns/adres#Adresvoorstelling.busnummer> ?bus . }
|
||||
OPTIONAL{?address <http://www.w3.org/ns/locn#postCode> ?postal . }
|
||||
OPTIONAL{?address <https://data.vlaanderen.be/ns/adres#gemeentenaam> ?location . }
|
||||
}
|
||||
|
||||
OPTIONAL {?bestuur skos:prefLabel ?label}
|
||||
OPTIONAL {
|
||||
?bestuur <http://www.w3.org/ns/org#classification> ?org_classification .
|
||||
?org_classification skos:prefLabel ?classification .
|
||||
}
|
||||
OPTIONAL {
|
||||
?bestuur <http://www.w3.org/ns/regorg#orgStatus> ?org_status .
|
||||
?org_status skos:prefLabel ?status .
|
||||
}
|
||||
FILTER(!BOUND(?adressenregister))
|
||||
}
|
||||
`;
|
||||
|
||||
const queryResponse = await batchedQuery(queryString);
|
||||
|
||||
const data = queryResponse.results.bindings.map((row) => ({
|
||||
"bestuur": getSafeValue(row, "bestuur"),
|
||||
"label": getSafeValue(row, "label"),
|
||||
"classification": getSafeValue(row, "classification"),
|
||||
"status": getSafeValue(row, "status"),
|
||||
"street": getSafeValue(row, "street"),
|
||||
"number": getSafeValue(row, "number"),
|
||||
"bus": getSafeValue(row, "bus"),
|
||||
"postal": getSafeValue(row, "postal"),
|
||||
"location": getSafeValue(row, "location"),
|
||||
}));
|
||||
|
||||
await generateReportFromData(
|
||||
data,
|
||||
[
|
||||
"bestuur",
|
||||
"label",
|
||||
"classification",
|
||||
"status",
|
||||
"street",
|
||||
"number",
|
||||
"bus",
|
||||
"postal",
|
||||
"location",
|
||||
],
|
||||
reportData,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
function getSafeValue(entry, property) {
|
||||
return entry[property] ? wrapInQuote(entry[property].value) : null;
|
||||
}
|
||||
|
||||
// Some values might contain commas; wrapping them in escapes quotes doesn't disrupt the columns.
|
||||
function wrapInQuote(value) {
|
||||
return `\"${value}\"`;
|
||||
}
|
||||
Reference in New Issue
Block a user