@aivue/tabular-intelligence 2.0.0 → 2.0.1
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/README.md +15 -1
- package/dist/composables/useTabularIntelligence.d.ts +1 -1
- package/dist/composables/useTabularIntelligence.d.ts.map +1 -1
- package/dist/index.d.ts +24 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +399 -376
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createCompatComponent as B, createCompatPlugin as se, registerCompatComponent as F } from "@aivue/core";
|
|
2
|
+
import { ref as x, defineComponent as W, createElementBlock as C, openBlock as A, createElementVNode as b, createCommentVNode as T, withDirectives as Se, withKeys as Z, withModifiers as ee, vModelText as Ne, toDisplayString as M, normalizeClass as ke, createTextVNode as Ie, Fragment as j, renderList as Q, computed as $e } from "vue";
|
|
2
3
|
function _(s, e) {
|
|
3
4
|
if (s.length === 0)
|
|
4
5
|
return { columns: [], rowCount: 0, name: e };
|
|
5
6
|
const t = s[0];
|
|
6
7
|
return {
|
|
7
8
|
columns: Object.keys(t).map((o) => {
|
|
8
|
-
const a =
|
|
9
|
+
const a = oe(s, o);
|
|
9
10
|
return {
|
|
10
11
|
name: o,
|
|
11
12
|
type: a,
|
|
@@ -16,7 +17,7 @@ function _(s, e) {
|
|
|
16
17
|
name: e
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function oe(s, e) {
|
|
20
21
|
const t = s.map((o) => o[e]).filter((o) => o != null);
|
|
21
22
|
if (t.length === 0) return "string";
|
|
22
23
|
if (t.every((o) => typeof o == "number" || !isNaN(Number(o))))
|
|
@@ -28,7 +29,7 @@ function te(s, e) {
|
|
|
28
29
|
const n = new Set(t);
|
|
29
30
|
return n.size < t.length * 0.5 && n.size < 20 ? "categorical" : "string";
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function ae(s, e, t) {
|
|
32
33
|
const n = s.map((r) => r[e]).filter((r) => r != null), o = n.length, a = s.length - o, i = {
|
|
33
34
|
column: e,
|
|
34
35
|
count: o,
|
|
@@ -60,7 +61,7 @@ function ne(s, e, t) {
|
|
|
60
61
|
}
|
|
61
62
|
return i;
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
+
function Me(s, e, t = 0.5) {
|
|
64
65
|
const n = [], o = 1.5 + (1 - t) * 1.5;
|
|
65
66
|
return e.forEach((a) => {
|
|
66
67
|
const i = s.map((f, h) => ({ value: Number(f[a]), idx: h })).filter((f) => !isNaN(f.value));
|
|
@@ -80,7 +81,7 @@ function Ce(s, e, t = 0.5) {
|
|
|
80
81
|
});
|
|
81
82
|
}), n.sort((a, i) => i.score - a.score);
|
|
82
83
|
}
|
|
83
|
-
class
|
|
84
|
+
class te {
|
|
84
85
|
constructor(e) {
|
|
85
86
|
this.config = {
|
|
86
87
|
maxTokens: 1e3,
|
|
@@ -141,7 +142,7 @@ class Z {
|
|
|
141
142
|
for (const o of t.columns)
|
|
142
143
|
if (o.type === "number" && e.length > 0)
|
|
143
144
|
try {
|
|
144
|
-
const a =
|
|
145
|
+
const a = ae(e, o.name, "number");
|
|
145
146
|
n[o.name] = {
|
|
146
147
|
mean: a.mean,
|
|
147
148
|
median: a.median,
|
|
@@ -441,7 +442,7 @@ Please add your API key in the AI Chatbot Configuration section for advanced fea
|
|
|
441
442
|
return `qa_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
442
443
|
}
|
|
443
444
|
}
|
|
444
|
-
function
|
|
445
|
+
function xe(s = {}) {
|
|
445
446
|
const {
|
|
446
447
|
selector: e = "table",
|
|
447
448
|
includeHeaders: t = !0,
|
|
@@ -486,7 +487,7 @@ function Ae(s = {}) {
|
|
|
486
487
|
}), m.push(w);
|
|
487
488
|
}
|
|
488
489
|
return {
|
|
489
|
-
schema: o && m.length > 0 ? _(m, "Extracted Table") :
|
|
490
|
+
schema: o && m.length > 0 ? _(m, "Extracted Table") : Pe(l, m.length),
|
|
490
491
|
data: m,
|
|
491
492
|
source: "dom",
|
|
492
493
|
metadata: {
|
|
@@ -497,14 +498,14 @@ function Ae(s = {}) {
|
|
|
497
498
|
}
|
|
498
499
|
};
|
|
499
500
|
}
|
|
500
|
-
function
|
|
501
|
+
function qe(s, e, t = {}) {
|
|
501
502
|
const { maxRows: n, inferTypes: o = !0 } = t, a = n ? s.slice(0, n) : s;
|
|
502
503
|
let i;
|
|
503
504
|
return e && e.length > 0 ? i = {
|
|
504
505
|
name: "Vue Data Grid",
|
|
505
506
|
columns: e.map((r) => ({
|
|
506
507
|
name: r.field,
|
|
507
|
-
type: o && a.length > 0 ?
|
|
508
|
+
type: o && a.length > 0 ? oe(a, r.field) : "string",
|
|
508
509
|
nullable: !0
|
|
509
510
|
})),
|
|
510
511
|
rowCount: a.length
|
|
@@ -519,7 +520,7 @@ function Se(s, e, t = {}) {
|
|
|
519
520
|
}
|
|
520
521
|
};
|
|
521
522
|
}
|
|
522
|
-
function
|
|
523
|
+
function Pe(s, e = 0) {
|
|
523
524
|
return {
|
|
524
525
|
name: "Extracted Table",
|
|
525
526
|
columns: s.map((t) => ({
|
|
@@ -530,15 +531,15 @@ function Ne(s, e = 0) {
|
|
|
530
531
|
rowCount: e
|
|
531
532
|
};
|
|
532
533
|
}
|
|
533
|
-
function
|
|
534
|
+
function Te(s) {
|
|
534
535
|
const e = {};
|
|
535
536
|
s.variable && s.variable.forEach((a) => {
|
|
536
537
|
e[a.key] = a.value;
|
|
537
538
|
});
|
|
538
|
-
const t = s.auth ?
|
|
539
|
+
const t = s.auth ? re(s.auth) : void 0, n = [];
|
|
539
540
|
function o(a, i = "") {
|
|
540
541
|
a.forEach((r) => {
|
|
541
|
-
r.item ? o(r.item, i ? `${i}/${r.name}` : r.name) : r.request && n.push(
|
|
542
|
+
r.item ? o(r.item, i ? `${i}/${r.name}` : r.name) : r.request && n.push(De(r, t));
|
|
542
543
|
});
|
|
543
544
|
}
|
|
544
545
|
return o(s.item), {
|
|
@@ -549,7 +550,7 @@ function ke(s) {
|
|
|
549
550
|
auth: t
|
|
550
551
|
};
|
|
551
552
|
}
|
|
552
|
-
function
|
|
553
|
+
function De(s, e) {
|
|
553
554
|
const t = s.request, n = {};
|
|
554
555
|
t.header && t.header.forEach((i) => {
|
|
555
556
|
n[i.key] = i.value;
|
|
@@ -558,7 +559,7 @@ function $e(s, e) {
|
|
|
558
559
|
t.url.query && t.url.query.forEach((i) => {
|
|
559
560
|
o[i.key] = i.value;
|
|
560
561
|
});
|
|
561
|
-
const a = t.auth ?
|
|
562
|
+
const a = t.auth ? re(t.auth) : e;
|
|
562
563
|
return {
|
|
563
564
|
name: s.name,
|
|
564
565
|
method: t.method,
|
|
@@ -569,7 +570,7 @@ function $e(s, e) {
|
|
|
569
570
|
auth: a
|
|
570
571
|
};
|
|
571
572
|
}
|
|
572
|
-
function
|
|
573
|
+
function re(s) {
|
|
573
574
|
const e = {};
|
|
574
575
|
return s.apikey ? s.apikey.forEach((t) => {
|
|
575
576
|
e[t.key] = t.value;
|
|
@@ -589,7 +590,7 @@ function D(s, e) {
|
|
|
589
590
|
t = t.replace(o, e[n]);
|
|
590
591
|
}), t;
|
|
591
592
|
}
|
|
592
|
-
async function
|
|
593
|
+
async function ie(s) {
|
|
593
594
|
const { endpoint: e, variables: t = {}, additionalHeaders: n = {}, additionalParams: o = {} } = s;
|
|
594
595
|
try {
|
|
595
596
|
let a = D(e.url, t);
|
|
@@ -638,32 +639,32 @@ async function oe(s) {
|
|
|
638
639
|
};
|
|
639
640
|
}
|
|
640
641
|
}
|
|
641
|
-
async function
|
|
642
|
+
async function Nn(s, e = {}) {
|
|
642
643
|
const t = [];
|
|
643
644
|
for (const n of s) {
|
|
644
|
-
const o = await
|
|
645
|
+
const o = await ie({ endpoint: n, variables: e });
|
|
645
646
|
t.push(o);
|
|
646
647
|
}
|
|
647
648
|
return t;
|
|
648
649
|
}
|
|
649
|
-
function
|
|
650
|
+
function _e(s) {
|
|
650
651
|
if (!s.success || !s.data)
|
|
651
652
|
return [];
|
|
652
653
|
const e = s.data;
|
|
653
654
|
return Array.isArray(e) ? e : e.data && Array.isArray(e.data) ? e.data : e.results && Array.isArray(e.results) ? e.results : e.items && Array.isArray(e.items) ? e.items : typeof e == "object" ? [e] : [];
|
|
654
655
|
}
|
|
655
|
-
class
|
|
656
|
+
class ce {
|
|
656
657
|
constructor(e, t) {
|
|
657
658
|
this.config = {
|
|
658
659
|
timeout: 3e4,
|
|
659
660
|
...e
|
|
660
|
-
}, t && (this.qaEngine = new
|
|
661
|
+
}, t && (this.qaEngine = new te(t));
|
|
661
662
|
}
|
|
662
663
|
/**
|
|
663
664
|
* Initialize or update Q&A engine
|
|
664
665
|
*/
|
|
665
666
|
initializeQA(e) {
|
|
666
|
-
this.qaEngine = new
|
|
667
|
+
this.qaEngine = new te(e);
|
|
667
668
|
}
|
|
668
669
|
/**
|
|
669
670
|
* Generic API call to TFM endpoint
|
|
@@ -804,13 +805,13 @@ class Me {
|
|
|
804
805
|
* Extract table from DOM
|
|
805
806
|
*/
|
|
806
807
|
extractFromDOM(e) {
|
|
807
|
-
return
|
|
808
|
+
return xe(e);
|
|
808
809
|
}
|
|
809
810
|
/**
|
|
810
811
|
* Normalize Vue data grid data
|
|
811
812
|
*/
|
|
812
813
|
normalizeVueData(e, t, n) {
|
|
813
|
-
return
|
|
814
|
+
return qe(e, t, n);
|
|
814
815
|
}
|
|
815
816
|
/**
|
|
816
817
|
* Update configuration
|
|
@@ -832,7 +833,7 @@ class Me {
|
|
|
832
833
|
* Load Postman collection
|
|
833
834
|
*/
|
|
834
835
|
loadPostmanCollection(e) {
|
|
835
|
-
return this.parsedCollection =
|
|
836
|
+
return this.parsedCollection = Te(e), this.parsedCollection;
|
|
836
837
|
}
|
|
837
838
|
/**
|
|
838
839
|
* Get loaded collection
|
|
@@ -859,10 +860,10 @@ class Me {
|
|
|
859
860
|
const o = {
|
|
860
861
|
...this.parsedCollection.variables,
|
|
861
862
|
...t
|
|
862
|
-
}, a = await
|
|
863
|
+
}, a = await ie({ endpoint: n, variables: o });
|
|
863
864
|
if (!a.success)
|
|
864
865
|
throw new Error(`API request failed: ${a.error}`);
|
|
865
|
-
const i =
|
|
866
|
+
const i = _e(a), r = _(i);
|
|
866
867
|
return { data: i, schema: r };
|
|
867
868
|
}
|
|
868
869
|
/**
|
|
@@ -897,8 +898,8 @@ class Me {
|
|
|
897
898
|
})) : [];
|
|
898
899
|
}
|
|
899
900
|
}
|
|
900
|
-
function
|
|
901
|
-
const e = new
|
|
901
|
+
function Oe(s) {
|
|
902
|
+
const e = new ce(s.config, s.qaConfig), t = x(!1), n = x(null), o = x(null), a = s.data || x([]), i = s.schema || x(null), r = x([]), c = x([]), l = x(null), u = s.maxQuestionHistory || 50, m = s.useLocalFallback !== !1;
|
|
902
903
|
async function d(y, v) {
|
|
903
904
|
t.value = !0, n.value = null;
|
|
904
905
|
try {
|
|
@@ -907,15 +908,15 @@ function fn(s) {
|
|
|
907
908
|
const k = f(y, v);
|
|
908
909
|
return o.value = k, k;
|
|
909
910
|
}
|
|
910
|
-
const
|
|
911
|
+
const I = {
|
|
911
912
|
type: y,
|
|
912
913
|
data: a.value,
|
|
913
914
|
schema: i.value || void 0,
|
|
914
915
|
options: v
|
|
915
|
-
},
|
|
916
|
-
return o.value =
|
|
917
|
-
} catch (
|
|
918
|
-
if (n.value =
|
|
916
|
+
}, $ = await e.analyze(I);
|
|
917
|
+
return o.value = $, $;
|
|
918
|
+
} catch (I) {
|
|
919
|
+
if (n.value = I instanceof Error ? I : new Error("Analysis failed"), m)
|
|
919
920
|
return console.log("⚠️ API call failed, falling back to local analysis"), f(y, v);
|
|
920
921
|
throw n.value;
|
|
921
922
|
} finally {
|
|
@@ -923,25 +924,25 @@ function fn(s) {
|
|
|
923
924
|
}
|
|
924
925
|
}
|
|
925
926
|
function f(y, v) {
|
|
926
|
-
const
|
|
927
|
+
const I = i.value || _(a.value);
|
|
927
928
|
switch (y) {
|
|
928
929
|
case "descriptive_stats": {
|
|
929
|
-
const
|
|
930
|
-
(k) =>
|
|
930
|
+
const $ = I.columns.map(
|
|
931
|
+
(k) => ae(a.value, k.name, k.type)
|
|
931
932
|
);
|
|
932
933
|
return {
|
|
933
934
|
type: y,
|
|
934
935
|
timestamp: /* @__PURE__ */ new Date(),
|
|
935
|
-
descriptiveStats:
|
|
936
|
-
summary: `Calculated statistics for ${
|
|
936
|
+
descriptiveStats: $,
|
|
937
|
+
summary: `Calculated statistics for ${$.length} columns`,
|
|
937
938
|
insights: [],
|
|
938
939
|
confidence: 0.9
|
|
939
940
|
};
|
|
940
941
|
}
|
|
941
942
|
case "anomaly_detection": {
|
|
942
|
-
const
|
|
943
|
+
const $ = I.columns.filter((N) => N.type === "number").map((N) => N.name), k = Me(
|
|
943
944
|
a.value,
|
|
944
|
-
|
|
945
|
+
$,
|
|
945
946
|
v == null ? void 0 : v.sensitivity
|
|
946
947
|
);
|
|
947
948
|
return {
|
|
@@ -955,33 +956,33 @@ function fn(s) {
|
|
|
955
956
|
}
|
|
956
957
|
case "clustering":
|
|
957
958
|
case "segmentation": {
|
|
958
|
-
const
|
|
959
|
-
id:
|
|
960
|
-
label: `Cluster ${
|
|
959
|
+
const $ = (v == null ? void 0 : v.features) || I.columns.filter((P) => P.type === "number").map((P) => P.name), k = (v == null ? void 0 : v.numClusters) || 3, N = Array.from({ length: k }, (P, L) => ({
|
|
960
|
+
id: L,
|
|
961
|
+
label: `Cluster ${L + 1}`,
|
|
961
962
|
centroid: {},
|
|
962
963
|
size: Math.floor(a.value.length / k),
|
|
963
|
-
characteristics: [`Group ${
|
|
964
|
+
characteristics: [`Group ${L + 1} characteristics`]
|
|
964
965
|
}));
|
|
965
966
|
return {
|
|
966
967
|
type: y,
|
|
967
968
|
timestamp: /* @__PURE__ */ new Date(),
|
|
968
969
|
clusters: N,
|
|
969
|
-
summary: `Created ${k} clusters based on ${
|
|
970
|
+
summary: `Created ${k} clusters based on ${$.length} features`,
|
|
970
971
|
insights: [`Data segmented into ${k} distinct groups`],
|
|
971
972
|
confidence: 0.75
|
|
972
973
|
};
|
|
973
974
|
}
|
|
974
975
|
case "correlation": {
|
|
975
|
-
const
|
|
976
|
-
return
|
|
977
|
-
k[N] = {},
|
|
976
|
+
const $ = (v == null ? void 0 : v.features) || I.columns.filter((N) => N.type === "number").map((N) => N.name), k = {};
|
|
977
|
+
return $.forEach((N) => {
|
|
978
|
+
k[N] = {}, $.forEach((P) => {
|
|
978
979
|
k[N][P] = N === P ? 1 : Math.random() * 0.8 - 0.4;
|
|
979
980
|
});
|
|
980
981
|
}), {
|
|
981
982
|
type: y,
|
|
982
983
|
timestamp: /* @__PURE__ */ new Date(),
|
|
983
984
|
correlations: k,
|
|
984
|
-
summary: `Calculated correlations for ${
|
|
985
|
+
summary: `Calculated correlations for ${$.length} features`,
|
|
985
986
|
insights: ["Correlation matrix computed for numeric columns"],
|
|
986
987
|
confidence: 0.85
|
|
987
988
|
};
|
|
@@ -1016,25 +1017,25 @@ function fn(s) {
|
|
|
1016
1017
|
try {
|
|
1017
1018
|
if (!a.value || !Array.isArray(a.value) || a.value.length === 0)
|
|
1018
1019
|
throw new Error("No data available. Please load data first.");
|
|
1019
|
-
const
|
|
1020
|
+
const I = i.value || _(a.value), $ = {
|
|
1020
1021
|
question: y,
|
|
1021
|
-
schema:
|
|
1022
|
+
schema: I,
|
|
1022
1023
|
data: a.value,
|
|
1023
1024
|
sampleSize: 100,
|
|
1024
1025
|
includeAggregates: !0,
|
|
1025
1026
|
...v
|
|
1026
|
-
}, N = (await e.askQuestion(
|
|
1027
|
+
}, N = (await e.askQuestion($)).answer, P = {
|
|
1027
1028
|
id: N.questionId,
|
|
1028
1029
|
text: y,
|
|
1029
1030
|
timestamp: /* @__PURE__ */ new Date(),
|
|
1030
1031
|
context: {
|
|
1031
|
-
tableSchema:
|
|
1032
|
+
tableSchema: I,
|
|
1032
1033
|
rowCount: a.value.length
|
|
1033
1034
|
}
|
|
1034
1035
|
};
|
|
1035
1036
|
return r.value || (r.value = []), c.value || (c.value = []), r.value.push(P), c.value.push(N), l.value = N, r.value.length > u && (r.value.shift(), c.value.shift()), N;
|
|
1036
|
-
} catch (
|
|
1037
|
-
throw n.value =
|
|
1037
|
+
} catch (I) {
|
|
1038
|
+
throw n.value = I instanceof Error ? I : new Error("Q&A failed"), n.value;
|
|
1038
1039
|
} finally {
|
|
1039
1040
|
t.value = !1;
|
|
1040
1041
|
}
|
|
@@ -1050,18 +1051,18 @@ function fn(s) {
|
|
|
1050
1051
|
t.value = !1;
|
|
1051
1052
|
}
|
|
1052
1053
|
}
|
|
1053
|
-
function
|
|
1054
|
+
function ve() {
|
|
1054
1055
|
r.value = [], c.value = [], l.value = null;
|
|
1055
1056
|
}
|
|
1056
|
-
function
|
|
1057
|
+
function be(y) {
|
|
1057
1058
|
const v = e.extractFromDOM(y);
|
|
1058
1059
|
return v && (a.value = v.data, i.value = v.schema), v;
|
|
1059
1060
|
}
|
|
1060
|
-
function
|
|
1061
|
-
const
|
|
1062
|
-
a.value =
|
|
1061
|
+
function Ce(y, v, I) {
|
|
1062
|
+
const $ = e.normalizeVueData(y, v, I);
|
|
1063
|
+
a.value = $.data, i.value = $.schema;
|
|
1063
1064
|
}
|
|
1064
|
-
function
|
|
1065
|
+
function Ae(y) {
|
|
1065
1066
|
e.initializeQA(y);
|
|
1066
1067
|
}
|
|
1067
1068
|
return {
|
|
@@ -1081,22 +1082,22 @@ function fn(s) {
|
|
|
1081
1082
|
predict: g,
|
|
1082
1083
|
askQuestion: E,
|
|
1083
1084
|
generateSummary: z,
|
|
1084
|
-
clearHistory:
|
|
1085
|
-
extractFromDOM:
|
|
1086
|
-
loadFromVueGrid:
|
|
1085
|
+
clearHistory: ve,
|
|
1086
|
+
extractFromDOM: be,
|
|
1087
|
+
loadFromVueGrid: Ce,
|
|
1087
1088
|
updateConfig: S,
|
|
1088
|
-
initializeQA:
|
|
1089
|
+
initializeQA: Ae,
|
|
1089
1090
|
setData: O,
|
|
1090
1091
|
reset: q
|
|
1091
1092
|
};
|
|
1092
1093
|
}
|
|
1093
|
-
const
|
|
1094
|
+
const Re = { class: "ti-question-input" }, ze = { class: "ti-input-wrapper" }, Ee = ["placeholder", "disabled", "onKeydown"], Ve = ["disabled"], Fe = { key: 0 }, je = {
|
|
1094
1095
|
key: 1,
|
|
1095
1096
|
class: "ti-loading"
|
|
1096
|
-
},
|
|
1097
|
+
}, Qe = {
|
|
1097
1098
|
key: 0,
|
|
1098
1099
|
class: "ti-hint"
|
|
1099
|
-
},
|
|
1100
|
+
}, Je = /* @__PURE__ */ W({
|
|
1100
1101
|
__name: "QuestionInput",
|
|
1101
1102
|
props: {
|
|
1102
1103
|
placeholder: { default: "Ask a question about this data..." },
|
|
@@ -1115,56 +1116,56 @@ const xe = { class: "ti-question-input" }, qe = { class: "ti-input-wrapper" }, P
|
|
|
1115
1116
|
}
|
|
1116
1117
|
function i(r) {
|
|
1117
1118
|
}
|
|
1118
|
-
return (r, c) => (A(), C("div",
|
|
1119
|
-
b("div",
|
|
1120
|
-
|
|
1119
|
+
return (r, c) => (A(), C("div", Re, [
|
|
1120
|
+
b("div", ze, [
|
|
1121
|
+
Se(b("textarea", {
|
|
1121
1122
|
"onUpdate:modelValue": c[0] || (c[0] = (l) => o.value = l),
|
|
1122
1123
|
placeholder: r.placeholder,
|
|
1123
1124
|
disabled: r.disabled,
|
|
1124
1125
|
class: "ti-textarea",
|
|
1125
1126
|
rows: "1",
|
|
1126
1127
|
onKeydown: [
|
|
1127
|
-
|
|
1128
|
-
|
|
1128
|
+
Z(ee(a, ["exact", "prevent"]), ["enter"]),
|
|
1129
|
+
Z(ee(i, ["shift"]), ["enter"])
|
|
1129
1130
|
]
|
|
1130
|
-
}, null, 40,
|
|
1131
|
-
[
|
|
1131
|
+
}, null, 40, Ee), [
|
|
1132
|
+
[Ne, o.value]
|
|
1132
1133
|
]),
|
|
1133
1134
|
b("button", {
|
|
1134
1135
|
disabled: r.disabled || !o.value.trim(),
|
|
1135
1136
|
class: "ti-submit-btn",
|
|
1136
1137
|
onClick: a
|
|
1137
1138
|
}, [
|
|
1138
|
-
r.loading ? (A(), C("span",
|
|
1139
|
-
], 8,
|
|
1139
|
+
r.loading ? (A(), C("span", je, M(r.loadingLabel), 1)) : (A(), C("span", Fe, M(r.submitLabel), 1))
|
|
1140
|
+
], 8, Ve)
|
|
1140
1141
|
]),
|
|
1141
|
-
r.showHint ? (A(), C("div",
|
|
1142
|
+
r.showHint ? (A(), C("div", Qe, M(r.hint), 1)) : T("", !0)
|
|
1142
1143
|
]));
|
|
1143
1144
|
}
|
|
1144
|
-
}),
|
|
1145
|
+
}), X = (s, e) => {
|
|
1145
1146
|
const t = s.__vccOpts || s;
|
|
1146
1147
|
for (const [n, o] of e)
|
|
1147
1148
|
t[n] = o;
|
|
1148
1149
|
return t;
|
|
1149
|
-
},
|
|
1150
|
+
}, le = /* @__PURE__ */ X(Je, [["__scopeId", "data-v-f96008f3"]]), He = { class: "ti-answer-header" }, Be = { class: "ti-answer-icon" }, Le = { key: 0 }, Ue = { key: 1 }, Ke = { class: "ti-answer-meta" }, Ge = { class: "ti-confidence" }, We = { class: "ti-timestamp" }, Xe = { class: "ti-answer-text" }, Ye = {
|
|
1150
1151
|
key: 0,
|
|
1151
1152
|
class: "ti-approximate-notice"
|
|
1152
|
-
},
|
|
1153
|
+
}, Ze = {
|
|
1153
1154
|
key: 1,
|
|
1154
1155
|
class: "ti-reason"
|
|
1155
|
-
},
|
|
1156
|
+
}, et = {
|
|
1156
1157
|
key: 2,
|
|
1157
1158
|
class: "ti-supporting-data"
|
|
1158
|
-
},
|
|
1159
|
+
}, tt = {
|
|
1159
1160
|
key: 0,
|
|
1160
1161
|
class: "ti-supporting-content"
|
|
1161
|
-
},
|
|
1162
|
+
}, nt = {
|
|
1162
1163
|
key: 0,
|
|
1163
1164
|
class: "ti-aggregates"
|
|
1164
|
-
},
|
|
1165
|
+
}, st = {
|
|
1165
1166
|
key: 1,
|
|
1166
1167
|
class: "ti-rows"
|
|
1167
|
-
},
|
|
1168
|
+
}, ot = { class: "ti-table-wrapper" }, at = { class: "ti-table" }, rt = /* @__PURE__ */ W({
|
|
1168
1169
|
__name: "AnswerDisplay",
|
|
1169
1170
|
props: {
|
|
1170
1171
|
answer: {}
|
|
@@ -1175,45 +1176,45 @@ const xe = { class: "ti-question-input" }, qe = { class: "ti-input-wrapper" }, P
|
|
|
1175
1176
|
return new Date(n).toLocaleTimeString();
|
|
1176
1177
|
}
|
|
1177
1178
|
return (n, o) => (A(), C("div", {
|
|
1178
|
-
class:
|
|
1179
|
+
class: ke(["ti-answer-display", { "ti-cannot-answer": n.answer.cannotAnswer }])
|
|
1179
1180
|
}, [
|
|
1180
|
-
b("div",
|
|
1181
|
-
b("div",
|
|
1182
|
-
n.answer.cannotAnswer ? (A(), C("span",
|
|
1181
|
+
b("div", He, [
|
|
1182
|
+
b("div", Be, [
|
|
1183
|
+
n.answer.cannotAnswer ? (A(), C("span", Ue, "⚠️")) : (A(), C("span", Le, "💡"))
|
|
1183
1184
|
]),
|
|
1184
|
-
b("div",
|
|
1185
|
-
b("div",
|
|
1186
|
-
b("div",
|
|
1185
|
+
b("div", Ke, [
|
|
1186
|
+
b("div", Ge, " Confidence: " + M(Math.round(n.answer.confidence * 100)) + "% ", 1),
|
|
1187
|
+
b("div", We, M(t(n.answer.timestamp)), 1)
|
|
1187
1188
|
])
|
|
1188
1189
|
]),
|
|
1189
|
-
b("div",
|
|
1190
|
-
n.answer.isApproximate ? (A(), C("div",
|
|
1191
|
-
n.answer.reason && n.answer.cannotAnswer ? (A(), C("div",
|
|
1190
|
+
b("div", Xe, M(n.answer.text), 1),
|
|
1191
|
+
n.answer.isApproximate ? (A(), C("div", Ye, " ℹ️ This answer is based on sampled data and may be approximate. ")) : T("", !0),
|
|
1192
|
+
n.answer.reason && n.answer.cannotAnswer ? (A(), C("div", Ze, [
|
|
1192
1193
|
o[1] || (o[1] = b("strong", null, "Reason:", -1)),
|
|
1193
|
-
|
|
1194
|
+
Ie(" " + M(n.answer.reason), 1)
|
|
1194
1195
|
])) : T("", !0),
|
|
1195
|
-
n.answer.supportingData ? (A(), C("div",
|
|
1196
|
+
n.answer.supportingData ? (A(), C("div", et, [
|
|
1196
1197
|
b("button", {
|
|
1197
1198
|
class: "ti-toggle-btn",
|
|
1198
1199
|
onClick: o[0] || (o[0] = (a) => e.value = !e.value)
|
|
1199
1200
|
}, M(e.value ? "▼" : "▶") + " Supporting Data ", 1),
|
|
1200
|
-
e.value ? (A(), C("div",
|
|
1201
|
-
n.answer.supportingData.aggregates ? (A(), C("div",
|
|
1201
|
+
e.value ? (A(), C("div", tt, [
|
|
1202
|
+
n.answer.supportingData.aggregates ? (A(), C("div", nt, [
|
|
1202
1203
|
o[2] || (o[2] = b("h4", null, "Aggregates:", -1)),
|
|
1203
1204
|
b("pre", null, M(JSON.stringify(n.answer.supportingData.aggregates, null, 2)), 1)
|
|
1204
1205
|
])) : T("", !0),
|
|
1205
|
-
n.answer.supportingData.rows && n.answer.supportingData.rows.length > 0 ? (A(), C("div",
|
|
1206
|
+
n.answer.supportingData.rows && n.answer.supportingData.rows.length > 0 ? (A(), C("div", st, [
|
|
1206
1207
|
b("h4", null, "Sample Rows (" + M(n.answer.supportingData.rows.length) + "):", 1),
|
|
1207
|
-
b("div",
|
|
1208
|
-
b("table",
|
|
1208
|
+
b("div", ot, [
|
|
1209
|
+
b("table", at, [
|
|
1209
1210
|
b("thead", null, [
|
|
1210
1211
|
b("tr", null, [
|
|
1211
|
-
(A(!0), C(
|
|
1212
|
+
(A(!0), C(j, null, Q(Object.keys(n.answer.supportingData.rows[0]), (a, i) => (A(), C("th", { key: i }, M(a), 1))), 128))
|
|
1212
1213
|
])
|
|
1213
1214
|
]),
|
|
1214
1215
|
b("tbody", null, [
|
|
1215
|
-
(A(!0), C(
|
|
1216
|
-
(A(!0), C(
|
|
1216
|
+
(A(!0), C(j, null, Q(n.answer.supportingData.rows.slice(0, 5), (a, i) => (A(), C("tr", { key: i }, [
|
|
1217
|
+
(A(!0), C(j, null, Q(Object.keys(a), (r, c) => (A(), C("td", { key: c }, M(a[r]), 1))), 128))
|
|
1217
1218
|
]))), 128))
|
|
1218
1219
|
])
|
|
1219
1220
|
])
|
|
@@ -1223,29 +1224,29 @@ const xe = { class: "ti-question-input" }, qe = { class: "ti-input-wrapper" }, P
|
|
|
1223
1224
|
])) : T("", !0)
|
|
1224
1225
|
], 2));
|
|
1225
1226
|
}
|
|
1226
|
-
}),
|
|
1227
|
+
}), ue = /* @__PURE__ */ X(rt, [["__scopeId", "data-v-d1aaae1d"]]), it = { class: "ti-question-history" }, ct = { class: "ti-history-header" }, lt = {
|
|
1227
1228
|
key: 0,
|
|
1228
1229
|
class: "ti-empty-state"
|
|
1229
|
-
},
|
|
1230
|
+
}, ut = {
|
|
1230
1231
|
key: 1,
|
|
1231
1232
|
class: "ti-history-list"
|
|
1232
|
-
},
|
|
1233
|
+
}, mt = ["onClick"], dt = { class: "ti-question-header" }, ft = { class: "ti-question-number" }, ht = { class: "ti-question-time" }, pt = { class: "ti-question-text" }, gt = {
|
|
1233
1234
|
key: 0,
|
|
1234
1235
|
class: "ti-question-context"
|
|
1235
|
-
},
|
|
1236
|
+
}, yt = /* @__PURE__ */ W({
|
|
1236
1237
|
__name: "QuestionHistory",
|
|
1237
1238
|
props: {
|
|
1238
1239
|
questions: {}
|
|
1239
1240
|
},
|
|
1240
1241
|
emits: ["clear", "select"],
|
|
1241
1242
|
setup(s, { emit: e }) {
|
|
1242
|
-
const t = s, n =
|
|
1243
|
+
const t = s, n = $e(() => [...t.questions].reverse());
|
|
1243
1244
|
function o(a) {
|
|
1244
1245
|
const i = new Date(a), c = (/* @__PURE__ */ new Date()).getTime() - i.getTime(), l = Math.floor(c / 6e4), u = Math.floor(c / 36e5), m = Math.floor(c / 864e5);
|
|
1245
1246
|
return l < 1 ? "Just now" : l < 60 ? `${l}m ago` : u < 24 ? `${u}h ago` : `${m}d ago`;
|
|
1246
1247
|
}
|
|
1247
|
-
return (a, i) => (A(), C("div",
|
|
1248
|
-
b("div",
|
|
1248
|
+
return (a, i) => (A(), C("div", it, [
|
|
1249
|
+
b("div", ct, [
|
|
1249
1250
|
i[1] || (i[1] = b("h3", null, "Question History", -1)),
|
|
1250
1251
|
a.questions.length > 0 ? (A(), C("button", {
|
|
1251
1252
|
key: 0,
|
|
@@ -1253,36 +1254,36 @@ const xe = { class: "ti-question-input" }, qe = { class: "ti-input-wrapper" }, P
|
|
|
1253
1254
|
onClick: i[0] || (i[0] = (r) => a.$emit("clear"))
|
|
1254
1255
|
}, " Clear History ")) : T("", !0)
|
|
1255
1256
|
]),
|
|
1256
|
-
a.questions.length === 0 ? (A(), C("div",
|
|
1257
|
+
a.questions.length === 0 ? (A(), C("div", lt, i[2] || (i[2] = [
|
|
1257
1258
|
b("div", { class: "ti-empty-icon" }, "💬", -1),
|
|
1258
1259
|
b("p", null, "No questions asked yet", -1),
|
|
1259
1260
|
b("p", { class: "ti-empty-hint" }, "Ask a question about your data to get started", -1)
|
|
1260
|
-
]))) : (A(), C("div",
|
|
1261
|
-
(A(!0), C(
|
|
1261
|
+
]))) : (A(), C("div", ut, [
|
|
1262
|
+
(A(!0), C(j, null, Q(n.value, (r, c) => (A(), C("div", {
|
|
1262
1263
|
key: r.id,
|
|
1263
1264
|
class: "ti-history-item",
|
|
1264
1265
|
onClick: (l) => a.$emit("select", r)
|
|
1265
1266
|
}, [
|
|
1266
|
-
b("div",
|
|
1267
|
-
b("span",
|
|
1268
|
-
b("span",
|
|
1267
|
+
b("div", dt, [
|
|
1268
|
+
b("span", ft, "#" + M(a.questions.length - c), 1),
|
|
1269
|
+
b("span", ht, M(o(r.timestamp)), 1)
|
|
1269
1270
|
]),
|
|
1270
|
-
b("div",
|
|
1271
|
-
r.context ? (A(), C("div",
|
|
1272
|
-
], 8,
|
|
1271
|
+
b("div", pt, M(r.text), 1),
|
|
1272
|
+
r.context ? (A(), C("div", gt, M(r.context.rowCount) + " rows ", 1)) : T("", !0)
|
|
1273
|
+
], 8, mt))), 128))
|
|
1273
1274
|
]))
|
|
1274
1275
|
]));
|
|
1275
1276
|
}
|
|
1276
|
-
}),
|
|
1277
|
-
async function
|
|
1277
|
+
}), me = /* @__PURE__ */ X(yt, [["__scopeId", "data-v-c66393d9"]]);
|
|
1278
|
+
async function Y(s, e) {
|
|
1278
1279
|
if (!s || s.length === 0)
|
|
1279
1280
|
throw new Error("Cannot profile empty dataset");
|
|
1280
1281
|
const t = Object.keys(s[0]), n = [];
|
|
1281
1282
|
for (const u of t) {
|
|
1282
|
-
const m = await
|
|
1283
|
+
const m = await wt(s, u);
|
|
1283
1284
|
n.push(m);
|
|
1284
1285
|
}
|
|
1285
|
-
const o = n.filter((u) => u.type === "numeric").map((u) => u.name), a =
|
|
1286
|
+
const o = n.filter((u) => u.type === "numeric").map((u) => u.name), a = Nt(s, o), i = It(s), r = $t(s), c = Mt(n, i.count), l = xt(n, i.percentage);
|
|
1286
1287
|
return {
|
|
1287
1288
|
overview: {
|
|
1288
1289
|
totalRows: s.length,
|
|
@@ -1297,8 +1298,8 @@ async function W(s, e) {
|
|
|
1297
1298
|
qualityScore: l
|
|
1298
1299
|
};
|
|
1299
1300
|
}
|
|
1300
|
-
async function
|
|
1301
|
-
const n = s.map((m) => m[e]), o =
|
|
1301
|
+
async function wt(s, e, t) {
|
|
1302
|
+
const n = s.map((m) => m[e]), o = vt(n), a = n.filter((m) => m == null || m === "").length, i = a / n.length * 100, c = new Set(n.filter((m) => m != null && m !== "")).size, l = c / n.length * 100, u = {
|
|
1302
1303
|
name: e,
|
|
1303
1304
|
type: o,
|
|
1304
1305
|
missingCount: a,
|
|
@@ -1311,9 +1312,9 @@ async function mt(s, e, t) {
|
|
|
1311
1312
|
recommendations: []
|
|
1312
1313
|
}
|
|
1313
1314
|
};
|
|
1314
|
-
return o === "numeric" ? u.stats =
|
|
1315
|
+
return o === "numeric" ? u.stats = bt(n) : o === "categorical" ? u.categories = Ct(n) : o === "datetime" && (u.dateRange = At(n)), u.quality = St(u), u;
|
|
1315
1316
|
}
|
|
1316
|
-
function
|
|
1317
|
+
function vt(s) {
|
|
1317
1318
|
const e = s.filter((a) => a != null && a !== "");
|
|
1318
1319
|
if (e.length === 0) return "text";
|
|
1319
1320
|
const t = new Set(e);
|
|
@@ -1324,7 +1325,7 @@ function dt(s) {
|
|
|
1324
1325
|
return !isNaN(i.getTime());
|
|
1325
1326
|
}).length / e.length > 0.8 ? "datetime" : t.size < e.length * 0.5 ? "categorical" : "text";
|
|
1326
1327
|
}
|
|
1327
|
-
function
|
|
1328
|
+
function bt(s) {
|
|
1328
1329
|
const e = s.filter((g) => g != null && g !== "").map((g) => Number(g)).filter((g) => !isNaN(g));
|
|
1329
1330
|
if (e.length === 0) return;
|
|
1330
1331
|
const t = [...e].sort((g, S) => g - S), n = e.reduce((g, S) => g + S, 0) / e.length, o = t[Math.floor(t.length / 2)], a = t[0], i = t[t.length - 1], r = e.reduce((g, S) => g + Math.pow(S - n, 2), 0) / e.length, c = Math.sqrt(r), l = t[Math.floor(t.length * 0.25)], u = t[Math.floor(t.length * 0.75)], m = u - l, d = l - 1.5 * m, f = u + 1.5 * m, h = e.filter((g) => g < d || g > f).length, p = e.reduce((g, S) => g + Math.pow((S - n) / c, 3), 0) / e.length, w = e.reduce((g, S) => g + Math.pow((S - n) / c, 4), 0) / e.length - 3;
|
|
@@ -1342,7 +1343,7 @@ function ft(s) {
|
|
|
1342
1343
|
iqr: m
|
|
1343
1344
|
};
|
|
1344
1345
|
}
|
|
1345
|
-
function
|
|
1346
|
+
function Ct(s) {
|
|
1346
1347
|
const e = s.filter((r) => r != null && r !== ""), t = /* @__PURE__ */ new Map();
|
|
1347
1348
|
for (const r of e)
|
|
1348
1349
|
t.set(r, (t.get(r) || 0) + 1);
|
|
@@ -1361,7 +1362,7 @@ function ht(s) {
|
|
|
1361
1362
|
entropy: o
|
|
1362
1363
|
};
|
|
1363
1364
|
}
|
|
1364
|
-
function
|
|
1365
|
+
function At(s) {
|
|
1365
1366
|
const e = s.filter((r) => r != null && r !== "").map((r) => new Date(r)).filter((r) => !isNaN(r.getTime())).sort((r, c) => r.getTime() - c.getTime());
|
|
1366
1367
|
if (e.length === 0) return;
|
|
1367
1368
|
const t = e[0], n = e[e.length - 1], o = n.getTime() - t.getTime(), a = Math.floor(o / (1e3 * 60 * 60 * 24));
|
|
@@ -1372,7 +1373,7 @@ function pt(s) {
|
|
|
1372
1373
|
span: i
|
|
1373
1374
|
};
|
|
1374
1375
|
}
|
|
1375
|
-
function
|
|
1376
|
+
function St(s) {
|
|
1376
1377
|
const e = [], t = [];
|
|
1377
1378
|
let n = 100;
|
|
1378
1379
|
return s.missingPercentage > 50 ? (e.push(`High missing rate: ${s.missingPercentage.toFixed(1)}%`), t.push("Consider removing this column or imputing missing values"), n -= 30) : s.missingPercentage > 20 ? (e.push(`Moderate missing rate: ${s.missingPercentage.toFixed(1)}%`), t.push("Consider imputing missing values"), n -= 15) : s.missingPercentage > 5 && (e.push(`Some missing values: ${s.missingPercentage.toFixed(1)}%`), n -= 5), s.uniquePercentage === 100 && s.type !== "text" && (e.push("All values are unique - might be an ID column"), t.push("Consider if this column is useful for analysis")), s.uniqueCount === 1 && (e.push("Only one unique value - constant column"), t.push("Consider removing this column"), n -= 40), s.stats && (s.stats.outliers > s.missingCount * 0.1 && (e.push(`${s.stats.outliers} outliers detected`), t.push("Consider outlier treatment"), n -= 10), Math.abs(s.stats.skewness) > 2 && (e.push(`High skewness: ${s.stats.skewness.toFixed(2)}`), t.push("Consider log transformation"), n -= 5)), {
|
|
@@ -1381,7 +1382,7 @@ function gt(s) {
|
|
|
1381
1382
|
recommendations: t
|
|
1382
1383
|
};
|
|
1383
1384
|
}
|
|
1384
|
-
function
|
|
1385
|
+
function Nt(s, e) {
|
|
1385
1386
|
if (e.length < 2)
|
|
1386
1387
|
return {
|
|
1387
1388
|
columns: [],
|
|
@@ -1395,7 +1396,7 @@ function yt(s, e) {
|
|
|
1395
1396
|
if (o === a)
|
|
1396
1397
|
t[o][a] = 1;
|
|
1397
1398
|
else {
|
|
1398
|
-
const i =
|
|
1399
|
+
const i = kt(
|
|
1399
1400
|
s.map((r) => Number(r[e[o]])),
|
|
1400
1401
|
s.map((r) => Number(r[e[a]]))
|
|
1401
1402
|
);
|
|
@@ -1412,7 +1413,7 @@ function yt(s, e) {
|
|
|
1412
1413
|
significant: n
|
|
1413
1414
|
};
|
|
1414
1415
|
}
|
|
1415
|
-
function
|
|
1416
|
+
function kt(s, e) {
|
|
1416
1417
|
s.length;
|
|
1417
1418
|
const t = s.map((m, d) => [m, e[d]]).filter(([m, d]) => !isNaN(m) && !isNaN(d));
|
|
1418
1419
|
if (t.length < 2) return 0;
|
|
@@ -1425,7 +1426,7 @@ function wt(s, e) {
|
|
|
1425
1426
|
const u = Math.sqrt(c * l);
|
|
1426
1427
|
return u === 0 ? 0 : r / u;
|
|
1427
1428
|
}
|
|
1428
|
-
function
|
|
1429
|
+
function It(s) {
|
|
1429
1430
|
const e = /* @__PURE__ */ new Set();
|
|
1430
1431
|
let t = 0;
|
|
1431
1432
|
for (const n of s) {
|
|
@@ -1437,11 +1438,11 @@ function vt(s) {
|
|
|
1437
1438
|
percentage: t / s.length * 100
|
|
1438
1439
|
};
|
|
1439
1440
|
}
|
|
1440
|
-
function
|
|
1441
|
+
function $t(s) {
|
|
1441
1442
|
const e = JSON.stringify(s), t = new Blob([e]).size;
|
|
1442
1443
|
return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(2)} KB` : t < 1024 * 1024 * 1024 ? `${(t / (1024 * 1024)).toFixed(2)} MB` : `${(t / (1024 * 1024 * 1024)).toFixed(2)} GB`;
|
|
1443
1444
|
}
|
|
1444
|
-
function
|
|
1445
|
+
function Mt(s, e) {
|
|
1445
1446
|
const t = [];
|
|
1446
1447
|
e > 10 && t.push(`High duplicate rate: ${e.toFixed(1)}% of rows are duplicates`);
|
|
1447
1448
|
const n = s.filter((a) => a.quality.score < 50);
|
|
@@ -1449,12 +1450,12 @@ function Ct(s, e) {
|
|
|
1449
1450
|
const o = s.filter((a) => a.missingPercentage > 50);
|
|
1450
1451
|
return o.length > 0 && t.push(`${o.length} columns have >50% missing values`), t;
|
|
1451
1452
|
}
|
|
1452
|
-
function
|
|
1453
|
+
function xt(s, e) {
|
|
1453
1454
|
const t = s.reduce((o, a) => o + a.quality.score, 0) / s.length, n = Math.min(e, 20);
|
|
1454
1455
|
return Math.max(0, t - n);
|
|
1455
1456
|
}
|
|
1456
|
-
async function
|
|
1457
|
-
const e = await
|
|
1457
|
+
async function kn(s) {
|
|
1458
|
+
const e = await Y(s), t = await de(s, e), n = 100 - e.columns.reduce((u, m) => u + m.missingPercentage, 0) / e.columns.length, o = 100 - e.overview.duplicatePercentage, a = e.columns.filter((u) => u.quality.score > 70).length / e.columns.length * 100, i = e.columns.filter((u) => u.quality.issues.length === 0).length / e.columns.length * 100, r = (n + a + i) / 3, c = (n + r + a + i + o) / 5, l = qt(t, e);
|
|
1458
1459
|
return {
|
|
1459
1460
|
overallScore: c,
|
|
1460
1461
|
dimensions: {
|
|
@@ -1469,8 +1470,8 @@ async function yn(s) {
|
|
|
1469
1470
|
timestamp: /* @__PURE__ */ new Date()
|
|
1470
1471
|
};
|
|
1471
1472
|
}
|
|
1472
|
-
async function
|
|
1473
|
-
e || (e = await
|
|
1473
|
+
async function de(s, e) {
|
|
1474
|
+
e || (e = await Y(s));
|
|
1474
1475
|
const t = [];
|
|
1475
1476
|
for (const n of e.columns)
|
|
1476
1477
|
n.missingPercentage > 20 && t.push({
|
|
@@ -1496,13 +1497,13 @@ async function ae(s, e) {
|
|
|
1496
1497
|
suggestedFix: "Remove duplicate rows or aggregate them"
|
|
1497
1498
|
}), t;
|
|
1498
1499
|
}
|
|
1499
|
-
function
|
|
1500
|
+
function qt(s, e) {
|
|
1500
1501
|
const t = [];
|
|
1501
1502
|
return s.filter((i) => i.type === "missing_values").length > 0 && t.push("Impute missing values using appropriate strategies (mean, median, KNN, or ML-based)"), s.filter((i) => i.type === "outliers").length > 0 && t.push("Handle outliers using IQR method, capping, or transformation"), s.filter((i) => i.type === "duplicates").length > 0 && t.push("Remove or aggregate duplicate rows"), e.qualityScore < 70 && t.push("Overall data quality is below acceptable threshold - consider data cleaning pipeline"), t;
|
|
1502
1503
|
}
|
|
1503
|
-
async function
|
|
1504
|
-
const e = await
|
|
1505
|
-
await
|
|
1504
|
+
async function In(s) {
|
|
1505
|
+
const e = await Y(s);
|
|
1506
|
+
await de(s, e);
|
|
1506
1507
|
const t = [], n = e.columns.filter((a) => a.missingPercentage > 5);
|
|
1507
1508
|
n.length > 0 && t.push({
|
|
1508
1509
|
priority: "high",
|
|
@@ -1532,7 +1533,7 @@ async function wn(s) {
|
|
|
1532
1533
|
autoFixable: !0
|
|
1533
1534
|
}), t;
|
|
1534
1535
|
}
|
|
1535
|
-
async function
|
|
1536
|
+
async function $n(s, e) {
|
|
1536
1537
|
const { strategy: t, columns: n } = e, o = n || Object.keys(s[0]);
|
|
1537
1538
|
let a = JSON.parse(JSON.stringify(s)), i = 0;
|
|
1538
1539
|
const r = [];
|
|
@@ -1542,22 +1543,22 @@ async function vn(s, e) {
|
|
|
1542
1543
|
let m;
|
|
1543
1544
|
switch (t) {
|
|
1544
1545
|
case "mean":
|
|
1545
|
-
m =
|
|
1546
|
+
m = J(l);
|
|
1546
1547
|
break;
|
|
1547
1548
|
case "median":
|
|
1548
|
-
m =
|
|
1549
|
+
m = Pt(l);
|
|
1549
1550
|
break;
|
|
1550
1551
|
case "mode":
|
|
1551
|
-
m =
|
|
1552
|
+
m = Tt(l);
|
|
1552
1553
|
break;
|
|
1553
1554
|
case "knn":
|
|
1554
|
-
a = await
|
|
1555
|
+
a = await Dt(a, c, u);
|
|
1555
1556
|
break;
|
|
1556
1557
|
case "iterative":
|
|
1557
|
-
a = await
|
|
1558
|
+
a = await fe(a, c, u);
|
|
1558
1559
|
break;
|
|
1559
1560
|
case "ai":
|
|
1560
|
-
a = await
|
|
1561
|
+
a = await _t(a, c, u);
|
|
1561
1562
|
break;
|
|
1562
1563
|
}
|
|
1563
1564
|
if (["mean", "median", "mode"].includes(t))
|
|
@@ -1574,21 +1575,21 @@ async function vn(s, e) {
|
|
|
1574
1575
|
imputedCount: i,
|
|
1575
1576
|
method: t,
|
|
1576
1577
|
columns: o,
|
|
1577
|
-
confidence:
|
|
1578
|
+
confidence: Ot(t),
|
|
1578
1579
|
details: r
|
|
1579
1580
|
};
|
|
1580
1581
|
}
|
|
1581
|
-
function
|
|
1582
|
+
function J(s) {
|
|
1582
1583
|
const e = s.filter((t) => t != null && t !== "").map((t) => Number(t)).filter((t) => !isNaN(t));
|
|
1583
1584
|
return e.length === 0 ? 0 : e.reduce((t, n) => t + n, 0) / e.length;
|
|
1584
1585
|
}
|
|
1585
|
-
function
|
|
1586
|
+
function Pt(s) {
|
|
1586
1587
|
const e = s.filter((n) => n != null && n !== "").map((n) => Number(n)).filter((n) => !isNaN(n)).sort((n, o) => n - o);
|
|
1587
1588
|
if (e.length === 0) return 0;
|
|
1588
1589
|
const t = Math.floor(e.length / 2);
|
|
1589
1590
|
return e.length % 2 === 0 ? (e[t - 1] + e[t]) / 2 : e[t];
|
|
1590
1591
|
}
|
|
1591
|
-
function
|
|
1592
|
+
function Tt(s) {
|
|
1592
1593
|
const e = s.filter((a) => a != null && a !== "");
|
|
1593
1594
|
if (e.length === 0) return null;
|
|
1594
1595
|
const t = /* @__PURE__ */ new Map();
|
|
@@ -1599,7 +1600,7 @@ function kt(s) {
|
|
|
1599
1600
|
i > n && (n = i, o = a);
|
|
1600
1601
|
return o;
|
|
1601
1602
|
}
|
|
1602
|
-
async function
|
|
1603
|
+
async function Dt(s, e, t, n = 5) {
|
|
1603
1604
|
const o = [...s], i = Object.keys(s[0]).filter((r) => r !== e);
|
|
1604
1605
|
for (const r of t) {
|
|
1605
1606
|
const l = s.map((u, m) => {
|
|
@@ -1614,17 +1615,17 @@ async function $t(s, e, t, n = 5) {
|
|
|
1614
1615
|
}).filter((u) => u.distance !== 1 / 0).sort((u, m) => u.distance - m.distance).slice(0, n);
|
|
1615
1616
|
if (l.length > 0) {
|
|
1616
1617
|
const u = l.map((m) => s[m.idx][e]);
|
|
1617
|
-
o[r][e] =
|
|
1618
|
+
o[r][e] = J(u);
|
|
1618
1619
|
}
|
|
1619
1620
|
}
|
|
1620
1621
|
return o;
|
|
1621
1622
|
}
|
|
1622
|
-
async function
|
|
1623
|
+
async function fe(s, e, t) {
|
|
1623
1624
|
const n = [...s], a = Object.keys(s[0]).filter((r) => r !== e), i = s.filter(
|
|
1624
1625
|
(r, c) => !t.includes(c) && r[e] !== null && r[e] !== void 0 && r[e] !== ""
|
|
1625
1626
|
);
|
|
1626
1627
|
if (i.length < 10) {
|
|
1627
|
-
const r =
|
|
1628
|
+
const r = J(s.map((c) => c[e]));
|
|
1628
1629
|
for (const c of t)
|
|
1629
1630
|
n[c][e] = r;
|
|
1630
1631
|
return n;
|
|
@@ -1642,14 +1643,14 @@ async function re(s, e, t) {
|
|
|
1642
1643
|
c += f * Number(u[e]), l += f;
|
|
1643
1644
|
}
|
|
1644
1645
|
}
|
|
1645
|
-
n[r][e] = l > 0 ? c / l :
|
|
1646
|
+
n[r][e] = l > 0 ? c / l : J(s.map((u) => u[e]));
|
|
1646
1647
|
}
|
|
1647
1648
|
return n;
|
|
1648
1649
|
}
|
|
1649
|
-
async function
|
|
1650
|
-
return
|
|
1650
|
+
async function _t(s, e, t) {
|
|
1651
|
+
return fe(s, e, t);
|
|
1651
1652
|
}
|
|
1652
|
-
function
|
|
1653
|
+
function Ot(s) {
|
|
1653
1654
|
return {
|
|
1654
1655
|
mean: 0.6,
|
|
1655
1656
|
median: 0.65,
|
|
@@ -1659,17 +1660,17 @@ function Mt(s) {
|
|
|
1659
1660
|
ai: 0.9
|
|
1660
1661
|
}[s] || 0.5;
|
|
1661
1662
|
}
|
|
1662
|
-
async function
|
|
1663
|
+
async function Mn(s, e) {
|
|
1663
1664
|
const { method: t, strategy: n, columns: o } = e, a = o || Object.keys(s[0]).filter((u) => s.map((d) => d[u]).some((d) => !isNaN(Number(d))));
|
|
1664
1665
|
let i = JSON.parse(JSON.stringify(s)), r = 0, c = 0;
|
|
1665
1666
|
const l = [];
|
|
1666
1667
|
for (const u of a) {
|
|
1667
|
-
const m =
|
|
1668
|
+
const m = Rt(s, u, n);
|
|
1668
1669
|
if (r += m.length, t === "remove") {
|
|
1669
1670
|
const d = new Set(m.map((f) => f.index));
|
|
1670
1671
|
i = i.filter((f, h) => !d.has(h)), c += m.length;
|
|
1671
1672
|
} else if (t === "cap") {
|
|
1672
|
-
const d =
|
|
1673
|
+
const d = Et(s, u, n);
|
|
1673
1674
|
for (const f of m)
|
|
1674
1675
|
f.value < d.lower ? i[f.index][u] = d.lower : f.value > d.upper && (i[f.index][u] = d.upper);
|
|
1675
1676
|
} else if (t === "transform")
|
|
@@ -1691,10 +1692,10 @@ async function bn(s, e) {
|
|
|
1691
1692
|
details: l
|
|
1692
1693
|
};
|
|
1693
1694
|
}
|
|
1694
|
-
function
|
|
1695
|
-
return s.map((n) => Number(n[e])).filter((n) => !isNaN(n)), t === "iqr" ?
|
|
1695
|
+
function Rt(s, e, t) {
|
|
1696
|
+
return s.map((n) => Number(n[e])).filter((n) => !isNaN(n)), t === "iqr" ? ne(s, e) : t === "zscore" ? zt(s, e) : ne(s, e);
|
|
1696
1697
|
}
|
|
1697
|
-
function
|
|
1698
|
+
function ne(s, e) {
|
|
1698
1699
|
const t = s.map((l, u) => ({ value: Number(l[e]), index: u })).filter((l) => !isNaN(l.value)), n = [...t].sort((l, u) => l.value - u.value), o = n[Math.floor(n.length * 0.25)].value, a = n[Math.floor(n.length * 0.75)].value, i = a - o, r = o - 1.5 * i, c = a + 1.5 * i;
|
|
1699
1700
|
return t.filter((l) => l.value < r || l.value > c).map((l) => ({
|
|
1700
1701
|
index: l.index,
|
|
@@ -1702,7 +1703,7 @@ function ee(s, e) {
|
|
|
1702
1703
|
score: l.value < r ? (r - l.value) / i : (l.value - c) / i
|
|
1703
1704
|
}));
|
|
1704
1705
|
}
|
|
1705
|
-
function
|
|
1706
|
+
function zt(s, e, t = 3) {
|
|
1706
1707
|
const n = s.map((i, r) => ({ value: Number(i[e]), index: r })).filter((i) => !isNaN(i.value)), o = n.reduce((i, r) => i + r.value, 0) / n.length, a = Math.sqrt(
|
|
1707
1708
|
n.reduce((i, r) => i + Math.pow(r.value - o, 2), 0) / n.length
|
|
1708
1709
|
);
|
|
@@ -1712,7 +1713,7 @@ function qt(s, e, t = 3) {
|
|
|
1712
1713
|
score: Math.abs((i.value - o) / a)
|
|
1713
1714
|
})).filter((i) => i.score > t);
|
|
1714
1715
|
}
|
|
1715
|
-
function
|
|
1716
|
+
function Et(s, e, t) {
|
|
1716
1717
|
const n = s.map((o) => Number(o[e])).filter((o) => !isNaN(o)).sort((o, a) => o - a);
|
|
1717
1718
|
if (t === "iqr") {
|
|
1718
1719
|
const o = n[Math.floor(n.length * 0.25)], a = n[Math.floor(n.length * 0.75)], i = a - o;
|
|
@@ -1728,7 +1729,7 @@ function Pt(s, e, t) {
|
|
|
1728
1729
|
};
|
|
1729
1730
|
}
|
|
1730
1731
|
}
|
|
1731
|
-
async function
|
|
1732
|
+
async function xn(s, e) {
|
|
1732
1733
|
const { dateColumn: t, valueColumn: n, horizon: o, method: a = "exponential_smoothing", confidence: i = 0.95 } = e, r = s.map((p) => ({
|
|
1733
1734
|
timestamp: new Date(p[t]),
|
|
1734
1735
|
value: Number(p[n])
|
|
@@ -1739,9 +1740,9 @@ async function Cn(s, e) {
|
|
|
1739
1740
|
let u = r[0].value;
|
|
1740
1741
|
for (let p = 1; p < r.length; p++)
|
|
1741
1742
|
u = c * r[p].value + (1 - c) * u;
|
|
1742
|
-
const m = r[r.length - 1].timestamp, d =
|
|
1743
|
+
const m = r[r.length - 1].timestamp, d = Ft(r);
|
|
1743
1744
|
for (let p = 1; p <= o; p++) {
|
|
1744
|
-
const w = new Date(m.getTime() + p * d), g = u, O = 1.96 *
|
|
1745
|
+
const w = new Date(m.getTime() + p * d), g = u, O = 1.96 * pe(r.map((q) => q.value));
|
|
1745
1746
|
l.push({
|
|
1746
1747
|
timestamp: w,
|
|
1747
1748
|
value: g,
|
|
@@ -1749,7 +1750,7 @@ async function Cn(s, e) {
|
|
|
1749
1750
|
upper: g + O
|
|
1750
1751
|
});
|
|
1751
1752
|
}
|
|
1752
|
-
const f =
|
|
1753
|
+
const f = he(r), h = await Vt(s, { dateColumn: t, valueColumn: n });
|
|
1753
1754
|
return {
|
|
1754
1755
|
predictions: l,
|
|
1755
1756
|
method: a,
|
|
@@ -1762,13 +1763,13 @@ async function Cn(s, e) {
|
|
|
1762
1763
|
seasonality: h
|
|
1763
1764
|
};
|
|
1764
1765
|
}
|
|
1765
|
-
async function
|
|
1766
|
+
async function qn(s, e) {
|
|
1766
1767
|
const { dateColumn: t, valueColumns: n, method: o = "linear" } = e, a = [];
|
|
1767
1768
|
for (const i of n) {
|
|
1768
1769
|
const r = s.map((l) => ({
|
|
1769
1770
|
timestamp: new Date(l[t]),
|
|
1770
1771
|
value: Number(l[i])
|
|
1771
|
-
})).filter((l) => !isNaN(l.value)).sort((l, u) => l.timestamp.getTime() - u.timestamp.getTime()), c =
|
|
1772
|
+
})).filter((l) => !isNaN(l.value)).sort((l, u) => l.timestamp.getTime() - u.timestamp.getTime()), c = he(r);
|
|
1772
1773
|
a.push({
|
|
1773
1774
|
column: i,
|
|
1774
1775
|
trend: {
|
|
@@ -1782,7 +1783,7 @@ async function An(s, e) {
|
|
|
1782
1783
|
}
|
|
1783
1784
|
return a;
|
|
1784
1785
|
}
|
|
1785
|
-
async function
|
|
1786
|
+
async function Vt(s, e) {
|
|
1786
1787
|
const { dateColumn: t, valueColumn: n } = e, a = s.map((m) => ({
|
|
1787
1788
|
timestamp: new Date(m[t]),
|
|
1788
1789
|
value: Number(m[n])
|
|
@@ -1790,7 +1791,7 @@ async function Tt(s, e) {
|
|
|
1790
1791
|
let r = 0, c = null;
|
|
1791
1792
|
for (const m of i) {
|
|
1792
1793
|
if (a.length < m * 2) continue;
|
|
1793
|
-
const d =
|
|
1794
|
+
const d = jt(a, m);
|
|
1794
1795
|
d > r && (r = d, c = m);
|
|
1795
1796
|
}
|
|
1796
1797
|
const l = r > 0.5;
|
|
@@ -1801,13 +1802,13 @@ async function Tt(s, e) {
|
|
|
1801
1802
|
strength: r
|
|
1802
1803
|
};
|
|
1803
1804
|
}
|
|
1804
|
-
async function
|
|
1805
|
+
async function Pn(s, e) {
|
|
1805
1806
|
const { dateColumn: t, valueColumn: n, sensitivity: o = 0.5 } = e, a = s.map((c) => ({
|
|
1806
1807
|
timestamp: new Date(c[t]),
|
|
1807
1808
|
value: Number(c[n])
|
|
1808
1809
|
})).filter((c) => !isNaN(c.value)).sort((c, l) => c.timestamp.getTime() - l.timestamp.getTime()), i = [], r = Math.max(5, Math.floor(a.length * 0.1));
|
|
1809
1810
|
for (let c = r; c < a.length - r; c++) {
|
|
1810
|
-
const l = a.slice(c - r, c).map((p) => p.value), u = a.slice(c, c + r).map((p) => p.value), m = l.reduce((p, w) => p + w, 0) / l.length, d = u.reduce((p, w) => p + w, 0) / u.length, f = Math.abs(d - m), h =
|
|
1811
|
+
const l = a.slice(c - r, c).map((p) => p.value), u = a.slice(c, c + r).map((p) => p.value), m = l.reduce((p, w) => p + w, 0) / l.length, d = u.reduce((p, w) => p + w, 0) / u.length, f = Math.abs(d - m), h = pe([...l, ...u]);
|
|
1811
1812
|
f > o * h && i.push({
|
|
1812
1813
|
index: c,
|
|
1813
1814
|
timestamp: a[c].timestamp,
|
|
@@ -1820,14 +1821,14 @@ async function Sn(s, e) {
|
|
|
1820
1821
|
}
|
|
1821
1822
|
return i;
|
|
1822
1823
|
}
|
|
1823
|
-
function
|
|
1824
|
+
function Ft(s) {
|
|
1824
1825
|
if (s.length < 2) return 864e5;
|
|
1825
1826
|
const e = [];
|
|
1826
1827
|
for (let t = 1; t < Math.min(10, s.length); t++)
|
|
1827
1828
|
e.push(s[t].timestamp.getTime() - s[t - 1].timestamp.getTime());
|
|
1828
1829
|
return e.reduce((t, n) => t + n, 0) / e.length;
|
|
1829
1830
|
}
|
|
1830
|
-
function
|
|
1831
|
+
function he(s) {
|
|
1831
1832
|
const e = s.map((m) => m.value), t = e.length, n = Array.from({ length: t }, (m, d) => d), o = n.reduce((m, d) => m + d, 0) / t, a = e.reduce((m, d) => m + d, 0) / t;
|
|
1832
1833
|
let i = 0, r = 0;
|
|
1833
1834
|
for (let m = 0; m < t; m++)
|
|
@@ -1840,11 +1841,11 @@ function ie(s) {
|
|
|
1840
1841
|
equation: `y = ${c.toFixed(4)}x + ${(a - c * o).toFixed(4)}`
|
|
1841
1842
|
};
|
|
1842
1843
|
}
|
|
1843
|
-
function
|
|
1844
|
+
function pe(s) {
|
|
1844
1845
|
const e = s.reduce((n, o) => n + o, 0) / s.length, t = s.reduce((n, o) => n + Math.pow(o - e, 2), 0) / s.length;
|
|
1845
1846
|
return Math.sqrt(t);
|
|
1846
1847
|
}
|
|
1847
|
-
function
|
|
1848
|
+
function jt(s, e) {
|
|
1848
1849
|
if (s.length < e * 2) return 0;
|
|
1849
1850
|
const t = s.reduce((a, i) => a + i, 0) / s.length;
|
|
1850
1851
|
let n = 0, o = 0;
|
|
@@ -1854,16 +1855,16 @@ function _t(s, e) {
|
|
|
1854
1855
|
o += Math.pow(s[a] - t, 2);
|
|
1855
1856
|
return o === 0 ? 0 : n / o;
|
|
1856
1857
|
}
|
|
1857
|
-
async function
|
|
1858
|
+
async function Tn(s, e) {
|
|
1858
1859
|
const { targetColumn: t, taskType: n, metric: o, models: a = ["linear", "tree", "ensemble"] } = e, i = Object.keys(s[0]).filter((f) => f !== t), r = s.map((f) => i.map((h) => Number(f[h]) || 0)), c = s.map((f) => f[t]), l = [];
|
|
1859
1860
|
for (const f of a) {
|
|
1860
|
-
const h = await
|
|
1861
|
+
const h = await H(r, c, f, n);
|
|
1861
1862
|
l.push(h);
|
|
1862
1863
|
}
|
|
1863
1864
|
const u = o || (n === "classification" ? "accuracy" : "r2Score"), m = l.reduce((f, h) => {
|
|
1864
1865
|
const p = f.metrics[u] || 0;
|
|
1865
1866
|
return (h.metrics[u] || 0) > p ? h : f;
|
|
1866
|
-
}), d =
|
|
1867
|
+
}), d = Bt(i);
|
|
1867
1868
|
return {
|
|
1868
1869
|
bestModel: {
|
|
1869
1870
|
name: m.name,
|
|
@@ -1873,15 +1874,15 @@ async function Nn(s, e) {
|
|
|
1873
1874
|
trainingTime: m.trainingTime
|
|
1874
1875
|
},
|
|
1875
1876
|
allModels: l,
|
|
1876
|
-
recommendations:
|
|
1877
|
+
recommendations: Lt(l, n),
|
|
1877
1878
|
featureImportance: d,
|
|
1878
1879
|
metrics: m.metrics
|
|
1879
1880
|
};
|
|
1880
1881
|
}
|
|
1881
|
-
async function
|
|
1882
|
-
const { targetColumn: t, models: n, crossValidation: o = 5 } = e, a = Object.keys(s[0]).filter((m) => m !== t), i = s.map((m) => a.map((d) => Number(m[d]) || 0)), r = s.map((m) => m[t]), c =
|
|
1882
|
+
async function Dn(s, e) {
|
|
1883
|
+
const { targetColumn: t, models: n, crossValidation: o = 5 } = e, a = Object.keys(s[0]).filter((m) => m !== t), i = s.map((m) => a.map((d) => Number(m[d]) || 0)), r = s.map((m) => m[t]), c = ge(r), l = [];
|
|
1883
1884
|
for (const m of n) {
|
|
1884
|
-
const d = await
|
|
1885
|
+
const d = await H(i, r, m, c);
|
|
1885
1886
|
l.push(d);
|
|
1886
1887
|
}
|
|
1887
1888
|
const u = l.reduce((m, d) => {
|
|
@@ -1894,10 +1895,10 @@ async function kn(s, e) {
|
|
|
1894
1895
|
comparisonMetric: c === "classification" ? "accuracy" : "r2Score"
|
|
1895
1896
|
};
|
|
1896
1897
|
}
|
|
1897
|
-
async function
|
|
1898
|
-
const { targetColumn: t, iterations: n = 10 } = e, o = Object.keys(s[0]).filter((d) => d !== t), a = s.map((d) => o.map((f) => Number(d[f]) || 0)), i = s.map((d) => d[t]), r =
|
|
1898
|
+
async function _n(s, e) {
|
|
1899
|
+
const { targetColumn: t, iterations: n = 10 } = e, o = Object.keys(s[0]).filter((d) => d !== t), a = s.map((d) => o.map((f) => Number(d[f]) || 0)), i = s.map((d) => d[t]), r = ge(i), c = [];
|
|
1899
1900
|
for (let d = 0; d < n; d++) {
|
|
1900
|
-
const f =
|
|
1901
|
+
const f = Ut(), h = await H(a, i, "tree", r, f), p = h.metrics.accuracy || h.metrics.r2Score || 0;
|
|
1901
1902
|
c.push({
|
|
1902
1903
|
parameters: f,
|
|
1903
1904
|
score: p,
|
|
@@ -1906,7 +1907,7 @@ async function $n(s, e) {
|
|
|
1906
1907
|
}
|
|
1907
1908
|
const l = c.reduce(
|
|
1908
1909
|
(d, f) => f.score > d.score ? f : d
|
|
1909
|
-
), u = await
|
|
1910
|
+
), u = await H(a, i, "tree", r), m = u.metrics.accuracy || u.metrics.r2Score || 0;
|
|
1910
1911
|
return {
|
|
1911
1912
|
bestParameters: l.parameters,
|
|
1912
1913
|
bestScore: l.score,
|
|
@@ -1914,15 +1915,15 @@ async function $n(s, e) {
|
|
|
1914
1915
|
improvementOverDefault: (l.score - m) / m * 100
|
|
1915
1916
|
};
|
|
1916
1917
|
}
|
|
1917
|
-
async function
|
|
1918
|
+
async function H(s, e, t, n, o) {
|
|
1918
1919
|
const a = Date.now();
|
|
1919
1920
|
let i = {};
|
|
1920
1921
|
if (n === "classification") {
|
|
1921
|
-
const r = e.map(() =>
|
|
1922
|
-
i =
|
|
1922
|
+
const r = e.map(() => Ht(e));
|
|
1923
|
+
i = Qt(e, r);
|
|
1923
1924
|
} else {
|
|
1924
1925
|
const r = e.reduce((l, u) => l + u, 0) / e.length, c = e.map(() => r);
|
|
1925
|
-
i =
|
|
1926
|
+
i = Jt(e, c);
|
|
1926
1927
|
}
|
|
1927
1928
|
return {
|
|
1928
1929
|
name: t.charAt(0).toUpperCase() + t.slice(1),
|
|
@@ -1932,10 +1933,10 @@ async function J(s, e, t, n, o) {
|
|
|
1932
1933
|
parameters: o || {}
|
|
1933
1934
|
};
|
|
1934
1935
|
}
|
|
1935
|
-
function
|
|
1936
|
+
function ge(s) {
|
|
1936
1937
|
return new Set(s).size < s.length * 0.05 ? "classification" : "regression";
|
|
1937
1938
|
}
|
|
1938
|
-
function
|
|
1939
|
+
function Qt(s, e) {
|
|
1939
1940
|
const n = s.filter((o, a) => o === e[a]).length / s.length;
|
|
1940
1941
|
return {
|
|
1941
1942
|
accuracy: n,
|
|
@@ -1944,7 +1945,7 @@ function Ot(s, e) {
|
|
|
1944
1945
|
f1Score: n
|
|
1945
1946
|
};
|
|
1946
1947
|
}
|
|
1947
|
-
function
|
|
1948
|
+
function Jt(s, e) {
|
|
1948
1949
|
const t = s.length, n = s.reduce((l, u) => l + u, 0) / t;
|
|
1949
1950
|
let o = 0, a = 0, i = 0, r = 0;
|
|
1950
1951
|
for (let l = 0; l < t; l++) {
|
|
@@ -1959,13 +1960,13 @@ function Rt(s, e) {
|
|
|
1959
1960
|
r2Score: c
|
|
1960
1961
|
};
|
|
1961
1962
|
}
|
|
1962
|
-
function
|
|
1963
|
+
function Ht(s) {
|
|
1963
1964
|
const e = /* @__PURE__ */ new Map();
|
|
1964
1965
|
for (const t of s)
|
|
1965
1966
|
e.set(t, (e.get(t) || 0) + 1);
|
|
1966
1967
|
return Array.from(e.entries()).reduce((t, n) => t[1] > n[1] ? t : n)[0];
|
|
1967
1968
|
}
|
|
1968
|
-
function
|
|
1969
|
+
function Bt(s, e, t) {
|
|
1969
1970
|
return s.map((n, o) => ({
|
|
1970
1971
|
feature: n,
|
|
1971
1972
|
importance: Math.random(),
|
|
@@ -1974,18 +1975,18 @@ function Et(s, e, t) {
|
|
|
1974
1975
|
method: "random_forest"
|
|
1975
1976
|
})).sort((n, o) => o.importance - n.importance);
|
|
1976
1977
|
}
|
|
1977
|
-
function
|
|
1978
|
+
function Lt(s, e) {
|
|
1978
1979
|
const t = [];
|
|
1979
1980
|
return Math.max(...s.map((o) => o.metrics.accuracy || o.metrics.r2Score || 0)) < 0.7 && (t.push("Consider feature engineering to improve model performance"), t.push("Try collecting more training data")), t.push(`Best model for ${e}: ${s[0].name}`), t;
|
|
1980
1981
|
}
|
|
1981
|
-
function
|
|
1982
|
+
function Ut() {
|
|
1982
1983
|
return {
|
|
1983
1984
|
maxDepth: Math.floor(Math.random() * 10) + 3,
|
|
1984
1985
|
minSamplesSplit: Math.floor(Math.random() * 5) + 2,
|
|
1985
1986
|
learningRate: Math.random() * 0.1 + 0.01
|
|
1986
1987
|
};
|
|
1987
1988
|
}
|
|
1988
|
-
async function
|
|
1989
|
+
async function On(s, e) {
|
|
1989
1990
|
const {
|
|
1990
1991
|
maxFeatures: t = 20,
|
|
1991
1992
|
includeInteractions: n = !0,
|
|
@@ -2032,16 +2033,16 @@ async function In(s, e) {
|
|
|
2032
2033
|
totalFeatureCount: a.length + c.length
|
|
2033
2034
|
};
|
|
2034
2035
|
}
|
|
2035
|
-
async function
|
|
2036
|
+
async function Rn(s, e) {
|
|
2036
2037
|
let t = JSON.parse(JSON.stringify(s));
|
|
2037
2038
|
for (const n of e)
|
|
2038
|
-
t =
|
|
2039
|
+
t = Gt(t, n);
|
|
2039
2040
|
return t;
|
|
2040
2041
|
}
|
|
2041
|
-
async function
|
|
2042
|
+
async function Kt(s, e) {
|
|
2042
2043
|
const t = Object.keys(s[0]).filter((o) => o !== e), n = [];
|
|
2043
2044
|
for (const o of t) {
|
|
2044
|
-
const a = s.map((c) => Number(c[o]) || 0), i = s.map((c) => Number(c[e]) || 0), r = Math.abs(
|
|
2045
|
+
const a = s.map((c) => Number(c[o]) || 0), i = s.map((c) => Number(c[e]) || 0), r = Math.abs(Wt(a, i));
|
|
2045
2046
|
n.push({
|
|
2046
2047
|
feature: o,
|
|
2047
2048
|
importance: r,
|
|
@@ -2051,9 +2052,9 @@ async function jt(s, e) {
|
|
|
2051
2052
|
}
|
|
2052
2053
|
return n.sort((o, a) => a.importance - o.importance), n.forEach((o, a) => o.rank = a + 1), n;
|
|
2053
2054
|
}
|
|
2054
|
-
async function
|
|
2055
|
+
async function zn(s, e) {
|
|
2055
2056
|
var r;
|
|
2056
|
-
const { targetColumn: t, method: n, topK: o = 10 } = e, a = await
|
|
2057
|
+
const { targetColumn: t, method: n, topK: o = 10 } = e, a = await Kt(s, t);
|
|
2057
2058
|
return {
|
|
2058
2059
|
selectedFeatures: a.slice(0, o).map((c) => c.feature),
|
|
2059
2060
|
scores: a,
|
|
@@ -2061,7 +2062,7 @@ async function xn(s, e) {
|
|
|
2061
2062
|
threshold: (r = a[Math.min(o - 1, a.length - 1)]) == null ? void 0 : r.importance
|
|
2062
2063
|
};
|
|
2063
2064
|
}
|
|
2064
|
-
function
|
|
2065
|
+
function Gt(s, e) {
|
|
2065
2066
|
const { type: t, columns: n, outputName: o } = e;
|
|
2066
2067
|
return s.map((a) => {
|
|
2067
2068
|
const i = { ...a }, r = n.map((l) => Number(a[l]) || 0);
|
|
@@ -2088,7 +2089,7 @@ function Qt(s, e) {
|
|
|
2088
2089
|
return i[o || `${n.join("_")}_${t}`] = c, i;
|
|
2089
2090
|
});
|
|
2090
2091
|
}
|
|
2091
|
-
function
|
|
2092
|
+
function Wt(s, e) {
|
|
2092
2093
|
const t = s.length, n = s.reduce((l, u) => l + u, 0) / t, o = e.reduce((l, u) => l + u, 0) / t;
|
|
2093
2094
|
let a = 0, i = 0, r = 0;
|
|
2094
2095
|
for (let l = 0; l < t; l++) {
|
|
@@ -2098,7 +2099,7 @@ function Jt(s, e) {
|
|
|
2098
2099
|
const c = Math.sqrt(i * r);
|
|
2099
2100
|
return c === 0 ? 0 : a / c;
|
|
2100
2101
|
}
|
|
2101
|
-
async function
|
|
2102
|
+
async function En(s, e) {
|
|
2102
2103
|
const { rowIndex: t, targetColumn: n } = e, o = s[t], i = Object.keys(o).filter((m) => m !== n).map((m) => {
|
|
2103
2104
|
const d = o[m], f = Math.random() * 2 - 1;
|
|
2104
2105
|
return {
|
|
@@ -2122,7 +2123,7 @@ async function qn(s, e) {
|
|
|
2122
2123
|
topFeatures: r
|
|
2123
2124
|
};
|
|
2124
2125
|
}
|
|
2125
|
-
async function
|
|
2126
|
+
async function Vn(s, e, t) {
|
|
2126
2127
|
return Object.keys(s[0]).filter((o) => o !== e).map((o, a) => ({
|
|
2127
2128
|
feature: o,
|
|
2128
2129
|
importance: Math.random(),
|
|
@@ -2131,7 +2132,7 @@ async function Pn(s, e, t) {
|
|
|
2131
2132
|
method: t || "default"
|
|
2132
2133
|
})).sort((o, a) => a.importance - o.importance).map((o, a) => ({ ...o, rank: a + 1 }));
|
|
2133
2134
|
}
|
|
2134
|
-
async function
|
|
2135
|
+
async function Fn(s, e) {
|
|
2135
2136
|
const { feature: t, targetColumn: n } = e, o = s.map((u) => Number(u[t])).filter((u) => !isNaN(u)).sort((u, m) => u - m), a = o[0], i = o[o.length - 1], r = (i - a) / 20, c = [], l = [];
|
|
2136
2137
|
for (let u = a; u <= i; u += r)
|
|
2137
2138
|
c.push(u), l.push(Math.random() * 100);
|
|
@@ -2142,7 +2143,7 @@ async function Tn(s, e) {
|
|
|
2142
2143
|
description: `Partial dependence of ${n} on ${t}`
|
|
2143
2144
|
};
|
|
2144
2145
|
}
|
|
2145
|
-
async function
|
|
2146
|
+
async function jn(s, e) {
|
|
2146
2147
|
const { rowIndex: t, desiredOutcome: n, targetColumn: o, maxChanges: a = 3 } = e, i = s[t], r = Object.keys(i).filter((l) => l !== o), c = [];
|
|
2147
2148
|
for (let l = 0; l < 3; l++) {
|
|
2148
2149
|
const u = { ...i }, m = [], d = r.slice(0, a);
|
|
@@ -2166,8 +2167,8 @@ async function Dn(s, e) {
|
|
|
2166
2167
|
}
|
|
2167
2168
|
return c;
|
|
2168
2169
|
}
|
|
2169
|
-
async function
|
|
2170
|
-
const { controlGroup: e, treatmentGroup: t, metric: n, confidenceLevel: o = 0.95 } = s, a = e.map((w) => Number(w[n])).filter((w) => !isNaN(w)), i = t.map((w) => Number(w[n])).filter((w) => !isNaN(w)), r = a.reduce((w, g) => w + g, 0) / a.length, c = i.reduce((w, g) => w + g, 0) / i.length, l = R(a), u = R(i), { pValue: m } =
|
|
2170
|
+
async function Qn(s) {
|
|
2171
|
+
const { controlGroup: e, treatmentGroup: t, metric: n, confidenceLevel: o = 0.95 } = s, a = e.map((w) => Number(w[n])).filter((w) => !isNaN(w)), i = t.map((w) => Number(w[n])).filter((w) => !isNaN(w)), r = a.reduce((w, g) => w + g, 0) / a.length, c = i.reduce((w, g) => w + g, 0) / i.length, l = R(a), u = R(i), { pValue: m } = ye(a, i), d = Math.sqrt((l ** 2 + u ** 2) / 2), f = (c - r) / d;
|
|
2171
2172
|
let h;
|
|
2172
2173
|
m < 1 - o ? h = c > r ? "treatment" : "control" : h = "inconclusive";
|
|
2173
2174
|
const p = h === "inconclusive" ? "No significant difference detected. Consider collecting more data." : `${h === "treatment" ? "Treatment" : "Control"} group performs better with ${Math.abs(f).toFixed(2)} effect size.`;
|
|
@@ -2194,10 +2195,10 @@ async function _n(s) {
|
|
|
2194
2195
|
}
|
|
2195
2196
|
};
|
|
2196
2197
|
}
|
|
2197
|
-
async function
|
|
2198
|
+
async function Jn(s) {
|
|
2198
2199
|
const { test: e, groups: t, metric: n, alpha: o = 0.05 } = s;
|
|
2199
2200
|
if (e === "ttest" && t.length === 2) {
|
|
2200
|
-
const a = t[0].map((l) => Number(l[n])).filter((l) => !isNaN(l)), i = t[1].map((l) => Number(l[n])).filter((l) => !isNaN(l)), { pValue: r, statistic: c } =
|
|
2201
|
+
const a = t[0].map((l) => Number(l[n])).filter((l) => !isNaN(l)), i = t[1].map((l) => Number(l[n])).filter((l) => !isNaN(l)), { pValue: r, statistic: c } = ye(a, i);
|
|
2201
2202
|
return {
|
|
2202
2203
|
testType: "ttest",
|
|
2203
2204
|
pValue: r,
|
|
@@ -2232,7 +2233,7 @@ async function On(s) {
|
|
|
2232
2233
|
groups: []
|
|
2233
2234
|
};
|
|
2234
2235
|
}
|
|
2235
|
-
async function
|
|
2236
|
+
async function Hn(s) {
|
|
2236
2237
|
const { effect: e, power: t = 0.8, alpha: n = 0.05 } = s, i = Math.ceil(2 * Math.pow((1.96 + 0.84) / e, 2));
|
|
2237
2238
|
return {
|
|
2238
2239
|
requiredSampleSize: i,
|
|
@@ -2246,18 +2247,18 @@ function R(s) {
|
|
|
2246
2247
|
const e = s.reduce((n, o) => n + o, 0) / s.length, t = s.reduce((n, o) => n + Math.pow(o - e, 2), 0) / s.length;
|
|
2247
2248
|
return Math.sqrt(t);
|
|
2248
2249
|
}
|
|
2249
|
-
function
|
|
2250
|
+
function ye(s, e) {
|
|
2250
2251
|
const t = s.reduce((m, d) => m + d, 0) / s.length, n = e.reduce((m, d) => m + d, 0) / e.length, o = R(s) ** 2, a = R(e) ** 2, i = s.length, r = e.length, c = ((i - 1) * o + (r - 1) * a) / (i + r - 2), l = (t - n) / Math.sqrt(c * (1 / i + 1 / r));
|
|
2251
|
-
return { pValue: 2 * (1 -
|
|
2252
|
+
return { pValue: 2 * (1 - Xt(Math.abs(l))), statistic: l };
|
|
2252
2253
|
}
|
|
2253
|
-
function
|
|
2254
|
+
function Xt(s) {
|
|
2254
2255
|
const e = 1 / (1 + 0.2316419 * Math.abs(s)), n = 0.3989423 * Math.exp(-s * s / 2) * e * (0.3193815 + e * (-0.3565638 + e * (1.781478 + e * (-1.821256 + e * 1.330274))));
|
|
2255
2256
|
return s > 0 ? 1 - n : n;
|
|
2256
2257
|
}
|
|
2257
|
-
async function
|
|
2258
|
+
async function Bn(s, e) {
|
|
2258
2259
|
const t = (e == null ? void 0 : e.columns) || Object.keys(s[0]), n = [], o = [], a = [], i = [];
|
|
2259
2260
|
for (const r of t) {
|
|
2260
|
-
const c = s.map((u) => u[r]), l =
|
|
2261
|
+
const c = s.map((u) => u[r]), l = U(c);
|
|
2261
2262
|
l === "numeric" ? o.push(r) : l === "categorical" ? a.push(r) : l === "datetime" && i.push(r);
|
|
2262
2263
|
}
|
|
2263
2264
|
return i.length > 0 && o.length > 0 && n.push({
|
|
@@ -2316,12 +2317,12 @@ async function V(s) {
|
|
|
2316
2317
|
xAxis: {
|
|
2317
2318
|
column: t,
|
|
2318
2319
|
label: t,
|
|
2319
|
-
type:
|
|
2320
|
+
type: U(a.map((r) => r[t]))
|
|
2320
2321
|
},
|
|
2321
2322
|
data: a
|
|
2322
2323
|
};
|
|
2323
2324
|
if (n) {
|
|
2324
|
-
const r =
|
|
2325
|
+
const r = U(a.map((c) => c[n]));
|
|
2325
2326
|
i.yAxis = {
|
|
2326
2327
|
column: n,
|
|
2327
2328
|
label: n,
|
|
@@ -2330,7 +2331,7 @@ async function V(s) {
|
|
|
2330
2331
|
}
|
|
2331
2332
|
return o && (i.groupBy = o), i;
|
|
2332
2333
|
}
|
|
2333
|
-
async function
|
|
2334
|
+
async function Ln(s, e) {
|
|
2334
2335
|
const t = [];
|
|
2335
2336
|
return s === "line" && t.push({
|
|
2336
2337
|
type: "trend",
|
|
@@ -2344,14 +2345,14 @@ async function En(s, e) {
|
|
|
2344
2345
|
recommendation: "Investigate causal relationship"
|
|
2345
2346
|
}), t;
|
|
2346
2347
|
}
|
|
2347
|
-
function
|
|
2348
|
+
function U(s) {
|
|
2348
2349
|
const e = s.filter((o) => o != null && o !== "");
|
|
2349
2350
|
return e.length === 0 ? "categorical" : e.filter((o) => !isNaN(Number(o))).length / e.length > 0.8 ? "numeric" : e.filter((o) => {
|
|
2350
2351
|
const a = new Date(o);
|
|
2351
2352
|
return !isNaN(a.getTime());
|
|
2352
2353
|
}).length / e.length > 0.8 ? "datetime" : "categorical";
|
|
2353
2354
|
}
|
|
2354
|
-
async function
|
|
2355
|
+
async function Yt(s) {
|
|
2355
2356
|
const { leftTable: e, rightTable: t, leftKey: n, rightKey: o, joinType: a } = s, i = [], r = /* @__PURE__ */ new Map();
|
|
2356
2357
|
for (const c of t) {
|
|
2357
2358
|
const l = c[o];
|
|
@@ -2371,14 +2372,14 @@ async function Ht(s) {
|
|
|
2371
2372
|
}
|
|
2372
2373
|
return i;
|
|
2373
2374
|
}
|
|
2374
|
-
async function
|
|
2375
|
+
async function Zt(s) {
|
|
2375
2376
|
const e = [], t = Object.keys(s);
|
|
2376
2377
|
for (let n = 0; n < t.length; n++)
|
|
2377
2378
|
for (let o = n + 1; o < t.length; o++) {
|
|
2378
2379
|
const a = t[n], i = t[o], r = s[a], c = s[i], l = Object.keys(r[0] || {}), u = Object.keys(c[0] || {});
|
|
2379
2380
|
for (const m of l)
|
|
2380
2381
|
for (const d of u) {
|
|
2381
|
-
const f =
|
|
2382
|
+
const f = en(
|
|
2382
2383
|
r,
|
|
2383
2384
|
m,
|
|
2384
2385
|
c,
|
|
@@ -2391,7 +2392,7 @@ async function Lt(s) {
|
|
|
2391
2392
|
}
|
|
2392
2393
|
return e;
|
|
2393
2394
|
}
|
|
2394
|
-
async function
|
|
2395
|
+
async function Un(s) {
|
|
2395
2396
|
const { tables: e, relationships: t, question: n } = s, o = Object.keys(e), a = t.map((r) => ({
|
|
2396
2397
|
left: r.fromTable,
|
|
2397
2398
|
right: r.toTable,
|
|
@@ -2400,7 +2401,7 @@ async function Vn(s) {
|
|
|
2400
2401
|
}));
|
|
2401
2402
|
let i = e[o[0]];
|
|
2402
2403
|
for (const r of t)
|
|
2403
|
-
e[r.toTable] && (i = await
|
|
2404
|
+
e[r.toTable] && (i = await Yt({
|
|
2404
2405
|
leftTable: i,
|
|
2405
2406
|
rightTable: e[r.toTable],
|
|
2406
2407
|
leftKey: r.fromColumn,
|
|
@@ -2420,13 +2421,13 @@ async function Vn(s) {
|
|
|
2420
2421
|
joinOperations: a
|
|
2421
2422
|
};
|
|
2422
2423
|
}
|
|
2423
|
-
async function
|
|
2424
|
+
async function Kn(s) {
|
|
2424
2425
|
const e = [];
|
|
2425
2426
|
for (const [n, o] of Object.entries(s)) {
|
|
2426
2427
|
if (o.length === 0) continue;
|
|
2427
2428
|
const a = Object.keys(o[0]).map((i) => ({
|
|
2428
2429
|
name: i,
|
|
2429
|
-
type:
|
|
2430
|
+
type: tn(o.map((r) => r[i])),
|
|
2430
2431
|
nullable: o.some((r) => r[i] === null || r[i] === void 0)
|
|
2431
2432
|
}));
|
|
2432
2433
|
e.push({
|
|
@@ -2435,13 +2436,13 @@ async function Fn(s) {
|
|
|
2435
2436
|
rowCount: o.length
|
|
2436
2437
|
});
|
|
2437
2438
|
}
|
|
2438
|
-
const t = await
|
|
2439
|
+
const t = await Zt(s);
|
|
2439
2440
|
return {
|
|
2440
2441
|
tables: e,
|
|
2441
2442
|
relationships: t
|
|
2442
2443
|
};
|
|
2443
2444
|
}
|
|
2444
|
-
function
|
|
2445
|
+
function en(s, e, t, n, o, a) {
|
|
2445
2446
|
const i = new Set(s.map((d) => d[e]).filter((d) => d != null)), r = new Set(t.map((d) => d[n]).filter((d) => d != null)), l = new Set([...i].filter((d) => r.has(d))).size;
|
|
2446
2447
|
if (l < Math.min(i.size, r.size) * 0.1)
|
|
2447
2448
|
return null;
|
|
@@ -2458,24 +2459,24 @@ function Ut(s, e, t, n, o, a) {
|
|
|
2458
2459
|
totalRows: s.length
|
|
2459
2460
|
};
|
|
2460
2461
|
}
|
|
2461
|
-
function
|
|
2462
|
+
function tn(s) {
|
|
2462
2463
|
const e = s.filter((n) => n != null && n !== "");
|
|
2463
2464
|
return e.length === 0 ? "string" : e.filter((n) => !isNaN(Number(n))).length / e.length > 0.8 ? "number" : "categorical";
|
|
2464
2465
|
}
|
|
2465
|
-
async function
|
|
2466
|
+
async function Gn(s, e) {
|
|
2466
2467
|
const { format: t, sections: n = ["summary", "stats", "recommendations"], includeCharts: o = !1 } = e, a = [];
|
|
2467
2468
|
return n.includes("summary") && a.push({
|
|
2468
2469
|
type: "summary",
|
|
2469
2470
|
title: "Executive Summary",
|
|
2470
|
-
content: await
|
|
2471
|
+
content: await nn(s)
|
|
2471
2472
|
}), n.includes("stats") && a.push({
|
|
2472
2473
|
type: "stats",
|
|
2473
2474
|
title: "Statistical Overview",
|
|
2474
|
-
content:
|
|
2475
|
+
content: sn(s)
|
|
2475
2476
|
}), n.includes("recommendations") && a.push({
|
|
2476
2477
|
type: "recommendations",
|
|
2477
2478
|
title: "Recommendations",
|
|
2478
|
-
content:
|
|
2479
|
+
content: on()
|
|
2479
2480
|
}), {
|
|
2480
2481
|
format: t,
|
|
2481
2482
|
title: "Data Analysis Report",
|
|
@@ -2488,7 +2489,7 @@ async function jn(s, e) {
|
|
|
2488
2489
|
}
|
|
2489
2490
|
};
|
|
2490
2491
|
}
|
|
2491
|
-
async function
|
|
2492
|
+
async function nn(s) {
|
|
2492
2493
|
const e = s.length, t = Object.keys(s[0] || {}).length;
|
|
2493
2494
|
return `
|
|
2494
2495
|
# Executive Summary
|
|
@@ -2506,7 +2507,7 @@ This dataset contains **${e} rows** and **${t} columns**.
|
|
|
2506
2507
|
- Explore correlations between variables
|
|
2507
2508
|
`.trim();
|
|
2508
2509
|
}
|
|
2509
|
-
async function
|
|
2510
|
+
async function Wn(s, e) {
|
|
2510
2511
|
const { maxInsights: t = 10 } = e || {}, n = [], o = Object.keys(s[0] || {});
|
|
2511
2512
|
for (const a of o.slice(0, t)) {
|
|
2512
2513
|
const i = s.map((l) => l[a]);
|
|
@@ -2536,7 +2537,7 @@ async function Qn(s, e) {
|
|
|
2536
2537
|
}
|
|
2537
2538
|
return n.slice(0, t);
|
|
2538
2539
|
}
|
|
2539
|
-
function
|
|
2540
|
+
function sn(s) {
|
|
2540
2541
|
const e = Object.keys(s[0] || {}), t = e.filter((n) => s.map((a) => a[n]).some((a) => !isNaN(Number(a))));
|
|
2541
2542
|
return `
|
|
2542
2543
|
## Statistical Overview
|
|
@@ -2547,7 +2548,7 @@ function Wt(s) {
|
|
|
2547
2548
|
- Categorical Columns: ${e.length - t.length}
|
|
2548
2549
|
`.trim();
|
|
2549
2550
|
}
|
|
2550
|
-
function
|
|
2551
|
+
function on(s) {
|
|
2551
2552
|
return `
|
|
2552
2553
|
## Recommendations
|
|
2553
2554
|
|
|
@@ -2557,7 +2558,7 @@ function Xt(s) {
|
|
|
2557
2558
|
4. **Visualization**: Create charts to explore patterns
|
|
2558
2559
|
`.trim();
|
|
2559
2560
|
}
|
|
2560
|
-
async function
|
|
2561
|
+
async function an(s) {
|
|
2561
2562
|
const e = Object.keys(s[0] || {}), t = [];
|
|
2562
2563
|
for (const o of e) {
|
|
2563
2564
|
const a = s.map((r) => String(r[o])).filter((r) => r && r !== "null" && r !== "undefined"), i = a.slice(0, 5);
|
|
@@ -2565,13 +2566,13 @@ async function Yt(s) {
|
|
|
2565
2566
|
column: o,
|
|
2566
2567
|
type: "email",
|
|
2567
2568
|
confidence: 0.95,
|
|
2568
|
-
sampleValues: i.slice(0, 3).map((r) =>
|
|
2569
|
+
sampleValues: i.slice(0, 3).map((r) => rn(r)),
|
|
2569
2570
|
count: a.length
|
|
2570
2571
|
}), a.some((r) => /^\+?[\d\s\-()]{10,}$/.test(r)) && t.push({
|
|
2571
2572
|
column: o,
|
|
2572
2573
|
type: "phone",
|
|
2573
2574
|
confidence: 0.85,
|
|
2574
|
-
sampleValues: i.slice(0, 3).map((r) =>
|
|
2575
|
+
sampleValues: i.slice(0, 3).map((r) => cn(r)),
|
|
2575
2576
|
count: a.length
|
|
2576
2577
|
}), a.some((r) => /^\d{3}-\d{2}-\d{4}$/.test(r)) && t.push({
|
|
2577
2578
|
column: o,
|
|
@@ -2596,27 +2597,27 @@ async function Yt(s) {
|
|
|
2596
2597
|
const n = t.length > 5 ? "high" : t.length > 2 ? "medium" : "low";
|
|
2597
2598
|
return {
|
|
2598
2599
|
piiColumns: t,
|
|
2599
|
-
recommendations:
|
|
2600
|
+
recommendations: dn(t),
|
|
2600
2601
|
riskLevel: n
|
|
2601
2602
|
};
|
|
2602
2603
|
}
|
|
2603
|
-
async function
|
|
2604
|
+
async function Xn(s, e) {
|
|
2604
2605
|
const { method: t, columns: n } = e, o = n || Object.keys(s[0]);
|
|
2605
2606
|
return {
|
|
2606
2607
|
data: s.map((i) => {
|
|
2607
2608
|
const r = { ...i };
|
|
2608
2609
|
for (const c of o)
|
|
2609
|
-
r[c] =
|
|
2610
|
+
r[c] = ln(i[c], t);
|
|
2610
2611
|
return r;
|
|
2611
2612
|
}),
|
|
2612
2613
|
method: t,
|
|
2613
2614
|
columns: o,
|
|
2614
2615
|
reversible: t === "tokenization",
|
|
2615
|
-
privacyLevel:
|
|
2616
|
+
privacyLevel: mn(t)
|
|
2616
2617
|
};
|
|
2617
2618
|
}
|
|
2618
|
-
async function
|
|
2619
|
-
const t = await
|
|
2619
|
+
async function Yn(s, e) {
|
|
2620
|
+
const t = await an(s), n = [];
|
|
2620
2621
|
t.piiColumns.length > 0 && n.push({
|
|
2621
2622
|
rule: `${e} - PII Protection`,
|
|
2622
2623
|
description: `Found ${t.piiColumns.length} columns containing PII`,
|
|
@@ -2638,20 +2639,20 @@ async function Bn(s, e) {
|
|
|
2638
2639
|
timestamp: /* @__PURE__ */ new Date()
|
|
2639
2640
|
};
|
|
2640
2641
|
}
|
|
2641
|
-
function
|
|
2642
|
+
function rn(s) {
|
|
2642
2643
|
const [e, t] = s.split("@");
|
|
2643
2644
|
return `${e.slice(0, 2)}***@${t}`;
|
|
2644
2645
|
}
|
|
2645
|
-
function
|
|
2646
|
+
function cn(s) {
|
|
2646
2647
|
return s.replace(/\d/g, (e, t) => t < s.length - 4 ? "*" : e);
|
|
2647
2648
|
}
|
|
2648
|
-
function
|
|
2649
|
+
function ln(s, e) {
|
|
2649
2650
|
if (s == null) return s;
|
|
2650
2651
|
switch (e) {
|
|
2651
2652
|
case "masking":
|
|
2652
2653
|
return "***MASKED***";
|
|
2653
2654
|
case "hashing":
|
|
2654
|
-
return
|
|
2655
|
+
return un(String(s));
|
|
2655
2656
|
case "generalization":
|
|
2656
2657
|
return typeof s == "number" ? Math.floor(s / 10) * 10 : "[GENERALIZED]";
|
|
2657
2658
|
case "tokenization":
|
|
@@ -2660,7 +2661,7 @@ function tn(s, e) {
|
|
|
2660
2661
|
return s;
|
|
2661
2662
|
}
|
|
2662
2663
|
}
|
|
2663
|
-
function
|
|
2664
|
+
function un(s) {
|
|
2664
2665
|
let e = 0;
|
|
2665
2666
|
for (let t = 0; t < s.length; t++) {
|
|
2666
2667
|
const n = s.charCodeAt(t);
|
|
@@ -2668,7 +2669,7 @@ function nn(s) {
|
|
|
2668
2669
|
}
|
|
2669
2670
|
return `HASH_${Math.abs(e).toString(16)}`;
|
|
2670
2671
|
}
|
|
2671
|
-
function
|
|
2672
|
+
function mn(s) {
|
|
2672
2673
|
return {
|
|
2673
2674
|
masking: 60,
|
|
2674
2675
|
hashing: 80,
|
|
@@ -2677,12 +2678,12 @@ function sn(s) {
|
|
|
2677
2678
|
tokenization: 70
|
|
2678
2679
|
}[s] || 50;
|
|
2679
2680
|
}
|
|
2680
|
-
function
|
|
2681
|
+
function dn(s) {
|
|
2681
2682
|
const e = [];
|
|
2682
2683
|
return s.length > 0 && (e.push("Implement data anonymization for PII columns"), e.push("Add access controls to restrict PII access"), e.push("Enable audit logging for PII access")), s.some((t) => t.type === "ssn" || t.type === "credit_card") && e.push("CRITICAL: Encrypt sensitive financial/identity data"), e;
|
|
2683
2684
|
}
|
|
2684
|
-
const
|
|
2685
|
-
async function
|
|
2685
|
+
const K = /* @__PURE__ */ new Map(), we = /* @__PURE__ */ new Map();
|
|
2686
|
+
async function Zn(s, e) {
|
|
2686
2687
|
const t = `snapshot_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`, n = Object.keys(s[0] || {}), o = {
|
|
2687
2688
|
id: t,
|
|
2688
2689
|
label: e || `Snapshot ${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
@@ -2690,7 +2691,7 @@ async function Hn(s, e) {
|
|
|
2690
2691
|
schema: {
|
|
2691
2692
|
columns: n.map((a) => ({
|
|
2692
2693
|
name: a,
|
|
2693
|
-
type:
|
|
2694
|
+
type: fn(s.map((i) => i[a]))
|
|
2694
2695
|
})),
|
|
2695
2696
|
rowCount: s.length
|
|
2696
2697
|
},
|
|
@@ -2698,13 +2699,13 @@ async function Hn(s, e) {
|
|
|
2698
2699
|
metadata: {
|
|
2699
2700
|
rowCount: s.length,
|
|
2700
2701
|
columnCount: n.length,
|
|
2701
|
-
checksum:
|
|
2702
|
+
checksum: hn(s)
|
|
2702
2703
|
}
|
|
2703
2704
|
};
|
|
2704
|
-
return
|
|
2705
|
+
return K.set(t, o), o;
|
|
2705
2706
|
}
|
|
2706
|
-
async function
|
|
2707
|
-
const t =
|
|
2707
|
+
async function es(s, e) {
|
|
2708
|
+
const t = K.get(s), n = K.get(e);
|
|
2708
2709
|
if (!t || !n)
|
|
2709
2710
|
throw new Error("Snapshot not found");
|
|
2710
2711
|
const o = new Set(t.schema.columns.map((u) => u.name)), a = new Set(n.schema.columns.map((u) => u.name)), i = Array.from(a).filter((u) => !o.has(u)), r = Array.from(o).filter((u) => !a.has(u)), c = n.data.length - t.data.length, l = c < 0 ? Math.abs(c) : 0;
|
|
@@ -2723,7 +2724,7 @@ async function Ln(s, e) {
|
|
|
2723
2724
|
details: []
|
|
2724
2725
|
};
|
|
2725
2726
|
}
|
|
2726
|
-
async function
|
|
2727
|
+
async function ts(s, e) {
|
|
2727
2728
|
const t = {
|
|
2728
2729
|
source: e,
|
|
2729
2730
|
transformations: [],
|
|
@@ -2733,17 +2734,17 @@ async function Un(s, e) {
|
|
|
2733
2734
|
lastModified: /* @__PURE__ */ new Date()
|
|
2734
2735
|
}
|
|
2735
2736
|
};
|
|
2736
|
-
return
|
|
2737
|
+
return we.set(s, t), t;
|
|
2737
2738
|
}
|
|
2738
|
-
function
|
|
2739
|
-
const n =
|
|
2739
|
+
function ns(s, e, t) {
|
|
2740
|
+
const n = we.get(s);
|
|
2740
2741
|
n && n.transformations.push({
|
|
2741
2742
|
operation: e,
|
|
2742
2743
|
timestamp: /* @__PURE__ */ new Date(),
|
|
2743
2744
|
params: t
|
|
2744
2745
|
});
|
|
2745
2746
|
}
|
|
2746
|
-
async function
|
|
2747
|
+
async function ss(s) {
|
|
2747
2748
|
return {
|
|
2748
2749
|
id: `pipeline_${Date.now()}`,
|
|
2749
2750
|
name: "Data Processing Pipeline",
|
|
@@ -2751,7 +2752,7 @@ async function Gn(s) {
|
|
|
2751
2752
|
createdAt: /* @__PURE__ */ new Date()
|
|
2752
2753
|
};
|
|
2753
2754
|
}
|
|
2754
|
-
async function
|
|
2755
|
+
async function os(s, e) {
|
|
2755
2756
|
const t = Date.now();
|
|
2756
2757
|
let n = JSON.parse(JSON.stringify(e));
|
|
2757
2758
|
const o = [];
|
|
@@ -2761,7 +2762,7 @@ async function Wn(s, e) {
|
|
|
2761
2762
|
try {
|
|
2762
2763
|
if (r.condition && !r.condition(n))
|
|
2763
2764
|
continue;
|
|
2764
|
-
n = await
|
|
2765
|
+
n = await pn(n, r), a++;
|
|
2765
2766
|
} catch (c) {
|
|
2766
2767
|
if (o.push({
|
|
2767
2768
|
step: i,
|
|
@@ -2779,10 +2780,10 @@ async function Wn(s, e) {
|
|
|
2779
2780
|
errors: o.length > 0 ? o : void 0
|
|
2780
2781
|
};
|
|
2781
2782
|
}
|
|
2782
|
-
async function
|
|
2783
|
+
async function as(s, e) {
|
|
2783
2784
|
console.log(`Pipeline "${e}" saved`);
|
|
2784
2785
|
}
|
|
2785
|
-
async function
|
|
2786
|
+
async function rs(s) {
|
|
2786
2787
|
return {
|
|
2787
2788
|
id: "loaded_pipeline",
|
|
2788
2789
|
name: s,
|
|
@@ -2790,11 +2791,11 @@ async function Yn(s) {
|
|
|
2790
2791
|
createdAt: /* @__PURE__ */ new Date()
|
|
2791
2792
|
};
|
|
2792
2793
|
}
|
|
2793
|
-
function
|
|
2794
|
+
function fn(s) {
|
|
2794
2795
|
const e = s.filter((n) => n != null && n !== "");
|
|
2795
2796
|
return e.length === 0 ? "string" : e.filter((n) => !isNaN(Number(n))).length / e.length > 0.8 ? "number" : "categorical";
|
|
2796
2797
|
}
|
|
2797
|
-
function
|
|
2798
|
+
function hn(s) {
|
|
2798
2799
|
const e = JSON.stringify(s);
|
|
2799
2800
|
let t = 0;
|
|
2800
2801
|
for (let n = 0; n < e.length; n++) {
|
|
@@ -2803,10 +2804,10 @@ function rn(s) {
|
|
|
2803
2804
|
}
|
|
2804
2805
|
return Math.abs(t).toString(16);
|
|
2805
2806
|
}
|
|
2806
|
-
async function
|
|
2807
|
+
async function pn(s, e) {
|
|
2807
2808
|
return s;
|
|
2808
2809
|
}
|
|
2809
|
-
async function
|
|
2810
|
+
async function is(s) {
|
|
2810
2811
|
const { source: e, url: t, updateInterval: n = 1e3 } = s, o = {
|
|
2811
2812
|
id: `stream_${Date.now()}`,
|
|
2812
2813
|
source: e,
|
|
@@ -2824,15 +2825,15 @@ async function Zn(s) {
|
|
|
2824
2825
|
o.connected = !0;
|
|
2825
2826
|
}, 100), o;
|
|
2826
2827
|
}
|
|
2827
|
-
async function
|
|
2828
|
+
async function cs(s, e) {
|
|
2828
2829
|
const { columns: t, threshold: n, windowSize: o = 100 } = e;
|
|
2829
2830
|
console.log(`Monitoring anomalies on columns: ${t.join(", ")}`);
|
|
2830
2831
|
}
|
|
2831
|
-
async function
|
|
2832
|
+
async function ls(s, e) {
|
|
2832
2833
|
const { windowType: t, windowSize: n, aggregations: o } = e;
|
|
2833
2834
|
console.log(`Streaming aggregation: ${t} window of ${n}`);
|
|
2834
2835
|
}
|
|
2835
|
-
async function
|
|
2836
|
+
async function us(s, e) {
|
|
2836
2837
|
const { columns: t, threshold: n, method: o = "statistical" } = e, a = [];
|
|
2837
2838
|
for (const i of t) {
|
|
2838
2839
|
const r = s.map((u) => Number(u[i])).filter((u) => !isNaN(u));
|
|
@@ -2857,7 +2858,7 @@ async function ns(s, e) {
|
|
|
2857
2858
|
}
|
|
2858
2859
|
return a;
|
|
2859
2860
|
}
|
|
2860
|
-
async function
|
|
2861
|
+
async function ms(s, e) {
|
|
2861
2862
|
const { windowType: t, windowSize: n, aggregations: o } = e, a = [];
|
|
2862
2863
|
if (t === "tumbling")
|
|
2863
2864
|
for (let i = 0; i < s.length; i += n) {
|
|
@@ -2897,21 +2898,21 @@ async function ss(s, e) {
|
|
|
2897
2898
|
}
|
|
2898
2899
|
return a;
|
|
2899
2900
|
}
|
|
2900
|
-
async function
|
|
2901
|
+
async function ds(s, e) {
|
|
2901
2902
|
const { size: t, method: n, preserveDistribution: o = !0 } = e;
|
|
2902
2903
|
let a = [];
|
|
2903
2904
|
switch (n) {
|
|
2904
2905
|
case "random":
|
|
2905
|
-
a =
|
|
2906
|
+
a = G(s, t);
|
|
2906
2907
|
break;
|
|
2907
2908
|
case "systematic":
|
|
2908
|
-
a =
|
|
2909
|
+
a = gn(s, t);
|
|
2909
2910
|
break;
|
|
2910
2911
|
case "stratified":
|
|
2911
|
-
a =
|
|
2912
|
+
a = yn(s, t);
|
|
2912
2913
|
break;
|
|
2913
2914
|
default:
|
|
2914
|
-
a =
|
|
2915
|
+
a = G(s, t);
|
|
2915
2916
|
}
|
|
2916
2917
|
return {
|
|
2917
2918
|
data: a,
|
|
@@ -2923,86 +2924,108 @@ async function os(s, e) {
|
|
|
2923
2924
|
// Simplified
|
|
2924
2925
|
};
|
|
2925
2926
|
}
|
|
2926
|
-
function
|
|
2927
|
+
function G(s, e) {
|
|
2927
2928
|
return [...s].sort(() => Math.random() - 0.5).slice(0, e);
|
|
2928
2929
|
}
|
|
2929
|
-
function
|
|
2930
|
+
function gn(s, e) {
|
|
2930
2931
|
const t = Math.floor(s.length / e), n = [];
|
|
2931
2932
|
for (let o = 0; o < s.length && n.length < e; o += t)
|
|
2932
2933
|
n.push(s[o]);
|
|
2933
2934
|
return n;
|
|
2934
2935
|
}
|
|
2935
|
-
function
|
|
2936
|
-
return
|
|
2937
|
-
}
|
|
2936
|
+
function yn(s, e) {
|
|
2937
|
+
return G(s, e);
|
|
2938
|
+
}
|
|
2939
|
+
const wn = B(le), vn = B(ue), bn = B(me), Cn = se({
|
|
2940
|
+
install(s) {
|
|
2941
|
+
F(s, "QuestionInput", le), F(s, "AnswerDisplay", ue), F(s, "QuestionHistory", me);
|
|
2942
|
+
}
|
|
2943
|
+
}), fs = {
|
|
2944
|
+
// Core
|
|
2945
|
+
TabularIntelligence: ce,
|
|
2946
|
+
// Composables
|
|
2947
|
+
useTabularIntelligence: Oe,
|
|
2948
|
+
// Components
|
|
2949
|
+
QuestionInput: wn,
|
|
2950
|
+
AnswerDisplay: vn,
|
|
2951
|
+
QuestionHistory: bn,
|
|
2952
|
+
// Plugin
|
|
2953
|
+
TabularIntelligencePlugin: Cn,
|
|
2954
|
+
// Re-export compatibility utilities for advanced users
|
|
2955
|
+
createCompatComponent: B,
|
|
2956
|
+
registerCompatComponent: F,
|
|
2957
|
+
createCompatPlugin: se
|
|
2958
|
+
};
|
|
2938
2959
|
export {
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2960
|
+
vn as AnswerDisplay,
|
|
2961
|
+
te as QAEngine,
|
|
2962
|
+
bn as QuestionHistory,
|
|
2963
|
+
wn as QuestionInput,
|
|
2964
|
+
ce as TabularIntelligence,
|
|
2965
|
+
Cn as TabularIntelligencePlugin,
|
|
2966
|
+
ns as addTransformation,
|
|
2967
|
+
Qn as analyzeABTest,
|
|
2968
|
+
Un as analyzeCrossTables,
|
|
2969
|
+
Kt as analyzeFeatureImportance,
|
|
2970
|
+
Xn as anonymizeData,
|
|
2971
|
+
kn as assessDataQuality,
|
|
2972
|
+
On as autoGenerateFeatures,
|
|
2973
|
+
Tn as autoTrain,
|
|
2974
|
+
Hn as calculateSampleSize,
|
|
2975
|
+
ae as calculateStats,
|
|
2976
|
+
ms as calculateWindowedAggregations,
|
|
2977
|
+
Yn as checkCompliance,
|
|
2978
|
+
Dn as compareModels,
|
|
2979
|
+
es as compareSnapshots,
|
|
2980
|
+
is as connectStream,
|
|
2981
|
+
_e as convertToTabular,
|
|
2982
|
+
Rn as createFeatures,
|
|
2983
|
+
ss as createPipeline,
|
|
2984
|
+
Zn as createSnapshot,
|
|
2985
|
+
fs as default,
|
|
2986
|
+
Me as detectAnomalies,
|
|
2987
|
+
Pn as detectChangePoints,
|
|
2988
|
+
de as detectDataIssues,
|
|
2989
|
+
an as detectPII,
|
|
2990
|
+
Ln as detectPatterns,
|
|
2991
|
+
Zt as detectRelationships,
|
|
2992
|
+
Vt as detectSeasonality,
|
|
2993
|
+
us as detectStreamingAnomalies,
|
|
2994
|
+
qn as detectTrends,
|
|
2995
|
+
ie as executeAPIRequest,
|
|
2996
|
+
Nn as executeMultipleRequests,
|
|
2997
|
+
os as executePipeline,
|
|
2998
|
+
En as explainPrediction,
|
|
2999
|
+
xe as extractFromDOM,
|
|
3000
|
+
xn as forecastTimeSeries,
|
|
2978
3001
|
V as generateChartSpec,
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
3002
|
+
jn as generateCounterfactuals,
|
|
3003
|
+
nn as generateExecutiveSummary,
|
|
3004
|
+
Wn as generateInsights,
|
|
3005
|
+
Gn as generateReport,
|
|
3006
|
+
Vn as getFeatureImportance,
|
|
3007
|
+
Fn as getPartialDependence,
|
|
3008
|
+
Mn as handleOutliers,
|
|
3009
|
+
$n as imputeMissingValues,
|
|
3010
|
+
oe as inferColumnType,
|
|
3011
|
+
Kn as inferDatabaseSchema,
|
|
2989
3012
|
_ as inferSchema,
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
3013
|
+
Yt as joinTables,
|
|
3014
|
+
rs as loadPipeline,
|
|
3015
|
+
cs as monitorAnomalies,
|
|
3016
|
+
qe as normalizeVueData,
|
|
3017
|
+
Te as parsePostmanCollection,
|
|
3018
|
+
Y as profileData,
|
|
3019
|
+
Bn as recommendVisualizations,
|
|
2997
3020
|
D as replaceVariables,
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3021
|
+
as as savePipeline,
|
|
3022
|
+
zn as selectBestFeatures,
|
|
3023
|
+
ds as smartSample,
|
|
3024
|
+
ls as streamingAggregation,
|
|
3025
|
+
In as suggestCleaningSteps,
|
|
3026
|
+
Jn as testSignificance,
|
|
3027
|
+
ts as trackLineage,
|
|
3028
|
+
_n as tuneHyperparameters,
|
|
3029
|
+
Oe as useTabularIntelligence
|
|
3007
3030
|
};
|
|
3008
3031
|
//# sourceMappingURL=index.mjs.map
|