Replace kepler.gl dataset with table class
export type KeplerDataset = {
id: string;
label?: string;
color: RGBColor;
// fields and data
fields: KeplerField[];
dataContainer: DataContainer;
allIndexes: number[];
filteredIndex: number[];
filteredIdxCPU: number[];
filteredIndexForDomain: number[];
fieldPairs: {
defaultName: string;
pair: any;
suffix: string[];
}[];
gpuFilter: {
filterRange: number[][];
filterValueUpdateTriggers: any;
filterValueAccessor: any;
};
filterRecord: FilterRecord;
filterRecordCPU: FilterRecord;
changedFilters: any;
// table-injected metadata
sortColumn?: {
// column name: sorted idx
[key: string]: number[];
};
sortOrder?: string; // ASCENDING | DESCENDING | UNSORT
pinnedColumns?: string[];
// table-injected metadata
metadata?: object;
};
export type KeplerField = {
analyzerType: string;
id: string;
name: string;
format: string;
fieldIdx: number;
type: string;
// meta data, storing domain and mappedValues
filterProps?: any;
};Missing features
- Copy over column meta, if replacing an existing column
- Recompute fieldPairs
initialize
to replace utils/dataset-utils createNewDataEntry This table method takes a ProtoTable and returns a Table to be saved in kepler state.
table.initialize(protoTable);
// following meta data should be initialized
table.allIndexes,
table.filteredIndex,
table.filteredIndexForDomain,
table.fieldPairs,
table.gpuFilter;-
getValue(columnName, rowIdx)Get the value of a cell Should be a curried function getValue(columName) = idx => value -
getColumnDomain(columnName)to replacefilter-utils.jsgetFieldDomainGet the value domain of a specific column used in filter -
getColumnScaleDomain(columnName, scaleType)to replacebase-layer.jslayer.calculateLayerDomainGet the domain of this column based on scale type -
getSampleData(rows)Get a sample of rows to calculate layer boundaries -
parseFieldValue(value, type) => stringParse cell value based on column type and return a string representation Value the field value, type the field type -
sortDatasetByColumnSort a column, return a sorted index, assign tosortColumn,sortOrder -
filterDataset(filters, layers, opt)to replacefilter-utils.jsfilterDatasetApply filters to dataset, return the filtered dataset with updatedgpuFilter,filterRecord,filteredIndex,filteredIndexForDomain -
filterDatasetCPU(filters)to replacefilter-utils.jsfilterDatasetCPUApply filters to a dataset all on CPU, assign tofilteredIdxCPU,filterRecordCPU