Skip to content

Commit 3570bb3

Browse files
authored
Merge pull request #1942 from ConductionNL/quality/build-landscape-completeness-score
feat(stackiq): build landscape-completeness-score
2 parents dd5e127 + b86fb6a commit 3570bb3

25 files changed

Lines changed: 1456 additions & 17 deletions

‎appinfo/info.xml‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Vrij en open source onder de EUPL-licentie.
5050
5151
**Ondersteuning:** Voor ondersteuning, neem contact op via support@conduction.nl. Voor een Service Level Agreement (SLA), neem contact op via sales@conduction.nl.
5252
]]></description>
53-
<version>0.2.8-unstable.20261120074500</version>
53+
<version>0.2.8-unstable.20261120081000</version>
5454
<!-- @spec openspec/changes/platform-properties/specs/platform-properties/spec.md#requirement-the-catalogue-runs-on-the-customers-own-nextcloud-req-plat-001 : a Nextcloud app on the customer's own server, EUPL-1.2 -->
5555
<licence>EUPL-1.2</licence>
5656
<author mail="info@conduction.nl" homepage="https://www.conduction.nl/">Conduction</author>
@@ -252,6 +252,13 @@ Vrij en open source onder de EUPL-licentie.
252252
the property, so no row is left without one.
253253
-->
254254
<step>OCA\Stackiq\Repair\BackfillRecordStatus</step>
255+
<!--
256+
landscape-completeness-score: every module and usage saved before
257+
the data quality rules existed is saved once so OpenRegister scores
258+
it. After InitializeSettings, which imports the rules and the score
259+
fields. Upgrade-only: a fresh install has no unscored rows.
260+
-->
261+
<step>OCA\Stackiq\Repair\RescoreDataQuality</step>
255262
<!--
256263
Must run AFTER the register sync that adds the English columns, so it
257264
can tell the rename case from the back-fill case. Scoped by SCHEMA,

‎appinfo/routes.php‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@
365365
['name' => 'portfolioReport#index', 'url' => '/api/portfolio-report', 'verb' => 'GET'],
366366
// @spec openspec/changes/landscape-completeness-score/specs/catalogue-data-quality/spec.md#requirement-req-cdq-003-a-data-quality-page-shows-how-complete-and-current-an-organisation-s-register-is
367367
['name' => 'dataQualityReport#index', 'url' => '/api/data-quality', 'verb' => 'GET'],
368+
// @spec openspec/changes/landscape-completeness-score/specs/catalogue-data-quality/spec.md#requirement-req-cdq-002-a-user-confirms-an-entry-is-current-and-its-freshness-resets
369+
[
370+
'name' => 'entryConfirmation#confirm',
371+
'url' => '/api/data-quality/confirm/{kind}/{id}',
372+
'verb' => 'POST',
373+
'requirements' => ['kind' => 'module|usage'],
374+
],
368375
// @spec openspec/changes/architecture-reference-component-coverage/specs/reference-component-coverage/spec.md#requirement-req-rcc-001-stackiq-shall-give-each-reference-component-a-coverage-state-for-one-organisation
369376
// @spec openspec/changes/gemma-plate-views-peers-and-definitions/specs/gemma-plate/spec.md#requirement-the-plate-shows-what-comparable-organisations-use-req-gpl-002
370377
['name' => 'referenceComponentCoverage#peers', 'url' => '/api/reference-component-coverage/peers', 'verb' => 'GET'],

