@phenyxhealth/data-analytics 0.1.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.
Files changed (37) hide show
  1. package/dist/components/Chart2DSubplot.d.ts +12 -0
  2. package/dist/components/Chart3DScatter.d.ts +12 -0
  3. package/dist/components/Chart3DSubplot.d.ts +12 -0
  4. package/dist/components/Chart3DSurface.d.ts +10 -0
  5. package/dist/components/ChartBar.d.ts +8 -0
  6. package/dist/components/ChartBoxPlot.d.ts +9 -0
  7. package/dist/components/ChartHeatMap.d.ts +8 -0
  8. package/dist/components/ChartHistogram.d.ts +7 -0
  9. package/dist/components/ChartLine.d.ts +8 -0
  10. package/dist/components/ChartMultiBar.d.ts +7 -0
  11. package/dist/components/ChartParallelCoords.d.ts +10 -0
  12. package/dist/components/ChartPie.d.ts +7 -0
  13. package/dist/components/ChartScatter.d.ts +10 -0
  14. package/dist/components/ChartScatterPlotly.d.ts +11 -0
  15. package/dist/components/ChartSunburst.d.ts +10 -0
  16. package/dist/components/ChartTable.d.ts +7 -0
  17. package/dist/components/ChartViolin.d.ts +11 -0
  18. package/dist/components/Chip.d.ts +6 -0
  19. package/dist/components/DataExplorer.d.ts +2 -0
  20. package/dist/components/DimensionStudio.d.ts +10 -0
  21. package/dist/components/RadioButtonGroup.d.ts +14 -0
  22. package/dist/components/SearchableSelect.d.ts +19 -0
  23. package/dist/components/ViewBuilder.d.ts +10 -0
  24. package/dist/components/ViewCard.d.ts +11 -0
  25. package/dist/data-analytics.css +1 -0
  26. package/dist/index-CGKlljJK.js +1 -0
  27. package/dist/index-DWXFNxcN.cjs +1 -0
  28. package/dist/index.cjs.js +1 -0
  29. package/dist/index.d.ts +19 -0
  30. package/dist/index.es.js +1 -0
  31. package/dist/plotly.min-DYqaAskA.js +108905 -0
  32. package/dist/plotly.min-wrSXr6b4.cjs +3789 -0
  33. package/dist/types/index.d.ts +53 -0
  34. package/dist/utils/data.d.ts +63 -0
  35. package/dist/utils/plotly.d.ts +8 -0
  36. package/dist/vite.svg +1 -0
  37. package/package.json +57 -0
