-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvisualization.ts
More file actions
120 lines (97 loc) · 3.13 KB
/
Copy pathvisualization.ts
File metadata and controls
120 lines (97 loc) · 3.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import { DateResult } from '.';
import { TermsResult } from './aggregation';
import { APIQuery } from './search-requests';
export interface TermFrequencyResult {
key: string;
match_count: number;
token_count?: number;
total_doc_count: number;
}
export interface HistogramDataPoint {
key: string;
doc_count: number;
relative_doc_count?: number;
match_count?: number;
token_count?: number;
total_doc_count?: number;
matches_by_token_count?: number;
matches_by_doc_count?: number;
key_as_string?: string;
}
export interface TimelineDataPoint {
date: Date;
doc_count: number;
relative_doc_count?: number;
match_count?: number;
token_count?: number;
total_doc_count?: number;
matches_by_token_count?: number;
matches_by_doc_count?: number;
}
/**
* Dataseries for barcharts.
* Each dataseries defines its own query text
* and stores results for that query.
* `data` contains the results per bin on the x-axis.
* Elements of `data` are often called cat/category in the code.
*/
export interface BarchartSeries<Result> {
data: Result[];
total_doc_count: number; // total documents matching the query across the series
searchRatio: number; // ratio of total_doc_count that can be searched through without exceeding documentLimit
queryText?: string; // replaces the text in this.queryModel when searching
}
export type HistogramSeries = BarchartSeries<TermsResult>;
export type TimelineSeries = BarchartSeries<DateResult>;
export interface TimelineBin {start_date: string; end_date: string; size: number }
export interface HistogramBin {field_value: string|number; size: number }
export type TimeCategory = 'year'|'week'|'month'|'day';
export type TermFrequencyParameters<Bin> = {
corpus_name: string;
field_name: string;
bins: Bin[];
full_data?: boolean;
unit?: TimeCategory;
} & APIQuery;
export type AggregateTermFrequencyParameters = TermFrequencyParameters<HistogramBin>;
export type DateTermFrequencyParameters = TermFrequencyParameters<TimelineBin>;
export type WordcloudParameters = {
corpus: string;
field: string;
size?: number;
} & APIQuery;
export type NGramRequestParameters = {
corpus_name: string;
field: string;
mode: 'ngrams' | 'collocates',
ngram_size?: number;
term_position?: string;
freq_compensation?: boolean;
subfield?: string;
max_size_per_interval?: number;
number_of_ngrams?: number;
date_field: string;
} & APIQuery;
export interface FreqTableHeader {
key: string;
label: string;
format?: (value) => string;
formatDownload?: (value) => string;
isOptional?: boolean;
isMainFactor?: boolean;
isSecondaryFactor?: boolean;
}
export type FreqTableHeaders = FreqTableHeader[];
export type Normalizer = 'raw'|'percent'|'documents'|'terms';
export type ChartType = 'bar' | 'line' | 'scatter';
export interface ChartParameters {
normalizer: Normalizer;
chartType: ChartType;
}
export interface FieldCoverage {
[field: string]: number;
};
/** number of unique values for that field */
export interface FieldCardinality {
[field: string]: number;
}