@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
61 lines (60 loc) • 5.58 kB
TypeScript
import { DashboardDataResponse } from '../../types/Metrics';
import { components } from '../../types/api';
/**
* Creates the dataset for a single visualisation
* - given the visualisation definition will extract the relevant
* - rows from the master dataset to produce a visualisation dataset
*
* @param {components['schemas']['DashboardVisualisationDefinition']} visDefinition
* @param {DashboardDataResponse[]} dashboardData
* @return {DashboardDataResponse[]} the visualisation dataset
*/
export declare const getDatasetRows: (visDefinition: components["schemas"]["DashboardVisualisationDefinition"], dashboardData: DashboardDataResponse[]) => DashboardDataResponse[];
export declare const getLastestDataset: (dashboardData: DashboardDataResponse[], dateMeasure?: components["schemas"]["DashboardVisualisationColumnDefinition"]) => DashboardDataResponse[];
export declare const getEarliestDataset: (dashboardData: DashboardDataResponse[], dateMeasure?: components["schemas"]["DashboardVisualisationColumnDefinition"]) => DashboardDataResponse[];
export declare const groupRowsByTimestamp: (dashboardData: DashboardDataResponse[], dateMeasure: components["schemas"]["DashboardVisualisationColumnDefinition"]) => DashboardDataResponse[][];
export declare const groupRowsByKey: (dashboardData: DashboardDataResponse[], key: string) => DashboardDataResponse[][];
export declare const groupRowsBy: (dashboardData: DashboardDataResponse[], groupIds: string[]) => DashboardDataResponse[][];
export declare const getGroupKey: (rawData: DashboardDataResponse[], keys?: Array<components["schemas"]["DashboardVisualisationColumnDefinition"]>) => {
id: string;
display?: string | null;
aggregate?: "sum" | "average" | null;
unit?: "NUMBER" | "PERCENTAGE" | null;
displayValue?: boolean | null;
axis?: string | null;
optional?: boolean | null;
type?: "boolean" | "date" | "double" | "HTML" | "long" | "string" | "time" | "timestamp" | null;
} | undefined;
export declare const filterRowsByDisplayColumns: (listDefinition: components["schemas"]["DashboardVisualisationDefinition"], dashboardData: DashboardDataResponse[], includeKeys?: boolean) => DashboardDataResponse[];
export type GetDateValueResponse = {
measure: components['schemas']['DashboardVisualisationColumnDefinition'];
value: string;
};
export declare const getDateValue: (dashboardData?: DashboardDataResponse[] | undefined, dateColumn?: components["schemas"]["DashboardVisualisationColumnDefinition"] | undefined) => GetDateValueResponse | undefined;
export declare const getTimestampColumn: (columns: components["schemas"]["DashboardVisualisationColumnsDefinition"]) => components["schemas"]["DashboardVisualisationColumnDefinition"] | undefined;
export declare const getTimestampMeasure: (measures: components["schemas"]["DashboardVisualisationColumnDefinition"][]) => components["schemas"]["DashboardVisualisationColumnDefinition"] | undefined;
export declare const getTimestampKey: (keys: components["schemas"]["DashboardVisualisationColumnDefinition"][] | undefined | null) => components["schemas"]["DashboardVisualisationColumnDefinition"] | undefined;
declare const _default: {
getDatasetRows: (visDefinition: components["schemas"]["DashboardVisualisationDefinition"], dashboardData: DashboardDataResponse[]) => DashboardDataResponse[];
getLastestDataset: (dashboardData: DashboardDataResponse[], dateMeasure?: components["schemas"]["DashboardVisualisationColumnDefinition"]) => DashboardDataResponse[];
getEarliestDataset: (dashboardData: DashboardDataResponse[], dateMeasure?: components["schemas"]["DashboardVisualisationColumnDefinition"]) => DashboardDataResponse[];
filterRowsByDisplayColumns: (listDefinition: components["schemas"]["DashboardVisualisationDefinition"], dashboardData: DashboardDataResponse[], includeKeys?: boolean) => DashboardDataResponse[];
groupRowsByTimestamp: (dashboardData: DashboardDataResponse[], dateMeasure: components["schemas"]["DashboardVisualisationColumnDefinition"]) => DashboardDataResponse[][];
groupRowsByKey: (dashboardData: DashboardDataResponse[], key: string) => DashboardDataResponse[][];
groupRowsBy: (dashboardData: DashboardDataResponse[], groupIds: string[]) => DashboardDataResponse[][];
getGroupKey: (rawData: DashboardDataResponse[], keys?: Array<components["schemas"]["DashboardVisualisationColumnDefinition"]>) => {
id: string;
display?: string | null;
aggregate?: "sum" | "average" | null;
unit?: "NUMBER" | "PERCENTAGE" | null;
displayValue?: boolean | null;
axis?: string | null;
optional?: boolean | null;
type?: "boolean" | "date" | "double" | "HTML" | "long" | "string" | "time" | "timestamp" | null;
} | undefined;
getTimestampMeasure: (measures: components["schemas"]["DashboardVisualisationColumnDefinition"][]) => components["schemas"]["DashboardVisualisationColumnDefinition"] | undefined;
getTimestampKey: (keys: components["schemas"]["DashboardVisualisationColumnDefinition"][] | undefined | null) => components["schemas"]["DashboardVisualisationColumnDefinition"] | undefined;
getTimestampColumn: (columns: components["schemas"]["DashboardVisualisationColumnsDefinition"]) => components["schemas"]["DashboardVisualisationColumnDefinition"] | undefined;
getDateValue: (dashboardData?: DashboardDataResponse[] | undefined, dateColumn?: components["schemas"]["DashboardVisualisationColumnDefinition"] | undefined) => GetDateValueResponse | undefined;
};
export default _default;