@platforma-sdk/model 1.24.11 → 1.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +676 -609
- package/dist/index.mjs.map +1 -1
- package/dist/render/api.d.ts +18 -7
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/split_selectors.d.ts +14 -0
- package/dist/render/split_selectors.d.ts.map +1 -0
- package/dist/render/util/index.d.ts +1 -1
- package/dist/render/util/label.d.ts +7 -1
- package/dist/render/util/label.d.ts.map +1 -1
- package/dist/render/util/{resource_map.d.ts → pcolumn_data.d.ts} +1 -1
- package/dist/render/util/{resource_map.d.ts.map → pcolumn_data.d.ts.map} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/render/api.ts +163 -53
- package/src/render/split_selectors.ts +15 -0
- package/src/render/util/index.ts +1 -1
- package/src/render/util/label.ts +31 -3
- /package/src/render/util/{resource_map.ts → pcolumn_data.ts} +0 -0
package/dist/render/api.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AxisId, Option, PColumn, PColumnSelector, PColumnSpec, PColumnValues, PFrameDef, PFrameHandle, PObject, PObjectSpec, PSpecPredicate, PTableDef, PTableHandle, PTableRecordFilter, PTableSorting, PlRef, ResultCollection, ValueOrError, SUniversalPColumnId, AnchoredPColumnSelector, AnchoredIdDeriver, AnyFunction } from '@milaboratories/pl-model-common';
|
|
2
2
|
import { Optional } from 'utility-types';
|
|
3
3
|
import { TreeNodeAccessor } from './accessor';
|
|
4
4
|
import { FutureRef } from './future';
|
|
5
5
|
import { LabelDerivationOps } from './util/label';
|
|
6
|
+
import { APColumnSelectorWithSplit } from './split_selectors';
|
|
7
|
+
export type UniversalOption = {
|
|
8
|
+
label: string;
|
|
9
|
+
value: SUniversalPColumnId;
|
|
10
|
+
};
|
|
6
11
|
export declare class ResultPool {
|
|
7
12
|
private readonly ctx;
|
|
8
13
|
/**
|
|
@@ -37,17 +42,17 @@ export declare class ResultPool {
|
|
|
37
42
|
* @returns An array of objects with `label` (display text) and `value` (anchored ID string) properties,
|
|
38
43
|
* or undefined if any PlRef resolution fails.
|
|
39
44
|
*/
|
|
40
|
-
getCanonicalOptions(anchorsOrCtx:
|
|
45
|
+
getCanonicalOptions(anchorsOrCtx: AnchoredIdDeriver, predicateOrSelectors: ((spec: PColumnSpec) => boolean) | APColumnSelectorWithSplit | AnchoredPColumnSelector[], labelOps?: LabelDerivationOps): {
|
|
41
46
|
label: string;
|
|
42
|
-
value:
|
|
47
|
+
value: SUniversalPColumnId;
|
|
43
48
|
}[];
|
|
44
|
-
getCanonicalOptions(anchorsOrCtx: Record<string, PColumnSpec>, predicateOrSelectors: ((spec: PColumnSpec) => boolean) |
|
|
49
|
+
getCanonicalOptions(anchorsOrCtx: Record<string, PColumnSpec>, predicateOrSelectors: ((spec: PColumnSpec) => boolean) | APColumnSelectorWithSplit | AnchoredPColumnSelector[], labelOps?: LabelDerivationOps): {
|
|
45
50
|
label: string;
|
|
46
|
-
value:
|
|
51
|
+
value: SUniversalPColumnId;
|
|
47
52
|
}[];
|
|
48
|
-
getCanonicalOptions(anchorsOrCtx: Record<string, PColumnSpec | PlRef>, predicateOrSelectors: ((spec: PColumnSpec) => boolean) |
|
|
53
|
+
getCanonicalOptions(anchorsOrCtx: Record<string, PColumnSpec | PlRef>, predicateOrSelectors: ((spec: PColumnSpec) => boolean) | APColumnSelectorWithSplit | AnchoredPColumnSelector[], labelOps?: LabelDerivationOps): {
|
|
49
54
|
label: string;
|
|
50
|
-
value:
|
|
55
|
+
value: SUniversalPColumnId;
|
|
51
56
|
}[] | undefined;
|
|
52
57
|
/**
|
|
53
58
|
* @deprecated use getData()
|
|
@@ -92,6 +97,11 @@ export declare class ResultPool {
|
|
|
92
97
|
* @deprecated delete this method after Jan 1, 2025
|
|
93
98
|
*/
|
|
94
99
|
findDataWithCompatibleSpec(spec: PColumnSpec): PObject<TreeNodeAccessor>[];
|
|
100
|
+
/**
|
|
101
|
+
* Find labels data for a given axis id. It will search for a label column and return its data as a map.
|
|
102
|
+
* @returns a map of axis value => label
|
|
103
|
+
*/
|
|
104
|
+
findLabels(axis: AxisId): Record<string | number, string> | undefined;
|
|
95
105
|
}
|
|
96
106
|
/** Main entry point to the API available within model lambdas (like outputs, sections, etc..) */
|
|
97
107
|
export declare class RenderCtx<Args, UiState> {
|
|
@@ -112,6 +122,7 @@ export declare class RenderCtx<Args, UiState> {
|
|
|
112
122
|
/**
|
|
113
123
|
* Find labels data for a given axis id. It will search for a label column and return its data as a map.
|
|
114
124
|
* @returns a map of axis value => label
|
|
125
|
+
* @deprecated Use resultPool.findLabels instead
|
|
115
126
|
*/
|
|
116
127
|
findLabels(axis: AxisId): Record<string | number, string> | undefined;
|
|
117
128
|
private verifyInlineColumnsSupport;
|
package/dist/render/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/render/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/render/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,MAAM,EACN,OAAO,EACP,eAAe,EACf,WAAW,EACX,aAAa,EACb,SAAS,EACT,YAAY,EACZ,OAAO,EACP,WAAW,EACX,cAAc,EACd,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,KAAK,EACL,gBAAgB,EAChB,YAAY,EAGZ,mBAAmB,EACnB,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EACL,iBAAiB,EAEjB,WAAW,EAEZ,MAAM,iCAAiC,CAAC;AAYzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAA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,GAAG,YAAY;IAgChB,iDAAiD;IAC1C,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAItC,wBAAwB,IAAI,MAAM,GAAG,SAAS;CAKtD;AAED,MAAM,MAAM,cAAc,CAAC,IAAI,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,IAAI,CAC7E,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,KAC3B,GAAG,CAAC;AAET,MAAM,MAAM,eAAe,CAAC,CAAC,IAC3B,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,GACxB,CAAC,GACD,CAAC,SAAS,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,GACtE,CAAC,GACD;KAAG,GAAG,IAAI,MAAM,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAAE,CAAC;AAEtD,MAAM,MAAM,yBAAyB,CAAC,EAAE,SAAS,WAAW,IAAI,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC,GAChG,eAAe,CAAC,CAAC,CAAC,GAClB,KAAK,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AAxisSelector, AnchoredPColumnSelector } from '@milaboratories/pl-model-common';
|
|
2
|
+
/**
|
|
3
|
+
* AAxisSelector with an optional split flag
|
|
4
|
+
*/
|
|
5
|
+
export type AAxisSelectorWithSplit = AAxisSelector & {
|
|
6
|
+
split?: boolean;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* APColumnSelector with an optional split flag for each axis
|
|
10
|
+
*/
|
|
11
|
+
export type APColumnSelectorWithSplit = AnchoredPColumnSelector & {
|
|
12
|
+
axes?: AAxisSelectorWithSplit[];
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=split_selectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_selectors.d.ts","sourceRoot":"","sources":["../../src/render/split_selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG;IACnD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,uBAAuB,GAAG;IAChE,IAAI,CAAC,EAAE,sBAAsB,EAAE,CAAC;CACjC,CAAC"}
|
|
@@ -48,5 +48,11 @@ export declare const Trace: z.ZodArray<z.ZodObject<{
|
|
|
48
48
|
importance?: number | undefined;
|
|
49
49
|
}>, "many">;
|
|
50
50
|
export type Trace = z.infer<typeof Trace>;
|
|
51
|
-
|
|
51
|
+
type SpecExtractorResult = PObjectSpec | {
|
|
52
|
+
spec: PObjectSpec;
|
|
53
|
+
prefixTrace?: TraceEntry[];
|
|
54
|
+
suffixTrace?: TraceEntry[];
|
|
55
|
+
};
|
|
56
|
+
export declare function deriveLabels<T>(values: T[], specExtractor: (obj: T) => SpecExtractorResult, ops?: LabelDerivationOps): RecordsWithLabel<T>[];
|
|
57
|
+
export {};
|
|
52
58
|
//# sourceMappingURL=label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../src/render/util/label.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAChD,eAAO,MAAM,gBAAgB,kBAAkB,CAAC;AAEhD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,M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B,CAAC;AACzC,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,CAAC;AAI1C,KAAK,mBAAmB,GAAG,WAAW,GAAG;IACvC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;CAC5B,CAAC;AAOF,wBAAgB,YAAY,CAAC,CAAC,EAC5B,MAAM,EAAE,CAAC,EAAE,EACX,aAAa,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,mBAAmB,EAC9C,GAAG,GAAE,kBAAuB,GAC3B,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAiIvB"}
|
|
@@ -26,4 +26,4 @@ export type PColumnKeyList = {
|
|
|
26
26
|
export declare function getPartitionKeysList(acc: TreeNodeAccessor | undefined): PColumnKeyList | undefined;
|
|
27
27
|
/** Returns an array of unique partition keys for each column: the i-th element in the resulting 2d array contains all unique values of i-th partition axis. */
|
|
28
28
|
export declare function getUniquePartitionKeys(acc: TreeNodeAccessor | undefined): (string | number)[][] | undefined;
|
|
29
|
-
//# sourceMappingURL=
|
|
29
|
+
//# sourceMappingURL=pcolumn_data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"pcolumn_data.d.ts","sourceRoot":"","sources":["../../../src/render/util/pcolumn_data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD,eAAO,MAAM,eAAe,QAA6B,CAAC;AAC1D,eAAO,MAAM,2BAA2B,QAAyC,CAAC;AAElF,eAAO,MAAM,mBAAmB,QAAiC,CAAC;AAClE,eAAO,MAAM,qBAAqB,QAAmC,CAAC;AAGtE,eAAO,MAAM,yBAAyB,QAAqC,CAAC;AAC5E,eAAO,MAAM,2BAA2B,QAAuC,CAAC;AAEhF,MAAM,MAAM,UA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ion = "1.
|
|
1
|
+
export declare const PlatformaSDKVersion = "1.25.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platforma-sdk/model",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"description": "Platforma.bio SDK / Block Model",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"utility-types": "^3.11.0",
|
|
22
22
|
"zod": "~3.23.8",
|
|
23
|
-
"@milaboratories/pl-model-common": "^1.
|
|
23
|
+
"@milaboratories/pl-model-common": "^1.12.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"typescript": "~5.5.4",
|
package/src/render/api.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
APColumnSelector,
|
|
3
2
|
AxisId,
|
|
4
|
-
CanonicalPColumnId,
|
|
5
3
|
Option,
|
|
6
4
|
PColumn,
|
|
7
5
|
PColumnSelector,
|
|
@@ -19,10 +17,14 @@ import type {
|
|
|
19
17
|
PlRef,
|
|
20
18
|
ResultCollection,
|
|
21
19
|
ValueOrError,
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
AxisFilter,
|
|
21
|
+
PValue,
|
|
22
|
+
SUniversalPColumnId,
|
|
23
|
+
AnchoredPColumnSelector } from '@milaboratories/pl-model-common';
|
|
24
24
|
import {
|
|
25
|
-
|
|
25
|
+
AnchoredIdDeriver,
|
|
26
|
+
getAxisId,
|
|
27
|
+
AnyFunction,
|
|
26
28
|
resolveAnchors,
|
|
27
29
|
} from '@milaboratories/pl-model-common';
|
|
28
30
|
import {
|
|
@@ -44,6 +46,26 @@ import type { GlobalCfgRenderCtx } from './internal';
|
|
|
44
46
|
import { MainAccessorName, StagingAccessorName } from './internal';
|
|
45
47
|
import type { LabelDerivationOps } from './util/label';
|
|
46
48
|
import { deriveLabels } from './util/label';
|
|
49
|
+
import type { APColumnSelectorWithSplit } from './split_selectors';
|
|
50
|
+
import { getUniquePartitionKeys } from './util/pcolumn_data';
|
|
51
|
+
import type { TraceEntry } from './util/label';
|
|
52
|
+
import { canonicalizeAxisId } from '@milaboratories/pl-model-common';
|
|
53
|
+
/**
|
|
54
|
+
* Helper function to match domain objects
|
|
55
|
+
* @param query Optional domain to match against
|
|
56
|
+
* @param target Optional domain to match
|
|
57
|
+
* @returns true if domains match, false otherwise
|
|
58
|
+
*/
|
|
59
|
+
function matchDomain(query?: Record<string, string>, target?: Record<string, string>) {
|
|
60
|
+
if (query === undefined) return target === undefined;
|
|
61
|
+
if (target === undefined) return true;
|
|
62
|
+
for (const k in target) {
|
|
63
|
+
if (query[k] !== target[k]) return false;
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type UniversalOption = { label: string; value: SUniversalPColumnId };
|
|
47
69
|
|
|
48
70
|
export class ResultPool {
|
|
49
71
|
private readonly ctx: GlobalCfgRenderCtx = getCfgRenderCtx();
|
|
@@ -107,35 +129,35 @@ export class ResultPool {
|
|
|
107
129
|
*/
|
|
108
130
|
// Overload for AnchorCtx - guaranteed to never return undefined
|
|
109
131
|
getCanonicalOptions(
|
|
110
|
-
anchorsOrCtx:
|
|
111
|
-
predicateOrSelectors: ((spec: PColumnSpec) => boolean) |
|
|
132
|
+
anchorsOrCtx: AnchoredIdDeriver,
|
|
133
|
+
predicateOrSelectors: ((spec: PColumnSpec) => boolean) | APColumnSelectorWithSplit | AnchoredPColumnSelector[],
|
|
112
134
|
labelOps?: LabelDerivationOps,
|
|
113
|
-
): { label: string; value:
|
|
135
|
+
): { label: string; value: SUniversalPColumnId }[];
|
|
114
136
|
|
|
115
137
|
// Overload for Record<string, PColumnSpec> - guaranteed to never return undefined
|
|
116
138
|
getCanonicalOptions(
|
|
117
139
|
anchorsOrCtx: Record<string, PColumnSpec>,
|
|
118
|
-
predicateOrSelectors: ((spec: PColumnSpec) => boolean) |
|
|
140
|
+
predicateOrSelectors: ((spec: PColumnSpec) => boolean) | APColumnSelectorWithSplit | AnchoredPColumnSelector[],
|
|
119
141
|
labelOps?: LabelDerivationOps,
|
|
120
|
-
): { label: string; value:
|
|
142
|
+
): { label: string; value: SUniversalPColumnId }[];
|
|
121
143
|
|
|
122
144
|
// Overload for Record<string, PColumnSpec | PlRef> - may return undefined if PlRef resolution fails
|
|
123
145
|
getCanonicalOptions(
|
|
124
146
|
anchorsOrCtx: Record<string, PColumnSpec | PlRef>,
|
|
125
|
-
predicateOrSelectors: ((spec: PColumnSpec) => boolean) |
|
|
147
|
+
predicateOrSelectors: ((spec: PColumnSpec) => boolean) | APColumnSelectorWithSplit | AnchoredPColumnSelector[],
|
|
126
148
|
labelOps?: LabelDerivationOps,
|
|
127
|
-
): { label: string; value:
|
|
149
|
+
): { label: string; value: SUniversalPColumnId }[] | undefined;
|
|
128
150
|
|
|
129
151
|
// Implementation
|
|
130
152
|
getCanonicalOptions(
|
|
131
|
-
anchorsOrCtx:
|
|
132
|
-
predicateOrSelectors: ((spec: PColumnSpec) => boolean) |
|
|
153
|
+
anchorsOrCtx: AnchoredIdDeriver | Record<string, PColumnSpec | PlRef>,
|
|
154
|
+
predicateOrSelectors: ((spec: PColumnSpec) => boolean) | APColumnSelectorWithSplit | AnchoredPColumnSelector[],
|
|
133
155
|
labelOps?: LabelDerivationOps,
|
|
134
|
-
): { label: string; value:
|
|
156
|
+
): { label: string; value: SUniversalPColumnId }[] | undefined {
|
|
135
157
|
// Handle PlRef objects by resolving them to PColumnSpec
|
|
136
158
|
const resolvedAnchors: Record<string, PColumnSpec> = {};
|
|
137
159
|
|
|
138
|
-
if (!(anchorsOrCtx instanceof
|
|
160
|
+
if (!(anchorsOrCtx instanceof AnchoredIdDeriver)) {
|
|
139
161
|
for (const [key, value] of Object.entries(anchorsOrCtx)) {
|
|
140
162
|
if (isPlRef(value)) {
|
|
141
163
|
const resolvedSpec = this.getPColumnSpecByRef(value);
|
|
@@ -161,12 +183,100 @@ export class ResultPool {
|
|
|
161
183
|
return predicate(spec);
|
|
162
184
|
});
|
|
163
185
|
|
|
164
|
-
|
|
186
|
+
if (filtered.length === 0)
|
|
187
|
+
return [];
|
|
188
|
+
|
|
189
|
+
const anchorIdDeriver = anchorsOrCtx instanceof AnchoredIdDeriver
|
|
165
190
|
? anchorsOrCtx
|
|
166
|
-
: new
|
|
191
|
+
: new AnchoredIdDeriver(resolvedAnchors);
|
|
192
|
+
|
|
193
|
+
const splitAxisIdxs = typeof predicateOrSelectors === 'object'
|
|
194
|
+
&& !Array.isArray(predicateOrSelectors)
|
|
195
|
+
&& 'axes' in predicateOrSelectors
|
|
196
|
+
&& predicateOrSelectors.axes !== undefined
|
|
197
|
+
&& predicateOrSelectors.partialAxesMatch === undefined
|
|
198
|
+
? predicateOrSelectors.axes
|
|
199
|
+
.map((axis, index) => ('split' in axis && axis.split === true) ? index : -1)
|
|
200
|
+
.filter((index) => index !== -1)
|
|
201
|
+
: [];
|
|
202
|
+
splitAxisIdxs.sort((a, b) => a - b);
|
|
203
|
+
|
|
204
|
+
if (splitAxisIdxs.length > 0) {
|
|
205
|
+
const result: { obj: PColumnSpec; ref: PlRef; filteringTrace: TraceEntry[]; filters: AxisFilter[] }[] = [];
|
|
206
|
+
|
|
207
|
+
const maxSplitIdx = splitAxisIdxs[splitAxisIdxs.length - 1]; // Last one is max since they're sorted
|
|
208
|
+
|
|
209
|
+
for (const { ref, obj: spec } of filtered) {
|
|
210
|
+
if (!isPColumnSpec(spec)) continue;
|
|
211
|
+
|
|
212
|
+
const columnData = this.getDataByRef(ref);
|
|
213
|
+
if (!columnData || !isPColumn(columnData)) continue;
|
|
214
|
+
|
|
215
|
+
const uniqueKeys = getUniquePartitionKeys(columnData.data);
|
|
216
|
+
if (!uniqueKeys) continue; // data not fully initialized yet
|
|
217
|
+
|
|
218
|
+
if (maxSplitIdx >= uniqueKeys.length)
|
|
219
|
+
throw new Error(`Not enough partition keys for the requested split axes in column ${spec.name}`);
|
|
220
|
+
|
|
221
|
+
const axesLabels: (Record<string | number, string> | undefined)[] = splitAxisIdxs
|
|
222
|
+
.map((idx) => this.findLabels(getAxisId(spec.axesSpec[idx])));
|
|
223
|
+
|
|
224
|
+
const keyCombinations: (string | number)[][] = [];
|
|
225
|
+
const generateCombinations = (currentCombo: (string | number)[], sAxisIdx: number) => {
|
|
226
|
+
if (sAxisIdx >= splitAxisIdxs.length) {
|
|
227
|
+
keyCombinations.push([...currentCombo]);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const axisIdx = splitAxisIdxs[sAxisIdx];
|
|
231
|
+
const axisValues = uniqueKeys[axisIdx];
|
|
232
|
+
for (const val of axisValues) {
|
|
233
|
+
currentCombo.push(val);
|
|
234
|
+
generateCombinations(currentCombo, sAxisIdx + 1);
|
|
235
|
+
currentCombo.pop();
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
generateCombinations([], 0);
|
|
239
|
+
|
|
240
|
+
for (const keyCombo of keyCombinations) {
|
|
241
|
+
const filteringTrace: TraceEntry[] = keyCombo.map((value, sAxisIdx) => {
|
|
242
|
+
const axisIdx = splitAxisIdxs[sAxisIdx];
|
|
243
|
+
const canonicalAxisId = canonicalizeAxisId(getAxisId(spec.axesSpec[axisIdx]));
|
|
244
|
+
const axisLabels = axesLabels[sAxisIdx];
|
|
245
|
+
const label = axisLabels?.[value] ?? String(value);
|
|
246
|
+
return {
|
|
247
|
+
type: `split:${canonicalAxisId}`,
|
|
248
|
+
label,
|
|
249
|
+
importance: 1_000_000,
|
|
250
|
+
};
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
const filters: AxisFilter[] = splitAxisIdxs.map((idx, i) => [idx, keyCombo[i] as PValue]);
|
|
254
|
+
result.push({
|
|
255
|
+
obj: spec,
|
|
256
|
+
ref,
|
|
257
|
+
filteringTrace: filteringTrace,
|
|
258
|
+
filters,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const labelResults = deriveLabels(
|
|
264
|
+
result,
|
|
265
|
+
(o) => ({
|
|
266
|
+
spec: o.obj,
|
|
267
|
+
suffixTrace: o.filteringTrace,
|
|
268
|
+
}),
|
|
269
|
+
labelOps ?? {},
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
return labelResults.map((item) => ({
|
|
273
|
+
value: anchorIdDeriver.deriveS(item.value.obj as PColumnSpec, item.value.filters),
|
|
274
|
+
label: item.label,
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
167
277
|
|
|
168
278
|
return deriveLabels(filtered, (o) => o.obj, labelOps ?? {}).map(({ value: { obj: spec }, label }) => ({
|
|
169
|
-
value: anchorIdDeriver.
|
|
279
|
+
value: anchorIdDeriver.deriveS(spec as PColumnSpec),
|
|
170
280
|
label,
|
|
171
281
|
}));
|
|
172
282
|
}
|
|
@@ -327,15 +437,40 @@ export class ResultPool {
|
|
|
327
437
|
}
|
|
328
438
|
return result;
|
|
329
439
|
}
|
|
330
|
-
}
|
|
331
440
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
441
|
+
/**
|
|
442
|
+
* Find labels data for a given axis id. It will search for a label column and return its data as a map.
|
|
443
|
+
* @returns a map of axis value => label
|
|
444
|
+
*/
|
|
445
|
+
public findLabels(axis: AxisId): Record<string | number, string> | undefined {
|
|
446
|
+
const dataPool = this.getData();
|
|
447
|
+
for (const column of dataPool.entries) {
|
|
448
|
+
if (!isPColumn(column.obj)) continue;
|
|
449
|
+
|
|
450
|
+
const spec = column.obj.spec;
|
|
451
|
+
if (
|
|
452
|
+
spec.name === 'pl7.app/label'
|
|
453
|
+
&& spec.axesSpec.length === 1
|
|
454
|
+
&& spec.axesSpec[0].name === axis.name
|
|
455
|
+
&& spec.axesSpec[0].type === axis.type
|
|
456
|
+
&& matchDomain(axis.domain, spec.axesSpec[0].domain)
|
|
457
|
+
) {
|
|
458
|
+
if (column.obj.data.resourceType.name !== 'PColumnData/Json') {
|
|
459
|
+
throw Error(`Expected JSON column for labels, got: ${column.obj.data.resourceType.name}`);
|
|
460
|
+
}
|
|
461
|
+
const labels: Record<string | number, string> = Object.fromEntries(
|
|
462
|
+
Object.entries(
|
|
463
|
+
column.obj.data.getDataAsJson<{
|
|
464
|
+
data: Record<string | number, string>;
|
|
465
|
+
}>().data,
|
|
466
|
+
).map((e) => [JSON.parse(e[0])[0], e[1]]),
|
|
467
|
+
);
|
|
468
|
+
|
|
469
|
+
return labels;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
return undefined;
|
|
337
473
|
}
|
|
338
|
-
return true;
|
|
339
474
|
}
|
|
340
475
|
|
|
341
476
|
/** Main entry point to the API available within model lambdas (like outputs, sections, etc..) */
|
|
@@ -391,35 +526,10 @@ export class RenderCtx<Args, UiState> {
|
|
|
391
526
|
/**
|
|
392
527
|
* Find labels data for a given axis id. It will search for a label column and return its data as a map.
|
|
393
528
|
* @returns a map of axis value => label
|
|
529
|
+
* @deprecated Use resultPool.findLabels instead
|
|
394
530
|
*/
|
|
395
531
|
public findLabels(axis: AxisId): Record<string | number, string> | undefined {
|
|
396
|
-
|
|
397
|
-
for (const column of dataPool.entries) {
|
|
398
|
-
if (!isPColumn(column.obj)) continue;
|
|
399
|
-
|
|
400
|
-
const spec = column.obj.spec;
|
|
401
|
-
if (
|
|
402
|
-
spec.name === 'pl7.app/label'
|
|
403
|
-
&& spec.axesSpec.length === 1
|
|
404
|
-
&& spec.axesSpec[0].name === axis.name
|
|
405
|
-
&& spec.axesSpec[0].type === axis.type
|
|
406
|
-
&& matchDomain(axis.domain, spec.axesSpec[0].domain)
|
|
407
|
-
) {
|
|
408
|
-
if (column.obj.data.resourceType.name !== 'PColumnData/Json') {
|
|
409
|
-
throw Error(`Expected JSON column for labels, got: ${column.obj.data.resourceType.name}`);
|
|
410
|
-
}
|
|
411
|
-
const labels: Record<string | number, string> = Object.fromEntries(
|
|
412
|
-
Object.entries(
|
|
413
|
-
column.obj.data.getDataAsJson<{
|
|
414
|
-
data: Record<string | number, string>;
|
|
415
|
-
}>().data,
|
|
416
|
-
).map((e) => [JSON.parse(e[0])[0], e[1]]),
|
|
417
|
-
);
|
|
418
|
-
|
|
419
|
-
return labels;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
return undefined;
|
|
532
|
+
return this.resultPool.findLabels(axis);
|
|
423
533
|
}
|
|
424
534
|
|
|
425
535
|
private verifyInlineColumnsSupport(columns: PColumn<TreeNodeAccessor | PColumnValues>[]) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AAxisSelector, AnchoredPColumnSelector } from '@milaboratories/pl-model-common';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AAxisSelector with an optional split flag
|
|
5
|
+
*/
|
|
6
|
+
export type AAxisSelectorWithSplit = AAxisSelector & {
|
|
7
|
+
split?: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* APColumnSelector with an optional split flag for each axis
|
|
12
|
+
*/
|
|
13
|
+
export type APColumnSelectorWithSplit = AnchoredPColumnSelector & {
|
|
14
|
+
axes?: AAxisSelectorWithSplit[];
|
|
15
|
+
};
|
package/src/render/util/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './pcolumn_data';
|
|
2
2
|
export * from './label';
|
package/src/render/util/label.ts
CHANGED
|
@@ -31,6 +31,13 @@ export const Trace = z.array(TraceEntry);
|
|
|
31
31
|
export type Trace = z.infer<typeof Trace>;
|
|
32
32
|
type FullTrace = FullTraceEntry[];
|
|
33
33
|
|
|
34
|
+
// Define the possible return types for the specExtractor function
|
|
35
|
+
type SpecExtractorResult = PObjectSpec | {
|
|
36
|
+
spec: PObjectSpec;
|
|
37
|
+
prefixTrace?: TraceEntry[];
|
|
38
|
+
suffixTrace?: TraceEntry[];
|
|
39
|
+
};
|
|
40
|
+
|
|
34
41
|
const DistancePenalty = 0.001;
|
|
35
42
|
|
|
36
43
|
const LabelType = '__LABEL__';
|
|
@@ -38,7 +45,7 @@ const LabelTypeFull = '__LABEL__@1';
|
|
|
38
45
|
|
|
39
46
|
export function deriveLabels<T>(
|
|
40
47
|
values: T[],
|
|
41
|
-
specExtractor: (obj: T) =>
|
|
48
|
+
specExtractor: (obj: T) => SpecExtractorResult,
|
|
42
49
|
ops: LabelDerivationOps = {},
|
|
43
50
|
): RecordsWithLabel<T>[] {
|
|
44
51
|
const importances = new Map<string, number>();
|
|
@@ -47,10 +54,31 @@ export function deriveLabels<T>(
|
|
|
47
54
|
const numberOfRecordsWithType = new Map<string, number>();
|
|
48
55
|
|
|
49
56
|
const enrichedRecords = values.map((value) => {
|
|
50
|
-
const
|
|
57
|
+
const extractorResult = specExtractor(value);
|
|
58
|
+
let spec: PObjectSpec;
|
|
59
|
+
let prefixTrace: TraceEntry[] | undefined;
|
|
60
|
+
let suffixTrace: TraceEntry[] | undefined;
|
|
61
|
+
|
|
62
|
+
// Check if the result is the new structure or just PObjectSpec
|
|
63
|
+
if ('spec' in extractorResult && typeof extractorResult.spec === 'object') {
|
|
64
|
+
// It's the new structure { spec, prefixTrace?, suffixTrace? }
|
|
65
|
+
spec = extractorResult.spec;
|
|
66
|
+
prefixTrace = extractorResult.prefixTrace;
|
|
67
|
+
suffixTrace = extractorResult.suffixTrace;
|
|
68
|
+
} else {
|
|
69
|
+
// It's just PObjectSpec
|
|
70
|
+
spec = extractorResult as PObjectSpec;
|
|
71
|
+
}
|
|
72
|
+
|
|
51
73
|
const label = spec.annotations?.[PAnnotationLabel];
|
|
52
74
|
const traceStr = spec.annotations?.[PAnnotationTrace];
|
|
53
|
-
const
|
|
75
|
+
const baseTrace = (traceStr ? Trace.safeParse(JSON.parse(traceStr)).data : undefined) ?? [];
|
|
76
|
+
|
|
77
|
+
const trace = [
|
|
78
|
+
...(prefixTrace ?? []),
|
|
79
|
+
...baseTrace,
|
|
80
|
+
...(suffixTrace ?? []),
|
|
81
|
+
];
|
|
54
82
|
|
|
55
83
|
if (label) {
|
|
56
84
|
const labelEntry = { label, type: LabelType, importance: -2 };
|
|
File without changes
|