‎docs/features/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ All data is stored as OpenRegister objects (no own database tables). OpenRegiste
2929
| [ArchiMate Import/Export](#archimate-importexport) | Exchange software landscape data in ArchiMate format |
3030
| [Technology Components](technology-components.md) | Record the servers, databases and devices an organisation runs, what runs on them and when their support ends |
3131
| [CMDB Import](#cmdb-import) | Import a municipality's TOPdesk CMDB export (xlsx) as applications, suppliers, usages and owners |
32+
| [Data quality](./data-quality.md) | A data quality score on every application and usage, a confirm-current action and a Data quality page per organisation |
3233
| [Open Data Publishing](#open-data-publishing) | Expose the catalogue as a public open-data API |
3334
| [GEMMA Compliance](#gemma-compliance) | Built around VNG GEMMA Softwarecatalogus reference |
3435
| [Reference Component Coverage](reference-component-coverage.md) | Which GEMMA reference components an organisation covers, where it has gaps and where applications overlap |

‎docs/features/data-quality.md‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Data quality
2+
3+
Every application and every usage of an application gets a data quality score. The
4+
score shows how complete and how current an entry is, so an information manager knows
5+
what to fix first.
6+
7+
## The rules
8+
9+
OpenRegister scores an entry each time it is saved, from rules the schema declares in
10+
`x-openregister-quality`. Stackiq declares them in
11+
`lib/Settings/register.d/data-quality.json`. Each rule has a weight.
12+
13+
| Kind | What it checks |
14+
|---|---|
15+
| required | The field is filled in. |
16+
| format | The value has the right shape, such as a URL. |
17+
| freshness | How recently someone confirmed the entry is current. Its weight halves every 365 days after `lastConfirmedAt`. |
18+
19+
An application is scored on its name, supplier, licence and long description, and on
20+
freshness. A usage is scored on its application, version, status, business owner,
21+
technical owner, the reference components it is used for, and freshness.
22+
23+
The score runs from 0 to 1. From 0.8 the status is good, from 0.5 it is fair, below
24+
that it is poor. OpenRegister writes the score to `qualityScore` and the status to
25+
`qualityStatus`. Neither field is on the edit form, because the platform overwrites it
26+
on every save.
27+
28+
## Where you see it
29+
30+
- The Applications list and the Applications in use list have a Data quality column.
31+
- The application page and the application in use page have a Data quality card with
32+
the status, the score and when the entry was last confirmed.
33+
- Reports and compliance has a Data quality page per organisation. It shows the
34+
register score, the average completeness, how many entries were never confirmed or
35+
not confirmed within a year, how many entries meet each rule, and the least complete
36+
entries first with what is missing.
37+
38+
## Confirm this entry is current
39+
40+
The Actions menu of the application page and of the application in use page has
41+
Confirm this entry is current. It sets `lastConfirmedAt` to now and changes nothing
42+
else. The save rescores the entry, so its freshness goes back to full.
43+
44+
Only a user who may change the entry can confirm it. Anyone else gets a refusal and
45+
nothing is stored. The action calls `POST /api/data-quality/confirm/{module|usage}/{id}`.
46+
47+
## Entries from before the rules
48+
49+
An entry saved before the rules existed has no score. The repair step
50+
`RescoreDataQuality` runs after the register import on upgrade. It saves every module
51+
and usage without a score once, so OpenRegister scores it, and logs how many it scored.
52+
It leaves scored entries alone. When a save fails, the next upgrade tries again.

‎l10n/en.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,13 @@ OC.L10N.register(
16071607
"Shared": "Shared",
16081608
"{name}, shared by {partner}": "{name}, shared by {partner}",
16091609
"+{count} more": "+{count} more",
1610+
"Confirm this entry is current": "Confirm this entry is current",
1611+
"Confirmed as current": "Confirmed as current",
1612+
"This entry could not be confirmed": "This entry could not be confirmed",
1613+
"You may not change this entry.": "You may not change this entry.",
1614+
"The confirmation could not be stored.": "The confirmation could not be stored.",
1615+
"When someone last confirmed this entry is current. The freshness rule halves its weight every year after.": "When someone last confirmed this entry is current. The freshness rule halves its weight every year after.",
1616+
"Data quality score": "Data quality score",
16101617
"%n organisation classified this application": "%n organisation classified this application",
16111618
"%n organisations classified this application": "%n organisations classified this application",
16121619
"Aspect": "Aspect",

‎l10n/en.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,13 @@
16061606
"Shared": "Shared",
16071607
"{name}, shared by {partner}": "{name}, shared by {partner}",
16081608
"+{count} more": "+{count} more",
1609+
"Confirm this entry is current": "Confirm this entry is current",
1610+
"Confirmed as current": "Confirmed as current",
1611+
"This entry could not be confirmed": "This entry could not be confirmed",
1612+
"You may not change this entry.": "You may not change this entry.",
1613+
"The confirmation could not be stored.": "The confirmation could not be stored.",
1614+
"When someone last confirmed this entry is current. The freshness rule halves its weight every year after.": "When someone last confirmed this entry is current. The freshness rule halves its weight every year after.",
1615+
"Data quality score": "Data quality score",
16091616
"%n organisation classified this application": "%n organisation classified this application",
16101617
"%n organisations classified this application": "%n organisations classified this application",
16111618
"Aspect": "Aspect",

‎l10n/nl.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,6 +1650,13 @@ OC.L10N.register(
16501650
"Shared": "Gedeeld",
16511651
"{name}, shared by {partner}": "{name}, gedeeld door {partner}",
16521652
"+{count} more": "+{count} meer",
1653+
"Confirm this entry is current": "Bevestig dat dit gegeven actueel is",
1654+
"Confirmed as current": "Bevestigd als actueel",
1655+
"This entry could not be confirmed": "Dit gegeven kon niet worden bevestigd",
1656+
"You may not change this entry.": "U mag dit gegeven niet wijzigen.",
1657+
"The confirmation could not be stored.": "De bevestiging kon niet worden opgeslagen.",
1658+
"When someone last confirmed this entry is current. The freshness rule halves its weight every year after.": "Wanneer iemand voor het laatst bevestigde dat dit gegeven actueel is. De versheidsregel halveert het gewicht daarna elk jaar.",
1659+
"Data quality score": "Datakwaliteitsscore",
16531660
"%n organisation classified this application": "%n organisatie heeft deze applicatie geclassificeerd",
16541661
"%n organisations classified this application": "%n organisaties hebben deze applicatie geclassificeerd",
16551662
"Aspect": "Aspect",

‎l10n/nl.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,13 @@
16491649
"Shared": "Gedeeld",
16501650
"{name}, shared by {partner}": "{name}, gedeeld door {partner}",
16511651
"+{count} more": "+{count} meer",
1652+
"Confirm this entry is current": "Bevestig dat dit gegeven actueel is",
1653+
"Confirmed as current": "Bevestigd als actueel",
1654+
"This entry could not be confirmed": "Dit gegeven kon niet worden bevestigd",
1655+
"You may not change this entry.": "U mag dit gegeven niet wijzigen.",
1656+
"The confirmation could not be stored.": "De bevestiging kon niet worden opgeslagen.",
1657+
"When someone last confirmed this entry is current. The freshness rule halves its weight every year after.": "Wanneer iemand voor het laatst bevestigde dat dit gegeven actueel is. De versheidsregel halveert het gewicht daarna elk jaar.",
1658+
"Data quality score": "Datakwaliteitsscore",
16521659
"%n organisation classified this application": "%n organisatie heeft deze applicatie geclassificeerd",
16531660
"%n organisations classified this application": "%n organisaties hebben deze applicatie geclassificeerd",
16541661
"Aspect": "Aspect",
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?php
2+
3+
/**
4+
* The Confirm this entry is current action of the application and usage pages.
5+
*
6+
* @category Controller
7+
* @package OCA\Stackiq\Controller
8+
* @author Conduction b.v. <info@conduction.nl>
9+
* @copyright 2026 Conduction B.V.
10+
* @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
11+
* @version GIT: <git_id>
12+
* @link https://github.com/ConductionNL/stackiq
13+
*
14+
* @spec openspec/changes/landscape-completeness-score/specs/catalogue-data-quality/spec.md#requirement-req-cdq-002-a-user-confirms-an-entry-is-current-and-its-freshness-resets
15+
*
16+
* SPDX-FileCopyrightText: 2026 Conduction B.V. <info@conduction.nl>
17+
* SPDX-License-Identifier: EUPL-1.2
18+
*/
19+
20+
declare(strict_types=1);
21+
22+
namespace OCA\Stackiq\Controller;
23+
24+
use OCA\Stackiq\Kernel\Contracts\EntryConfirmationServiceInterface;
25+
use OCA\Stackiq\Service\EntryConfirmationRefused;
26+
use OCP\AppFramework\Controller;
27+
use OCP\AppFramework\Http;
28+
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
29+
use OCP\AppFramework\Http\JSONResponse;
30+
use OCP\IRequest;
31+
use OCP\IUserSession;
32+
33+
/**
34+
* Confirms an application or a usage is current.
35+
*
36+
* @category Controller
37+
* @package OCA\Stackiq\Controller
38+
* @author Conduction b.v. <info@conduction.nl>
39+
* @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
40+
* @link https://github.com/ConductionNL/stackiq
41+
*
42+
* @spec openspec/changes/landscape-completeness-score/specs/catalogue-data-quality/spec.md#requirement-req-cdq-002-a-user-confirms-an-entry-is-current-and-its-freshness-resets
43+
*/
44+
class EntryConfirmationController extends Controller {
45+
/**
46+
* Constructor.
47+
*
48+
* @param string $appName The app name.
49+
* @param IRequest $request The request.
50+
* @param EntryConfirmationServiceInterface $confirmation Sets lastConfirmedAt.
51+
* @param IUserSession $userSession The current session.
52+
*
53+
* @spec exclude pure framework plumbing: constructor dependency injection.
54+
*/
55+
public function __construct(
56+
string $appName,
57+
IRequest $request,
58+
private readonly EntryConfirmationServiceInterface $confirmation,
59+
private readonly IUserSession $userSession,
60+
) {
61+
parent::__construct(appName: $appName, request: $request);
62+
}//end __construct()
63+
64+
/**
65+
* Confirm the entry is current.
66+
*
67+
* @param string $kind module or usage.
68+
* @param string $id The entry's id.
69+
*
70+
* @return JSONResponse `{lastConfirmedAt}`, or the refusal: 401 without a session, 403 without the update right,
71+
* 404 for an entry the user cannot read.
72+
*
73+
* @spec openspec/changes/landscape-completeness-score/specs/catalogue-data-quality/spec.md#requirement-req-cdq-002-a-user-confirms-an-entry-is-current-and-its-freshness-resets
74+
*/
75+
#[NoAdminRequired]
76+
public function confirm(string $kind, string $id): JSONResponse {
77+
if ($this->userSession->getUser() === null) {
78+
return new JSONResponse(['error' => 'not-logged-in'], Http::STATUS_UNAUTHORIZED);
79+
}
80+
81+
try {
82+
return new JSONResponse($this->confirmation->confirm(kind: $kind, id: $id));
83+
} catch (EntryConfirmationRefused $refusal) {
84+
$data = ['error' => $refusal->reason];
85+
if ($refusal->getMessage() !== '') {
86+
$data['message'] = $refusal->getMessage();
87+
}
88+
89+
return new JSONResponse($data, $refusal->status);
90+
}
91+
}//end confirm()
92+
}//end class
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
/**
4+
* Contract of EntryConfirmationService
5+
*
6+
* Confirms that an application or a usage is current, so its freshness resets.
7+
*
8+
* @category Kernel
9+
* @package OCA\Stackiq\Kernel\Contracts
10+
* @author Conduction b.v. <info@conduction.nl>
11+
* @copyright 2026 Conduction B.V.
12+
* @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
13+
* @version GIT: <git_id>
14+
* @link https://github.com/ConductionNL/stackiq
15+
*
16+
* @spec openspec/changes/landscape-completeness-score/specs/catalogue-data-quality/spec.md#requirement-req-cdq-002-a-user-confirms-an-entry-is-current-and-its-freshness-resets
17+
*
18+
* SPDX-FileCopyrightText: 2026 Conduction B.V. <info@conduction.nl>
19+
* SPDX-License-Identifier: EUPL-1.2
20+
*/
21+
22+
declare(strict_types=1);
23+
24+
namespace OCA\Stackiq\Kernel\Contracts;
25+
26+
use OCA\Stackiq\Service\EntryConfirmationRefused;
27+
28+
/**
29+
* Contract of EntryConfirmationService.
30+
*
31+
* @category Kernel
32+
* @package OCA\Stackiq\Kernel\Contracts
33+
* @author Conduction b.v. <info@conduction.nl>
34+
* @license EUPL-1.2 https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
35+
* @link https://github.com/ConductionNL/stackiq
36+
*
37+
* @spec exclude Structural contract, no functional requirement.
38+
*/
39+
interface EntryConfirmationServiceInterface {
40+
/**
41+
* Record that the entry is current: set its lastConfirmedAt to now, and nothing else.
42+
*
43+
* @param string $kind The kind of entry: module or usage.
44+
* @param string $id The entry's id.
45+
*
46+
* @return array{lastConfirmedAt: string} The moment stored.
47+
*
48+
* @throws EntryConfirmationRefused With the HTTP status the caller answers.
49+
*
50+
* @spec openspec/changes/landscape-completeness-score/specs/catalogue-data-quality/spec.md#requirement-req-cdq-002-a-user-confirms-an-entry-is-current-and-its-freshness-resets
51+
*/
52+
public function confirm(string $kind, string $id): array;
53+
}//end interface

0 commit comments

Comments
 (0)