@uwrl/qc-utils 0.0.15 → 0.0.18

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.
Files changed (52) hide show
  1. package/README.md +56 -0
  2. package/dist/index.d.ts +3 -2
  3. package/dist/index.js +2951 -340
  4. package/dist/index.umd.cjs +15 -3
  5. package/dist/models/dataSource.d.ts +173 -0
  6. package/dist/models/index.d.ts +2 -0
  7. package/dist/models/payload.d.ts +24 -0
  8. package/dist/models/settings.d.ts +65 -0
  9. package/dist/models/timestamp.d.ts +150 -0
  10. package/dist/services/api.d.ts +147 -0
  11. package/dist/services/apiMethods.d.ts +8 -0
  12. package/dist/services/createPatchObject.d.ts +17 -0
  13. package/dist/services/getCSRFToken.d.ts +1 -0
  14. package/dist/services/index.d.ts +6 -0
  15. package/dist/services/requestInterceptor.d.ts +12 -0
  16. package/dist/services/responseInterceptor.d.ts +2 -0
  17. package/dist/types/index.d.ts +372 -0
  18. package/dist/utils/__tests__/observations.spec.d.ts +1 -0
  19. package/dist/utils/ellapsed-time.d.ts +4 -0
  20. package/dist/utils/format.d.ts +4 -0
  21. package/dist/utils/index.d.ts +6 -0
  22. package/dist/utils/observations.d.ts +5 -0
  23. package/dist/utils/plotting/__tests__/calibration.spec.d.ts +16 -0
  24. package/dist/utils/plotting/__tests__/observation-record-paths.spec.d.ts +21 -0
  25. package/dist/utils/plotting/__tests__/observation-record.spec.d.ts +1 -0
  26. package/dist/utils/plotting/__tests__/operation-cores.spec.d.ts +12 -0
  27. package/dist/utils/plotting/__tests__/workerMocks.d.ts +119 -0
  28. package/dist/utils/plotting/__tests__/workers.spec.d.ts +18 -0
  29. package/dist/utils/plotting/add-data.worker.d.ts +1 -0
  30. package/dist/utils/plotting/calibration.d.ts +99 -0
  31. package/dist/utils/plotting/change-values.worker.d.ts +1 -0
  32. package/dist/utils/plotting/change.worker.d.ts +1 -0
  33. package/dist/utils/plotting/delete-data.worker.d.ts +1 -0
  34. package/dist/utils/plotting/drift-correction.worker.d.ts +1 -0
  35. package/dist/utils/plotting/fill-gaps.worker.d.ts +1 -0
  36. package/dist/utils/plotting/find-gaps.worker.d.ts +1 -0
  37. package/dist/utils/plotting/interpolate.worker.d.ts +1 -0
  38. package/dist/utils/plotting/observation-record.d.ts +281 -0
  39. package/dist/utils/plotting/operation-cores.d.ts +139 -0
  40. package/dist/utils/plotting/persistence.worker.d.ts +1 -0
  41. package/dist/utils/plotting/rate-of-change.worker.d.ts +1 -0
  42. package/dist/utils/plotting/shift-datetimes.worker.d.ts +1 -0
  43. package/dist/utils/plotting/value-threshold.worker.d.ts +1 -0
  44. package/package.json +61 -56
  45. package/dist/types.d.ts +0 -51
  46. package/dist/utils/ellapsedTime.d.ts +0 -0
  47. package/dist/utils/observationsUtils.d.ts +0 -0
  48. package/dist/utils/plotting/observationRecord.d.ts +0 -170
  49. /package/dist/{utils/__tests__/ellapsedTime.spec.d.ts → services/__tests__/createPatchObject.spec.d.ts} +0 -0
  50. /package/dist/{utils/__tests__/observationsUtils.spec.d.ts → services/__tests__/requestInterceptor.spec.d.ts} +0 -0
  51. /package/dist/{utils/plotting/__tests__/delete-data.worker.spec.d.ts → services/__tests__/responseInterceptor.spec.d.ts} +0 -0
  52. /package/dist/utils/{plotting/__tests__/observationRecord.spec.d.ts → __tests__/ellapsed-time.spec.d.ts} +0 -0
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Pure, framework-free primitive kernels for each QC operation whose
3
+ * worker has a one-to-one inline equivalent. Shared by both the
4
+ * `?worker&inline` Vite workers and `ObservationRecord`'s non-worker
5
+ * fast paths so there's a single source of truth for each algorithm —
6
+ * if the worker's hot loop drifts from the main-thread loop we get
7
+ * silently wrong selections, which the calibration feature would make
8
+ * far easier to trigger.
9
+ *
10
+ * Keep these functions:
11
+ * - allocation-frugal (no unnecessary intermediate arrays),
12
+ * - free of module-level `self` / `postMessage` references (callable
13
+ * in either context),
14
+ * - deterministic given identical inputs (so worker output can be
15
+ * diffed against inline output when debugging drift).
16
+ */
17
+ /** Opcode encoding used by `valueThresholdCore` (matches the worker). */
18
+ export declare const enum ThresholdOp {
19
+ LT = 0,
20
+ LTE = 1,
21
+ GT = 2,
22
+ GTE = 3,
23
+ E = 4
24
+ }
25
+ /**
26
+ * Scan `[start, end)` of `arrayY` and collect every index where the
27
+ * value matches ANY of the supplied comparator/threshold pairs. Short-
28
+ * circuits on first match per element (matches worker semantics).
29
+ */
30
+ export declare function valueThresholdCore(arrayY: Float32Array | Float32Array<SharedArrayBuffer>, start: number, end: number, ops: number[], values: number[]): number[];
31
+ /**
32
+ * First-difference filter: collect indexes in `[start, end)` where
33
+ * `Y[i] - Y[i-1]` satisfies the comparator. Comparator strings match
34
+ * the worker exactly (FilterOperation enum values).
35
+ */
36
+ export declare function changeCore(arrayY: Float32Array | Float32Array<SharedArrayBuffer>, start: number, end: number, comparator: string, value: number): number[];
37
+ /**
38
+ * Relative rate-of-change: `(Y[i] - Y[i-1]) / |Y[i-1]|`. Same
39
+ * comparator semantics as `changeCore`.
40
+ */
41
+ export declare function rateOfChangeCore(arrayY: Float32Array | Float32Array<SharedArrayBuffer>, start: number, end: number, comparator: string, value: number): number[];
42
+ /**
43
+ * Detect datetime gaps: returns a flat `[leftIdx, rightIdx, ...]`
44
+ * list for every pair whose datetime delta exceeds `threshold` ms.
45
+ * Scan covers `[start, endInclusive]`.
46
+ */
47
+ export declare function findGapsCore(arrayX: Float64Array | Float64Array<SharedArrayBuffer>, start: number, endInclusive: number, threshold: number): number[];
48
+ /**
49
+ * Emit maximal runs of equal Y values in `[start, end)` as flat
50
+ * `[startIndex, length, value, ...]` triplets. Downstream stitches
51
+ * adjacent chunk triplets before applying the min-run-length filter.
52
+ */
53
+ export declare function persistenceCore(arrayY: Float32Array | Float32Array<SharedArrayBuffer>, start: number, end: number): number[];
54
+ /**
55
+ * Copy `[start, end]` of `sourceX` / `sourceY` into `outX` / `outY`
56
+ * starting at `outStart`, inserting synthesized fill points after each
57
+ * gap whose left index falls in the read range. `gaps` is a list of
58
+ * `[leftIdx, rightIdx]` pairs, sorted by left index. `fillDelta` is
59
+ * the spacing between inserted points in the same unit as `sourceX`.
60
+ * When `interpolate` is true the filled Y values are linearly
61
+ * interpolated between the gap's endpoints; otherwise `fillValue` is
62
+ * written (used for "sentinel" -9999 fills).
63
+ *
64
+ * Shared by the `FillGapsWorker`'s per-segment write and the inline
65
+ * full-array path. Returns the number of elements written so callers
66
+ * can double-check contiguity against their pre-computed fill totals.
67
+ */
68
+ export declare function fillGapsCore(sourceX: Float64Array | Float64Array<SharedArrayBuffer>, sourceY: Float32Array | Float32Array<SharedArrayBuffer>, gaps: ReadonlyArray<[number, number]>, outX: Float64Array | Float64Array<SharedArrayBuffer>, outY: Float32Array | Float32Array<SharedArrayBuffer>, start: number, end: number, outStart: number, fillDelta: number, interpolate: boolean, fillValue: number): number;
69
+ /**
70
+ * Merge a slice `[origStart, origEnd)` of `sourceX` / `sourceY` with
71
+ * a pre-sorted list of `(x, y)` insertions into `outX` / `outY`
72
+ * starting at `outStart`. Originals win on datetime ties so the
73
+ * merged order matches `findLastLessOrEqual` semantics (insertion
74
+ * lands after equal-valued originals). Writes in order; caller is
75
+ * responsible for pre-allocating output buffers sized to
76
+ * `origEnd - origStart + insertions.length`.
77
+ *
78
+ * Shared by the `AddDataWorker`'s segment merge and the inline
79
+ * full-array path. Returns the number of elements written so callers
80
+ * can double-check contiguity.
81
+ */
82
+ export declare function addDataPointsCore(sourceX: Float64Array | Float64Array<SharedArrayBuffer>, sourceY: Float32Array | Float32Array<SharedArrayBuffer>, insertions: ReadonlyArray<[number, number]>, outX: Float64Array | Float64Array<SharedArrayBuffer>, outY: Float32Array | Float32Array<SharedArrayBuffer>, origStart: number, origEnd: number, outStart: number): number;
83
+ /**
84
+ * Copy `[readStart, readEnd]` of `sourceX` / `sourceY` into
85
+ * `outX` / `outY` starting at `outStart`, skipping any index that
86
+ * appears in `deleteIndices` (which must be sorted ascending and
87
+ * bounded to the read range). Shared by the worker's per-segment
88
+ * write path and the inline full-array path. Returns the number of
89
+ * elements written so callers can double-check contiguity.
90
+ */
91
+ export declare function deleteDataPointsCore(sourceX: Float64Array | Float64Array<SharedArrayBuffer>, sourceY: Float32Array | Float32Array<SharedArrayBuffer>, deleteIndices: ArrayLike<number>, outX: Float64Array | Float64Array<SharedArrayBuffer>, outY: Float32Array | Float32Array<SharedArrayBuffer>, readStart: number, readEnd: number, outStart: number): number;
92
+ /** Params for `shiftDatetimesCollection`; mirrors the worker payload. */
93
+ export interface ShiftDatetimesParams {
94
+ amount: number;
95
+ isMonth: boolean;
96
+ isYear: boolean;
97
+ /** Precomputed scalar ms offset; unused when `isMonth || isYear`. */
98
+ deltaMs: number;
99
+ }
100
+ /**
101
+ * Compute shifted `(x, y)` pairs for each index in `indexes` without
102
+ * allocating a `SharedArrayBuffer`. Mirrors the shift worker's branches
103
+ * for month / year / scalar units. Returned in the same order as
104
+ * `indexes` so the caller can hand the collection straight to
105
+ * `_addDataPoints` after a `_deleteDataPoints(indexes)`.
106
+ */
107
+ export declare function shiftDatetimesCollection(arrayX: Float64Array | Float64Array<SharedArrayBuffer>, arrayY: Float32Array | Float32Array<SharedArrayBuffer>, indexes: ArrayLike<number>, params: ShiftDatetimesParams): [number, number][];
108
+ /** Prepared group shape shared by `_interpolate` and its worker. */
109
+ export interface InterpolateGroup {
110
+ indexes: number[];
111
+ lowerIdx: number;
112
+ upperIdx: number;
113
+ }
114
+ /**
115
+ * Linear-interpolate Y-values at each group's `indexes` between the
116
+ * anchor points at `lowerIdx` / `upperIdx`. Writes in place. Matches
117
+ * the worker's degenerate-span semantics: if `lowerIdx === upperIdx`
118
+ * (group sits at a buffer edge with no valid anchor on one side) we
119
+ * paste the lone anchor value for every point in the group.
120
+ */
121
+ export declare function interpolateCore(arrayX: Float64Array | Float64Array<SharedArrayBuffer>, arrayY: Float32Array | Float32Array<SharedArrayBuffer>, groups: InterpolateGroup[]): void;
122
+ /**
123
+ * Apply linear drift correction over one or more `[start, end, value]`
124
+ * ranges in place on `arrayY`, using `arrayX` only to compute each
125
+ * range's time anchors. Per-point formula:
126
+ *
127
+ * y_i += value * (x_i - startDatetime) / extent
128
+ *
129
+ * where `startDatetime = x[start]` and `extent = x[end] - x[start]`.
130
+ * Ranges with non-positive extent are skipped to match the worker's
131
+ * behaviour. The whole operation is O(total range length) — no
132
+ * chunking or spawning, suitable for the inline calibration path.
133
+ */
134
+ export declare function driftCorrectionCore(arrayX: Float64Array | Float64Array<SharedArrayBuffer>, arrayY: Float32Array | Float32Array<SharedArrayBuffer>, ranges: [number, number, number][]): void;
135
+ /**
136
+ * Apply an arithmetic operator to `arrayY` at each index in
137
+ * `indexes`. Operator strings match `Operator` enum values.
138
+ */
139
+ export declare function changeValuesCore(arrayY: Float32Array | Float32Array<SharedArrayBuffer>, indexes: ArrayLike<number>, operator: string, value: number): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,57 +1,62 @@
1
- {
2
- "name": "@uwrl/qc-utils",
3
- "version": "0.0.15",
4
- "description": "Quality Control Utilities",
5
- "homepage": "https://github.com/hydroserver2/qc-utils#readme",
6
- "bugs": {
7
- "url": "https://github.com/hydroserver2/qc-utils/issues"
8
- },
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/hydroserver2/qc-utils.git"
12
- },
13
- "license": "ISC",
14
- "author": "Maurier Ramirez",
15
- "main": "./dist/index.cjs",
16
- "module": "./dist/index.js",
17
- "exports": {
18
- ".": {
19
- "require": "./dist/index.cjs",
20
- "import": "./dist/index.js"
21
- }
22
- },
23
- "types": "./dist/types.d.ts",
24
- "files": [
25
- "dist"
26
- ],
27
- "type": "module",
28
- "scripts": {
29
- "build": "npm run clean:dist && vite build --mode prod && vue-tsc --declaration --emitDeclarationOnly",
30
- "pub": "npm publish --access public",
31
- "clean:dist": "rimraf dist",
32
- "clean:coverage": "rimraf coverage",
33
- "preview": "vite preview",
34
- "lint": "eslint .",
35
- "lint:fix": "eslint . --fix",
36
- "test": "npm run clean:coverage",
37
- "up": "taze major -I",
38
- "link": "npm link"
39
- },
40
- "dependencies": {
41
- "rxjs": "^7.8.2",
42
- "vite": "^7.0.4"
43
- },
44
- "devDependencies": {
45
- "@types/node": "^24.0.14",
46
- "eslint": "^9.27.0",
47
- "eslint-plugin-cypress": "^5.0.0",
48
- "eslint-plugin-prettier": "^5.4.1",
49
- "rimraf": "^6.0.1",
50
- "rollup-plugin-visualizer": "^6.0.3",
51
- "stylelint": "^16.20.0",
52
- "taze": "^19.1.0",
53
- "typescript": "latest",
54
- "vitest": "^3.2.4",
55
- "vue-tsc": "^3.0.5"
56
- }
1
+ {
2
+ "name": "@uwrl/qc-utils",
3
+ "version": "0.0.18",
4
+ "description": "Quality Control Utilities",
5
+ "homepage": "https://github.com/hydroserver2/qc-utils#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/hydroserver2/qc-utils/issues"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/hydroserver2/qc-utils.git"
12
+ },
13
+ "license": "ISC",
14
+ "author": "Maurier Ramirez",
15
+ "main": "./dist/index.cjs",
16
+ "module": "./dist/index.js",
17
+ "exports": {
18
+ ".": {
19
+ "require": "./dist/index.cjs",
20
+ "import": "./dist/index.js"
21
+ }
22
+ },
23
+ "types": "./dist/types.d.ts",
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "type": "module",
28
+ "scripts": {
29
+ "build": "npm run clean:dist && vite build --mode prod && vue-tsc --declaration --emitDeclarationOnly",
30
+ "pub": "npm publish --access public",
31
+ "clean:dist": "rimraf dist",
32
+ "clean:coverage": "rimraf coverage",
33
+ "preview": "vite preview",
34
+ "lint": "eslint .",
35
+ "lint:fix": "eslint . --fix",
36
+ "test": "vitest run",
37
+ "coverage": "vitest run --coverage",
38
+ "up": "taze major -I",
39
+ "link": "npm link",
40
+ "dev": "vite build --watch --mode prod"
41
+ },
42
+ "dependencies": {
43
+ "rxjs": "^7.8.2",
44
+ "vite": "^8.0.0"
45
+ },
46
+ "devDependencies": {
47
+ "@eslint/js": "^10.0.1",
48
+ "@types/node": "^25.0.0",
49
+ "eslint": "^10.0.0",
50
+ "eslint-plugin-cypress": "^6.0.0",
51
+ "eslint-plugin-prettier": "^5.4.1",
52
+ "happy-dom": "^20.9.0",
53
+ "rimraf": "^6.0.1",
54
+ "rollup-plugin-visualizer": "^7.0.0",
55
+ "stylelint": "^17.0.0",
56
+ "taze": "^19.1.0",
57
+ "typescript": "latest",
58
+ "typescript-eslint": "^8.58.2",
59
+ "vitest": "^4.0.1",
60
+ "vue-tsc": "^3.0.5"
61
+ }
57
62
  }
