|
|
@@ -173,18 +173,26 @@ export class AdjusterService {
|
|
|
|
|
|
calculateClusters(): void {
|
|
|
this._clusteringInProcess = true;
|
|
|
+ /* Pre-process the API params */
|
|
|
+ const params = [];
|
|
|
+ for (const factor of this.factors) {
|
|
|
+ for (const dataset of factor.datasets) {
|
|
|
+ if (!dataset.included) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ const flattenedDataset = {
|
|
|
+ id: dataset.id.split('/').slice(-1).pop(), //We do not need full URIs as the URNs are unique across the ontology
|
|
|
+ factor: factor.id.split('/').slice(-1).pop(), //We do not need full URIs as the URNs are unique across the ontology
|
|
|
+ weight: factor.weight
|
|
|
+ };
|
|
|
+ params.push(flattenedDataset)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
this.$http
|
|
|
.post(this.serviceBaseUrl + 'cz/clusters/', {
|
|
|
numberOfClusters: this.numberOfClusters,
|
|
|
- factors: this.factors.map((f) => {
|
|
|
- return {
|
|
|
- factor: f.name,
|
|
|
- weight: f.weight,
|
|
|
- datasets: f.datasets
|
|
|
- .filter((ds) => ds.included)
|
|
|
- .map((ds) => ds.name),
|
|
|
- };
|
|
|
- }),
|
|
|
+ datasets: params
|
|
|
})
|
|
|
.toPromise()
|
|
|
.then((data: any) => {
|