Skip to content

Commit b65aff1

Browse files
authored
Merge pull request #1974 from ConductionNL/quality/build-gemma-plate-views-peers-and-definitions
feat(stackiq): build gemma-plate-views-peers-and-definitions
2 parents 26d7509 + c5930c2 commit b65aff1

22 files changed

Lines changed: 1949 additions & 39 deletions

‎docs/features/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ All data is stored as OpenRegister objects (no own database tables). OpenRegiste
3838
| [Health and metrics](observability.md) | A public health check for uptime probes and Prometheus metrics for administrators, configured in the manifest |
3939
| [Open Data Publishing](#open-data-publishing) | Expose the catalogue as a public open-data API |
4040
| [GEMMA Compliance](#gemma-compliance) | Built around VNG GEMMA Softwarecatalogus reference |
41-
| [Reference Component Coverage](reference-component-coverage.md) | Which GEMMA reference components an organisation covers, where it has gaps and where applications overlap |
41+
| [Reference Component Coverage](reference-component-coverage.md) | Which GEMMA reference components an organisation covers, where it has gaps and where applications overlap, per GEMMA view, with what comparable organisations use |
4242
| [Catalogue Exports and Custom Reports](catalogue-exports-and-reports.md) | Export lists, faceted lists and one organisation as ArchiMate, and define your own reports |
4343

4444
## Software Registration

‎docs/features/reference-component-coverage.md‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ applications in use cover, where it has a gap and where two or more
1010
applications cover the same component. It answers the information manager's
1111
question "where are we missing something, and where do we have too much?"
1212

13-
Specification:
14-
[`openspec/changes/architecture-reference-component-coverage/specs/reference-component-coverage/spec.md`](https://github.com/ConductionNL/stackiq/blob/development/openspec/changes/architecture-reference-component-coverage/specs/reference-component-coverage/spec.md).
13+
Specifications:
14+
[`reference-component-coverage`](https://github.com/ConductionNL/stackiq/blob/development/openspec/changes/architecture-reference-component-coverage/specs/reference-component-coverage/spec.md)
15+
and
16+
[`gemma-plate`](https://github.com/ConductionNL/stackiq/blob/development/openspec/changes/gemma-plate-views-peers-and-definitions/specs/gemma-plate/spec.md).
1517

1618
> Screenshots of the coverage table, the map and the Overlap section are
1719
> still pending a live-instance capture; the Playwright-captured images
@@ -53,6 +55,26 @@ then says "Import the GEMMA model to see coverage." instead of an empty table.
5355
- a detail panel for the chosen component, naming the applications in use
5456
that could fill a fillable gap.
5557

58+
### Grouping the plate by a GEMMA view
59+
60+
The **GEMMA view** picker lists the GEMMA views imported with the GEMMA model, each with its GEMMA release when the import recorded one. Pick a view, for example *GEMMA Applicatiearchitectuur, gemeentebreed*, and the plate draws that view's reference components in the view's own groups (such as Front-office, Mid-office, Back-office en basisregistraties), each with its state and the organisation's applications. Clear the picker to see the whole model grouped by the components' own GEMMA grouping.
61+
62+
The chosen view is kept in the address as `?view=<id>`, so a link opens the same plate. Without an imported GEMMA model the picker is empty and the page says the model is needed.
63+
64+
### What comparable organisations use
65+
66+
Under **Layers**, switch on **What comparable organisations use**. The table below the plate then shows per reference component your own applications and the applications comparable organisations use for it, with how many organisations use each. Select a component on the plate and its side panel lists the same applications with their counts, so a gap shows what others fill it with.
67+
68+
Comparable means the same organisation type (for example municipality) and the same inhabitants band: under 30,000; 30,000 to 60,000; 60,000 to 100,000; 100,000 to 250,000; above 250,000. Set the number of inhabitants on the organisation's page. An organisation without that number is compared with every organisation of its type. The table's heading names the type and band compared with.
69+
70+
#### The anonymity rule
71+
72+
The counts are computed on the server over all usages, and the answer never contains another organisation's id or name. An application used by fewer than 3 comparable organisations shows **fewer than 3** instead of a count, so a single organisation's choice cannot be read off the table. Only members of the organisation can open its comparison.
73+
74+
### GEMMA definitions in place
75+
76+
Select a reference component on the plate and the side panel shows its GEMMA definition. On the **Applications** and **Services** pages, the list *What the reference components are* under the GEMMA filters gives each reference component an information button. It opens the component's name *from GEMMA*, its definition, and a link **More in GEMMA Online**. A component without a definition shows only its name and the link.
77+
5678
### Coverage on a GEMMA view
5779

5880
Below the plate, **Coverage on a GEMMA view** lets the user pick an imported

‎l10n/en.js‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,6 +2280,25 @@ OC.L10N.register(
22802280
"{due} of {total} people are due for review. A review is due when access was not reviewed in the last {days} days.": "{due} of {total} people are due for review. A review is due when access was not reviewed in the last {days} days.",
22812281
"{role} removed from {person}": "{role} removed from {person}",
22822282
"Review": "Review",
2283+
"The whole GEMMA model": "The whole GEMMA model",
2284+
"Import the GEMMA model to pick a GEMMA view.": "Import the GEMMA model to pick a GEMMA view.",
2285+
"{min} to {max} inhabitants": "{min} to {max} inhabitants",
2286+
"{name} ({count})": "{name} ({count})",
2287+
"{name} (fewer than {min})": "{name} (fewer than {min})",
2288+
"above {min} inhabitants": "above {min} inhabitants",
2289+
"Comparable organisations use": "Comparable organisations use",
2290+
"Comparable organisations: {count}": "Comparable organisations: {count}",
2291+
"Layers": "Layers",
2292+
"Own applications": "Own applications",
2293+
"under {max} inhabitants": "under {max} inhabitants",
2294+
"What comparable organisations use": "What comparable organisations use",
2295+
"What comparable organisations use could not be loaded.": "What comparable organisations use could not be loaded.",
2296+
"What comparable organisations use: {type}": "What comparable organisations use: {type}",
2297+
"What comparable organisations use: {type}, {band}": "What comparable organisations use: {type}, {band}",
2298+
"{name}, from GEMMA": "{name}, from GEMMA",
2299+
"More in GEMMA Online": "More in GEMMA Online",
2300+
"What is {name}?": "What is {name}?",
2301+
"What the reference components are": "What the reference components are",
22832302
"blocked by the SSRF guard": "blocked by the SSRF guard",
22842303
"Error: {reason}": "Error: {reason}",
22852304
"Last pulled {date}": "Last pulled {date}",

‎l10n/en.json‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,25 @@
23212321
"{due} of {total} people are due for review. A review is due when access was not reviewed in the last {days} days.": "{due} of {total} people are due for review. A review is due when access was not reviewed in the last {days} days.",
23222322
"{role} removed from {person}": "{role} removed from {person}",
23232323
"Review": "Review",
2324+
"The whole GEMMA model": "The whole GEMMA model",
2325+
"Import the GEMMA model to pick a GEMMA view.": "Import the GEMMA model to pick a GEMMA view.",
2326+
"{min} to {max} inhabitants": "{min} to {max} inhabitants",
2327+
"{name} ({count})": "{name} ({count})",
2328+
"{name} (fewer than {min})": "{name} (fewer than {min})",
2329+
"above {min} inhabitants": "above {min} inhabitants",
2330+
"Comparable organisations use": "Comparable organisations use",
2331+
"Comparable organisations: {count}": "Comparable organisations: {count}",
2332+
"Layers": "Layers",
2333+
"Own applications": "Own applications",
2334+
"under {max} inhabitants": "under {max} inhabitants",
2335+
"What comparable organisations use": "What comparable organisations use",
2336+
"What comparable organisations use could not be loaded.": "What comparable organisations use could not be loaded.",
2337+
"What comparable organisations use: {type}": "What comparable organisations use: {type}",
2338+
"What comparable organisations use: {type}, {band}": "What comparable organisations use: {type}, {band}",
2339+
"{name}, from GEMMA": "{name}, from GEMMA",
2340+
"More in GEMMA Online": "More in GEMMA Online",
2341+
"What is {name}?": "What is {name}?",
2342+
"What the reference components are": "What the reference components are",
23242343
"blocked by the SSRF guard": "blocked by the SSRF guard",
23252344
"Error: {reason}": "Error: {reason}",
23262345
"Last pulled {date}": "Last pulled {date}",

‎l10n/nl.js‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,6 +2342,25 @@ OC.L10N.register(
23422342
"on the contact person": "op de contactpersoon",
23432343
"{due} of {total} people are due for review. A review is due when access was not reviewed in the last {days} days.": "{due} van {total} personen moeten worden beoordeeld. Een beoordeling is nodig als de toegang niet in de afgelopen {days} dagen is beoordeeld.",
23442344
"{role} removed from {person}": "{role} verwijderd bij {person}",
2345+
"The whole GEMMA model": "Het hele GEMMA-model",
2346+
"Import the GEMMA model to pick a GEMMA view.": "Importeer het GEMMA-model om een GEMMA-view te kiezen.",
2347+
"{min} to {max} inhabitants": "{min} tot {max} inwoners",
2348+
"{name} ({count})": "{name} ({count})",
2349+
"{name} (fewer than {min})": "{name} (minder dan {min})",
2350+
"above {min} inhabitants": "meer dan {min} inwoners",
2351+
"Comparable organisations use": "Vergelijkbare organisaties gebruiken",
2352+
"Comparable organisations: {count}": "Vergelijkbare organisaties: {count}",
2353+
"Layers": "Lagen",
2354+
"Own applications": "Eigen applicaties",
2355+
"under {max} inhabitants": "minder dan {max} inwoners",
2356+
"What comparable organisations use": "Wat vergelijkbare organisaties gebruiken",
2357+
"What comparable organisations use could not be loaded.": "Wat vergelijkbare organisaties gebruiken kon niet worden geladen.",
2358+
"What comparable organisations use: {type}": "Wat vergelijkbare organisaties gebruiken: {type}",
2359+
"What comparable organisations use: {type}, {band}": "Wat vergelijkbare organisaties gebruiken: {type}, {band}",
2360+
"{name}, from GEMMA": "{name}, uit GEMMA",
2361+
"More in GEMMA Online": "Meer in GEMMA Online",
2362+
"What is {name}?": "Wat is {name}?",
2363+
"What the reference components are": "Wat de referentiecomponenten zijn",
23452364
"blocked by the SSRF guard": "geblokkeerd door de SSRF-beveiliging",
23462365
"Error: {reason}": "Fout: {reason}",
23472366
"Last pulled {date}": "Laatst opgehaald {date}",

‎l10n/nl.json‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,6 +2383,25 @@
23832383
"on the contact person": "op de contactpersoon",
23842384
"{due} of {total} people are due for review. A review is due when access was not reviewed in the last {days} days.": "{due} van {total} personen moeten worden beoordeeld. Een beoordeling is nodig als de toegang niet in de afgelopen {days} dagen is beoordeeld.",
23852385
"{role} removed from {person}": "{role} verwijderd bij {person}",
2386+
"The whole GEMMA model": "Het hele GEMMA-model",
2387+
"Import the GEMMA model to pick a GEMMA view.": "Importeer het GEMMA-model om een GEMMA-view te kiezen.",
2388+
"{min} to {max} inhabitants": "{min} tot {max} inwoners",
2389+
"{name} ({count})": "{name} ({count})",
2390+
"{name} (fewer than {min})": "{name} (minder dan {min})",
2391+
"above {min} inhabitants": "meer dan {min} inwoners",
2392+
"Comparable organisations use": "Vergelijkbare organisaties gebruiken",
2393+
"Comparable organisations: {count}": "Vergelijkbare organisaties: {count}",
2394+
"Layers": "Lagen",
2395+
"Own applications": "Eigen applicaties",
2396+
"under {max} inhabitants": "minder dan {max} inwoners",
2397+
"What comparable organisations use": "Wat vergelijkbare organisaties gebruiken",
2398+
"What comparable organisations use could not be loaded.": "Wat vergelijkbare organisaties gebruiken kon niet worden geladen.",
2399+
"What comparable organisations use: {type}": "Wat vergelijkbare organisaties gebruiken: {type}",
2400+
"What comparable organisations use: {type}, {band}": "Wat vergelijkbare organisaties gebruiken: {type}, {band}",
2401+
"{name}, from GEMMA": "{name}, uit GEMMA",
2402+
"More in GEMMA Online": "Meer in GEMMA Online",
2403+
"What is {name}?": "Wat is {name}?",
2404+
"What the reference components are": "Wat de referentiecomponenten zijn",
23862405
"blocked by the SSRF guard": "geblokkeerd door de SSRF-beveiliging",
23872406
"Error: {reason}": "Fout: {reason}",
23882407
"Last pulled {date}": "Laatst opgehaald {date}",

‎lib/Service/FacetService.php‎

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private function computeFacetsForRequest(ObjectServiceInterface $objectService,
255255
baseObjects: $baseObjects
256256
);
257257

258-
$dimValsByObjId = $this->buildDimensionValueMap(modulesByObjectId: $modulesByObjectId);
258+
[$dimValsByObjId, $definitions] = $this->dimensionValuesAndDefinitions(modulesByObjectId: $modulesByObjectId);
259259

260260
// Supplier (insight-supplier-facet D3): the base object's OWN provider,
261261
// for a service too, keyed by organisation id and labelled by name (D2).
@@ -272,6 +272,7 @@ private function computeFacetsForRequest(ObjectServiceInterface $objectService,
272272
selectedFilters: $request['filters'],
273273
labels: ['supplier' => $this->organisationNames(objectService: $objectService, identifiers: array_values(array_unique($supplierIds)))]
274274
);
275+
$facets['referenceComponent'] = self::withDefinitions(buckets: $facets['referenceComponent'], definitions: $definitions);
275276

276277
$matchedObjectIds = $this->filterObjectIds(
277278
dimValsByObjId: $dimValsByObjId,
@@ -740,15 +741,17 @@ private function fetchModulesByIdentifiers(ObjectServiceInterface $objectService
740741
* Build the per-object GEMMA dimension value map: for every base object,
741742
* the set of referenceComponent/standard names it carries directly, and
742743
* the set of domain/applicationService names resolved transitively via its
743-
* linked `element` objects.
744+
* linked `element` objects. From the same element lookup, the GEMMA
745+
* definition of each referenceComponent value by its display name.
744746
*
745747
* @param array<string,array<int,array>> $modulesByObjectId Object id => module objects.
746748
*
747-
* @return array<string,array<string,string[]>> Object id => dimension => distinct values.
749+
* @return array{0: array<string,array<string,string[]>>, 1: array<string,array{documentation: string, gemmaUrl: string}>}
748750
*
749751
* @spec openspec/specs/gemma-faceted-search/spec.md#requirement-facet-aggregation-endpoint-returns-gemma-dimension-counts
752+
* @spec openspec/changes/gemma-plate-views-peers-and-definitions/specs/gemma-plate/spec.md#requirement-gemma-terms-show-their-definition-where-they-appear-req-gpl-003
750753
*/
751-
private function buildDimensionValueMap(array $modulesByObjectId): array {
754+
private function dimensionValuesAndDefinitions(array $modulesByObjectId): array {
752755
// Pass 1: direct fields (referenceComponent identifiers + standard identifiers).
753756
$direct = array_map(fn (array $modules): array => $this->directDimensions(modules: $modules), $modulesByObjectId);
754757
$allRefCompIds = array_values(array_unique(array_merge([], ...array_values(array_column($direct, 'refCompIds')))));
@@ -765,8 +768,77 @@ private function buildDimensionValueMap(array $modulesByObjectId): array {
765768
);
766769

767770
// Assemble the final per-object dimension map.
768-
return array_map(fn (array $values): array => $this->objectDimensions(resolution: $resolution, direct: $values), $direct);
769-
}//end buildDimensionValueMap()
771+
return [
772+
array_map(fn (array $values): array => $this->objectDimensions(resolution: $resolution, direct: $values), $direct),
773+
$this->definitionsByName(elementsById: $elementsById, refCompIds: $allRefCompIds),
774+
];
775+
}//end dimensionValuesAndDefinitions()
776+
777+
/**
778+
* The GEMMA definition and GEMMA Online link of each referenceComponent,
779+
* by the display name its facet value carries. The first element with a
780+
* name keeps it.
781+
*
782+
* @param array<string,array> $elementsById Element identifier => element object.
783+
* @param array<int,string> $refCompIds The referenceComponent identifiers.
784+
*
785+
* @return array<string,array{documentation: string, gemmaUrl: string}>
786+
*
787+
* @spec openspec/changes/gemma-plate-views-peers-and-definitions/specs/gemma-plate/spec.md#requirement-gemma-terms-show-their-definition-where-they-appear-req-gpl-003
788+
*/
789+
private function definitionsByName(array $elementsById, array $refCompIds): array {
790+
$definitions = [];
791+
foreach ($refCompIds as $refCompId) {
792+
$element = ($elementsById[$refCompId] ?? []);
793+
$name = $this->elementDisplayName(element: $element, fallbackIdentifier: $refCompId);
794+
if (isset($definitions[$name]) === true) {
795+
continue;
796+
}
797+
798+
$definitions[$name] = [
799+
'documentation' => self::trimmedString(value: ($element['documentation'] ?? null)),
800+
'gemmaUrl' => self::trimmedString(value: ($element['gemmaUrl'] ?? null)),
801+
];
802+
}
803+
804+
return $definitions;
805+
}//end definitionsByName()
806+
807+
/**
808+
* A value as a trimmed string, '' when it is not a string.
809+
*
810+
* @param mixed $value The value.
811+
*
812+
* @return string The string.
813+
*/
814+
private static function trimmedString(mixed $value): string {
815+
if (is_string($value) === true) {
816+
return trim($value);
817+
}
818+
819+
return '';
820+
}//end trimmedString()
821+
822+
/**
823+
* The referenceComponent buckets, each with its GEMMA definition and
824+
* GEMMA Online link ('' when the element has none).
825+
*
826+
* @param array<int,array{value:string,label:string,count:int}> $buckets The buckets.
827+
* @param array<string,array{documentation: string, gemmaUrl: string}> $definitions By display name.
828+
*
829+
* @return array<int,array{value:string,label:string,count:int,documentation:string,gemmaUrl:string}>
830+
*
831+
* @spec openspec/changes/gemma-plate-views-peers-and-definitions/specs/gemma-plate/spec.md#requirement-gemma-terms-show-their-definition-where-they-appear-req-gpl-003
832+
*/
833+
private static function withDefinitions(array $buckets, array $definitions): array {
834+
return array_map(
835+
static fn (array $bucket): array => array_merge(
836+
$bucket,
837+
($definitions[$bucket['value']] ?? ['documentation' => '', 'gemmaUrl' => ''])
838+
),
839+
$buckets
840+
);
841+
}//end withDefinitions()
770842

771843
/**
772844
* The referenceComponent identifiers and the standard names an object's modules carry, each distinct.

0 commit comments

Comments
 (0)