@@ -0,0 +1,53 @@
1
+ export type SemanticType = 'temporal' | 'nominal' | 'quantitative' | 'ordinal';
2
+ export type AnalyticType = 'dimension' | 'measure';
3
+ export interface DimensionDefinition {
4
+ fid: string;
5
+ semanticType: SemanticType;
6
+ analyticType: AnalyticType;
7
+ label?: string;
8
+ }
9
+ export type ChartType = 'bar' | 'pie' | 'line' | 'table' | 'multibar' | 'sunburst' | 'boxplot' | 'heatmap' | 'scatter' | 'scatter2' | 'histogram' | 'violin' | 'scatter3d' | 'surface3d' | 'subplot3d' | 'subplot2d' | 'parallelcoords';
10
+ export type ViewSize = 'small' | 'standard' | 'full';
11
+ export interface ViewConfig {
12
+ id: string;
13
+ name: string;
14
+ chartType: ChartType;
15
+ groupBy: string;
16
+ metric: 'count' | string;
17
+ colorBy?: string;
18
+ groupByMulti?: string[];
19
+ numericField?: string;
20
+ zField?: string;
21
+ subplotChartType?: ChartType;
22
+ subplotGroupBy?: string;
23
+ filters: FilterConfig[];
24
+ size?: ViewSize;
25
+ }
26
+ export interface FilterConfig {
27
+ field: string;
28
+ values: string[];
29
+ }
30
+ export type DataRecord = Record<string, string | number | boolean | null | undefined>;
31
+ export type Theme = 'light' | 'dark';
32
+ export type DiffUnit = 'days' | 'weeks' | 'months' | 'years';
33
+ export interface DerivedDimension {
34
+ id: string;
35
+ name: string;
36
+ type: 'timeDiff';
37
+ fieldA: string;
38
+ fieldB: string;
39
+ unit: DiffUnit;
40
+ }
41
+ export interface Dashboard {
42
+ id: string;
43
+ name: string;
44
+ views: ViewConfig[];
45
+ }
46
+ export interface DataExplorerProps {
47
+ data: DataRecord[];
48
+ dimensions: DimensionDefinition[];
49
+ title?: string;
50
+ defaultViews?: ViewConfig[];
51
+ defaultDashboards?: Dashboard[];
52
+ theme?: Theme;
53
+ }
@@ -0,0 +1,63 @@
1
+ import { DataRecord, FilterConfig, DerivedDimension, DimensionDefinition } from '../types/index.ts';
2
+ export declare function getUniqueValues(data: DataRecord[], field: string): string[];
3
+ export declare function applyFilters(data: DataRecord[], filters: FilterConfig[]): DataRecord[];
4
+ export declare function groupAndCount(data: DataRecord[], groupBy: string, colorBy?: string): {
5
+ name: string;
6
+ count: number;
7
+ [key: string]: string | number;
8
+ }[];
9
+ export declare function getColorKeys(data: DataRecord[], colorBy: string): string[];
10
+ export declare function groupAndCountMulti(data: DataRecord[], fields: string[], fieldLabels?: Record<string, string>): {
11
+ name: string;
12
+ _field: string;
13
+ [key: string]: string | number;
14
+ }[];
15
+ export declare function computeHeatMap(data: DataRecord[], xField: string, yField: string): {
16
+ entries: {
17
+ x: string;
18
+ y: string;
19
+ count: number;
20
+ }[];
21
+ xValues: string[];
22
+ yValues: string[];
23
+ maxCount: number;
24
+ };
25
+ export interface BoxPlotEntry {
26
+ name: string;
27
+ min: number;
28
+ q1: number;
29
+ median: number;
30
+ q3: number;
31
+ max: number;
32
+ count: number;
33
+ colorIndex: number;
34
+ }
35
+ export declare function computeBoxPlotStats(data: DataRecord[], numericField: string, groupBy: string, groupBy2?: string): BoxPlotEntry[];
36
+ export interface HistogramBin {
37
+ x0: number;
38
+ x1: number;
39
+ count: number;
40
+ label: string;
41
+ }
42
+ export declare function computeHistogramBins(data: DataRecord[], numericField: string, binCount?: number): {
43
+ bins: HistogramBin[];
44
+ min: number;
45
+ max: number;
46
+ };
47
+ export interface ViolinEntry {
48
+ name: string;
49
+ points: {
50
+ x: number;
51
+ density: number;
52
+ }[];
53
+ min: number;
54
+ q1: number;
55
+ median: number;
56
+ q3: number;
57
+ max: number;
58
+ colorIndex: number;
59
+ }
60
+ export declare function computeViolinStats(data: DataRecord[], numericField: string, groupBy: string, resolution?: number): ViolinEntry[];
61
+ export declare function getColor(index: number): string;
62
+ export declare function applyDerivedDimensions(data: DataRecord[], derived: DerivedDimension[]): DataRecord[];
63
+ export declare function derivedToDimensionDef(d: DerivedDimension): DimensionDefinition;
@@ -0,0 +1,8 @@
1
+ /** Colores resueltos para layouts de Plotly según el tema activo. */
2
+ export declare function getPlotlyTheme(isDark: boolean): {
3
+ fontColor: string;
4
+ gridColor: string;
5
+ zeroColor: string;
6
+ textMuted: string;
7
+ tooltipBg: string;
8
+ };
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@phenyxhealth/data-analytics",
3
+ "private": false,
4
+ "version": "0.1.1",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "main": "dist/index.cjs.js",
10
+ "module": "dist/index.es.js",
11
+ "types": "dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.es.js",
16
+ "require": "./dist/index.cjs.js"
17
+ },
18
+ "./style.css": "./dist/data-analytics.css"
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "scripts": {
24
+ "dev": "vite",
25
+ "build": "tsc -b && vite build",
26
+ "build:lib": "tsc -b && vite build --mode lib && node scripts/obfuscate.mjs",
27
+ "lint": "eslint .",
28
+ "preview": "vite preview"
29
+ },
30
+ "peerDependencies": {
31
+ "react": "^18.0.0 || ^19.0.0",
32
+ "react-dom": "^18.0.0 || ^19.0.0"
33
+ },
34
+ "dependencies": {
35
+ "@types/plotly.js": "^3.0.10",
36
+ "plotly.js-dist-min": "^3.4.0",
37
+ "recharts": "^3.8.0"
38
+ },
39
+ "devDependencies": {
40
+ "@eslint/js": "^9.39.1",
41
+ "@types/node": "^24.10.1",
42
+ "@types/react": "^19.2.7",
43
+ "@types/react-dom": "^19.2.3",
44
+ "@vitejs/plugin-react": "^5.1.1",
45
+ "eslint": "^9.39.1",
46
+ "eslint-plugin-react-hooks": "^7.0.1",
47
+ "eslint-plugin-react-refresh": "^0.4.24",
48
+ "globals": "^16.5.0",
49
+ "javascript-obfuscator": "^5.4.1",
50
+ "react": "^19.2.0",
51
+ "react-dom": "^19.2.0",
52
+ "typescript": "~5.9.3",
53
+ "typescript-eslint": "^8.48.0",
54
+ "vite": "^7.3.1",
55
+ "vite-plugin-dts": "^4.5.4"
56
+ }
57
+ }