package/dist/types.d.ts DELETED
@@ -1,51 +0,0 @@
1
- export declare enum EnumEditOperations {
2
- ADD_POINTS = "ADD_POINTS",
3
- CHANGE_VALUES = "CHANGE_VALUES",
4
- DELETE_POINTS = "DELETE_POINTS",
5
- DRIFT_CORRECTION = "DRIFT_CORRECTION",
6
- INTERPOLATE = "INTERPOLATE",
7
- SHIFT_DATETIMES = "SHIFT_DATETIMES",
8
- FILL_GAPS = "FILL_GAPS"
9
- }
10
- export declare enum EnumFilterOperations {
11
- FIND_GAPS = "FIND_GAPS",
12
- PERSISTENCE = "PERSISTENCE",
13
- RATE_OF_CHANGE = "RATE_OF_CHANGE",
14
- VALUE_THRESHOLD = "VALUE_THRESHOLD"
15
- }
16
- export type HistoryItem = {
17
- method: EnumEditOperations;
18
- icon: string;
19
- isLoading: boolean;
20
- args?: any[];
21
- duration?: number;
22
- status?: 'success' | 'failed';
23
- };
24
- export type EnumDictionary<T extends string | symbol | number, U> = {
25
- [K in T]: U;
26
- };
27
- export declare enum FilterOperation {
28
- LT = "Less than",
29
- LTE = "Less than or equal to",
30
- GT = "Greater than",
31
- GTE = "Greater than or equal to",
32
- E = "Equal",
33
- START = "Start datetime",
34
- END = "End datetime"
35
- }
36
- export declare const FilterOperationFn: EnumDictionary<FilterOperation, (value: number, toCompare: number) => boolean>;
37
- export declare enum Operator {
38
- ADD = "ADD",
39
- SUB = "SUB",
40
- MULT = "MULT",
41
- DIV = "DIV",
42
- ASSIGN = "ASSIGN"
43
- }
44
- export declare enum RateOfChangeOperation {
45
- LT = "Less than",
46
- LTE = "Less than or equal to",
47
- GT = "Greater than",
48
- GTE = "Greater than or equal to",
49
- E = "Equal"
50
- }
51
- export declare const RateOfChangeComparator: EnumDictionary<RateOfChangeOperation, (value: number, toCompare: number) => boolean>;
File without changes
File without changes
@@ -1,170 +0,0 @@
1
- import { EnumDictionary, EnumEditOperations, EnumFilterOperations, HistoryItem } from '../../types';
2
- export declare function subtractHours(timestamp: string, hours: number): string;
3
- /** Returns the index of the first value that is greater or equal to the target value */
4
- export declare const findFirstGreaterOrEqual: (array: number[] | Float64Array<SharedArrayBuffer>, target: number) => number;
5
- /** Returns the index of the last value that is lesser or equal to the target value */
6
- export declare const findLastLessOrEqual: (array: number[] | Float64Array<SharedArrayBuffer>, target: number) => number;
7
- export declare const measureEllapsedTime: (fn: () => any, message?: string) => Promise<{
8
- response: any;
9
- duration: number;
10
- }>;
11
- export declare enum TimeUnit {
12
- SECOND = "s",
13
- MINUTE = "m",
14
- HOUR = "h",
15
- DAY = "D",
16
- WEEK = "W",
17
- MONTH = "M",
18
- YEAR = "Y"
19
- }
20
- export declare const timeUnitMultipliers: EnumDictionary<TimeUnit, number>;
21
- export declare const formatDate: (date: Date) => string;
22
- export declare const formatDuration: (duration: number) => string;
23
- export declare const shiftDatetime: (datetime: number, amount: number, unit: TimeUnit) => number;
24
- /**
25
- * This number should approximate the number of observations that a dataset could increase by during a session.
26
- * The lower this number, the less memory the entire app uses.
27
- * Note that when a dataset number of data points increases by more than `INCREASE_AMOUNT`,
28
- * the `_growBuffer()` method will allocate a new buffer, and the data will be copied into it.
29
- */
30
- export declare const INCREASE_AMOUNT: number;
31
- export declare class ObservationRecord {
32
- /** The generated dataset to be used for plotting */
33
- dataset: {
34
- dimensions: string[];
35
- source: {
36
- x: Float64Array<SharedArrayBuffer>;
37
- y: Float32Array<SharedArrayBuffer>;
38
- };
39
- };
40
- history: HistoryItem[];
41
- loadingTime: number | null;
42
- isLoading: boolean;
43
- rawData: {
44
- datetimes: Float64Array<ArrayBuffer> | number[];
45
- dataValues: Float32Array<ArrayBuffer> | number[];
46
- };
47
- constructor(dataArrays: {
48
- datetimes: Float64Array<ArrayBuffer> | number[];
49
- dataValues: Float32Array<ArrayBuffer> | number[];
50
- });
51
- loadData(dataArrays: {
52
- datetimes: Float64Array<ArrayBuffer> | number[];
53
- dataValues: Float32Array<ArrayBuffer> | number[];
54
- }): Promise<void>;
55
- get dataX(): Float64Array<SharedArrayBuffer>;
56
- get dataY(): Float32Array<SharedArrayBuffer>;
57
- /**
58
- * Resizes the typed array
59
- * @param length The total number of elements that the view will contain
60
- */
61
- private _resizeTo;
62
- /**
63
- * Buffer size is always in increments of `INCREASE_AMOUNT`.
64
- * Grows the buffer by `INCREASE_AMOUNT` in bytes if the current data doesn't fit
65
- * @param newLength The total number of elements that the view will contain
66
- */
67
- private _growBuffer;
68
- /**
69
- * Reloads the dataset with the raw data
70
- */
71
- reload(): Promise<void>;
72
- /**
73
- * @param index
74
- * @returns
75
- */
76
- reloadHistory(index: number): Promise<void>;
77
- /**
78
- * Remove a history item
79
- * @param index
80
- */
81
- removeHistoryItem(index: number): Promise<void>;
82
- get beginTime(): Date | null;
83
- get endTime(): Date | null;
84
- /** Dispatch an operation and log its signature in hisotry */
85
- dispatch(action: EnumEditOperations | [EnumEditOperations, ...any][], ...args: any): Promise<any[]>;
86
- /** Filter operations do not transform the data and are not logged in history */
87
- dispatchFilter(action: EnumFilterOperations | [EnumFilterOperations, ...any][], ...args: any): Promise<any>;
88
- /**
89
- * @param index An array containing the list of index of values to perform the operations on.
90
- * @param operator The operator that will be applied
91
- * @param value The value to use in the operation
92
- * @returns The modified DataFrame
93
- */
94
- private _changeValues;
95
- private _interpolate;
96
- /** Interpolate existing values in the data source */
97
- private _interpolateLinear;
98
- /**
99
- * Shifts the selected indexes by specified amount of units. Elements are reinserted according to their datetime.
100
- * @param index The index of the elements to shift
101
- * @param amount Number of {@link TimeUnit}
102
- * @param unit {@link TimeUnit}
103
- * @returns
104
- */
105
- private _shift;
106
- private _fillGapsV2;
107
- /**
108
- * Find gaps and fill them with placeholder value
109
- * @param gap Intervals to detect as gaps
110
- * @param fill Interval used to fill the detected gaps
111
- * @param interpolateValues If true, the new values will be linearly interpolated
112
- * @returns
113
- */
114
- private _fillGaps;
115
- /**
116
- Deletes data points from a large array using worker threads.
117
- 1. The main thread divides the original array into equal parts to distribute work among workers.
118
- 2. For each segment, binary search locates the indexes to delete (deleteSegment), ensuring efficient lookups.
119
- 3. The cumulative deletions before each segment help compute the starting index (startTarget) for each worker's output, ensuring no overlap.
120
- 4. Each worker processes its segment linearly, skipping deletions and copying kept elements to their computed positions.
121
- * @param deleteIndices
122
- */
123
- private _deleteDataPoints;
124
- /**
125
- *
126
- * @param start The start index
127
- * @param end The end index
128
- * @param value The drift amount
129
- */
130
- private _driftCorrection;
131
- /** Traverses the index array and returns groups of consecutive values.
132
- * i.e.: `[0, 1, 3, 4, 6] => [[0, 1], [3, 4], [6]]`
133
- * Assumes the input array is sorted.
134
- * @param index: the index array (sorted)
135
- */
136
- private _getConsecutiveGroups;
137
- /**
138
- * Adds data points. Their insert index is determined using `findFirstGreaterOrEqual` in the x-axis.
139
- * @param dataPoints
140
- */
141
- private _addDataPoints;
142
- /**
143
- * Filter by applying a set of logical operations
144
- * @param appliedFilters
145
- * @returns
146
- */
147
- private _valueThreshold;
148
- /**
149
- *
150
- * @param comparator
151
- * @param value
152
- * @returns
153
- */
154
- private _rateOfChange;
155
- /**
156
- * Find gaps in the data
157
- * @param value The time value
158
- * @param unit The time unit (TimeUnit)
159
- * @param range If specified, the gaps will be found only within the range
160
- * @returns
161
- */
162
- private _findGaps;
163
- /**
164
- * Find points where the values are the same at least x times in a row
165
- * @param times The number of times in a row that points can be equal
166
- * @param range If specified, the points will be found only within the range
167
- * @returns
168
- */
169
- private _persistence;
170
- }