Skip to content

Commit c6b5e56

Browse files
committed
add description
1 parent 4907780 commit c6b5e56

File tree

15 files changed

+186
-233
lines changed

15 files changed

+186
-233
lines changed

web-app/client/src/components/Filters/AFDVisibilityWindow.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ import { AFDSortRowsBy, OrderBy } from 'types/globalTypes';
88
import { FiltersFields } from './Filters';
99

1010
type VisibilityProps = {
11-
setIsVisibilityShown: (arg: boolean) => void;
11+
onCloseWindow: () => void;
1212
};
1313

14-
export const VisibilityWindow: FC<VisibilityProps> = ({
15-
setIsVisibilityShown,
16-
}) => {
14+
export const VisibilityWindow: FC<VisibilityProps> = ({ onCloseWindow }) => {
1715
const baseForm = useFormContext();
1816

1917
const { control, watch, reset } = useForm<Partial<FiltersFields>>({
@@ -26,7 +24,6 @@ export const VisibilityWindow: FC<VisibilityProps> = ({
2624
const initialShowOnlyLRHS = watch('showOnlyLRHS') as boolean;
2725
const [isShowOnlyLRHS, setShowOnlyLRHS] = useState(initialShowOnlyLRHS);
2826
const { rowsOrdering, direction } = watch();
29-
console.log(rowsOrdering);
3027

3128
const orderingOptions = [
3229
{ value: AFDSortRowsBy.RHS_VALUES, label: 'RHS values' },
@@ -43,13 +40,13 @@ export const VisibilityWindow: FC<VisibilityProps> = ({
4340
name="Visibility"
4441
onClose={() => {
4542
reset();
46-
setIsVisibilityShown(false);
43+
onCloseWindow();
4744
}}
4845
onApply={() => {
4946
baseForm.setValue('rowsOrdering', rowsOrdering);
5047
baseForm.setValue('direction', direction);
5148
baseForm.setValue('showOnlyLRHS', isShowOnlyLRHS);
52-
setIsVisibilityShown(false);
49+
onCloseWindow();
5350
}}
5451
>
5552
<Checkbox
@@ -60,7 +57,7 @@ export const VisibilityWindow: FC<VisibilityProps> = ({
6057
<ControlledSelect
6158
control={control}
6259
controlName="rowsOrdering"
63-
label={'Order rows by'}
60+
label="Order rows by"
6461
options={orderingOptions}
6562
/>
6663
<ControlledSelect

web-app/client/src/components/PrimitiveDescription/PrimitiveDescription.module.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
.description {
44
display: block;
55

6+
ol {
7+
list-style: decimal;
8+
margin-left: 16px;
9+
margin-top: 16px;
10+
margin-bottom: 16px;
11+
12+
li {
13+
margin-bottom: 8px;
14+
}
15+
}
16+
617
svg {
718
transform: translateY(2px);
819
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@import "styles/common";
2+
3+
.container {
4+
height: 100%;
5+
display: flex;
6+
align-items: center;
7+
justify-content: center;
8+
}
9+
10+
.filler {
11+
height: 80px;
12+
width: fit-content;
13+
margin: auto;
14+
display: flex;
15+
align-items: center;
16+
17+
.icon {
18+
height: 80px;
19+
width: 80px;
20+
border-radius: 24px;
21+
padding: 16px;
22+
margin-right: 16px;
23+
background-color: $primary-10;
24+
25+
svg {
26+
height: 48px;
27+
width: 48px;
28+
color: $primary-0;
29+
}
30+
}
31+
32+
.text {
33+
h6 {
34+
@include heading-6;
35+
margin-bottom: 8px;
36+
}
37+
38+
p {
39+
@include paragraph-small;
40+
color: $black-75;
41+
}
42+
}
43+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { FC, ReactNode } from 'react';
2+
import styles from './ReportFiller.module.scss';
3+
4+
type ReportFillerProps = {
5+
title: string;
6+
description?: string;
7+
icon?: ReactNode;
8+
};
9+
const ReportFiller: FC<ReportFillerProps> = ({ title, description, icon }) => {
10+
return (
11+
<div className={styles.container}>
12+
<div className={styles.filler}>
13+
{icon && <div className={styles.icon}>{icon}</div>}
14+
<div className={styles.text}>
15+
<h6>{title}</h6>
16+
{description && <p>{description}</p>}
17+
</div>
18+
</div>
19+
</div>
20+
);
21+
};
22+
23+
export default ReportFiller;

web-app/client/src/components/ScrollableNodeTable/implementations/AFD/AFDTable.module.scss

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
11
@import "styles/common";
22

3-
.greenHighlighted {
4-
background: $success-25 !important; // stylelint-disable-line declaration-no-important
5-
}
6-
73
.greenEven {
8-
background: $success-05 !important; // stylelint-disable-line declaration-no-important
4+
background: $success-05;
95
}
106

117
.greenOdd {
128
background: $success-10 !important; // stylelint-disable-line declaration-no-important
139
}
1410

15-
.redHighlighted {
16-
background: $error-25 !important; // stylelint-disable-line declaration-no-important
17-
}
18-
1911
.redEven {
20-
background: $error-05 !important; // stylelint-disable-line declaration-no-important
12+
background: $error-05;
2113
}
2214

2315
.redOdd {

web-app/client/src/components/ScrollableNodeTable/implementations/AFD/AFDTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const getAFDRow: (row: AFDTableRow, position: number) => Row = (
4141
) => {
4242
return {
4343
items: [
44-
row.isFrequent ? ( // icon
44+
row.isFrequent ? (
4545
<Check className={styles.checkmark} height={20} width={20} />
4646
) : (
4747
<Cross height={20} width={20} />

web-app/client/src/constants/configuratorForm/AFDForm.tsx

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,26 @@
11
import { useQuery } from '@apollo/client';
2-
import { useEffect, useMemo } from 'react';
32
import badgeStyles from '@components/Inputs/MultiSelect/OptionBadge/OptionBadge.module.scss';
4-
import {
5-
MFDAlgoOptions,
6-
MFDColumnType,
7-
MFDColumnTypeOptions,
8-
MFDDistancesOptions,
9-
MFDMetricOption,
10-
MFDMetricOptions,
11-
optionsByMetrics,
12-
} from '@constants/options';
3+
import { AFDOptions } from '@constants/options';
134
import {
145
getCountOfColumns,
156
getCountOfColumns_datasetInfo_statsInfo_stats,
167
getCountOfColumnsVariables,
178
} from '@graphql/operations/queries/__generated__/getCountOfColumns';
189
import { GET_COUNT_OF_COLUMNS } from '@graphql/operations/queries/getDatasetColumnCount';
1910
import { showError } from '@utils/toasts';
11+
import { useEffect, useMemo } from 'react';
2012
import {
2113
Defaults,
2214
FormFieldsProps,
23-
CreateFormProcessor,
2415
CreateForm,
2516
FormSelectOptions,
2617
FormHook,
2718
Presets,
2819
} from 'types/form';
2920
import { OptionWithBadges } from 'types/multiSelect';
3021

31-
const TypesCategories: Record<string, string> = {
32-
Int: 'Numeric',
33-
Double: 'Numeric',
34-
BigInt: 'Numeric',
35-
String: 'String',
36-
};
37-
3822
const AFDDefaults = {
39-
algorithmName: 'ApproximateVerification',
23+
algorithmName: 'Naive AFD Verifier',
4024
lhsIndices: [] as number[],
4125
rhsIndices: [] as number[],
4226
} satisfies Defaults;
@@ -56,9 +40,10 @@ const AFDPresets: Presets<typeof AFDDefaults> = [
5640
const AFDFields = {
5741
algorithmName: {
5842
order: 0,
59-
type: 'hidden_value',
60-
label: '',
61-
isDisplayable: false,
43+
type: 'select',
44+
label: 'Algorithm',
45+
isLoading: false,
46+
options: AFDOptions,
6247
},
6348
lhsIndices: {
6449
order: 1,
@@ -68,9 +53,8 @@ const AFDFields = {
6853
isLoading: true as boolean,
6954
rules: {
7055
validate: (value) => {
71-
if (Array.isArray(value))
72-
return value.length > 0 ? undefined : 'Cannot be empty';
73-
return undefined;
56+
if (Array.isArray(value) && value.length === 0)
57+
return 'Cannot be empty';
7458
},
7559
},
7660
},
@@ -138,7 +122,6 @@ const useAFDFormHook: FormHook<typeof AFDDefaults, typeof AFDFields> = (
138122
}
139123
}, [columnData, loading, setForm]);
140124
};
141-
142125

143126
export const AFDForm = CreateForm({
144127
formDefaults: AFDDefaults,
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FC } from 'react';
2+
3+
const DescriptionAFD: FC = () => {
4+
return (
5+
<>
6+
This task checks whether a single FD holds over a provided table. In case
7+
if exact FD does not hold, then:
8+
<ol>
9+
<li>
10+
the approximate FD is checked and the error threshold is returned,
11+
</li>
12+
<li>
13+
the data that violates the FD is shown in the form of clusters — all
14+
different RHS values for a fixed LHS one.
15+
</li>
16+
</ol>
17+
For the notion of the approximate FD and the error threshold, check{' '}
18+
<a href="https://www.vldb.org/pvldb/vol11/p759-kruse.pdf">
19+
“Efficient discovery of approximate dependencies”
20+
</a>{' '}
21+
by S. Kruse and F. Naumann.
22+
</>
23+
);
24+
};
25+
26+
export default DescriptionAFD;

web-app/client/src/constants/options.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const FDAlgorithms = [
2525
type FDAlgorithm = (typeof FDAlgorithms)[number];
2626
type CFDAlgorithm = 'CTane';
2727
type ARAlgorithm = 'Apriori';
28+
type AFDAlgorithm = 'Naive AFD Verifier';
2829

2930
// const MFDAlgorithms = ['BRUTE', 'APPROX', 'CALIPERS'] as const;
3031
const MFDAlgorithms = ['Brute', 'Approx', 'Calipers'] as const;
@@ -35,7 +36,8 @@ export type Algorithms =
3536
| FDAlgorithm
3637
| CFDAlgorithm
3738
| ARAlgorithm
38-
| MFDAlgorithm;
39+
| MFDAlgorithm
40+
| AFDAlgorithm;
3941

4042
type AlgoProps = 'arity' | 'threshold' | 'threads';
4143

@@ -50,6 +52,7 @@ export const TypoOptions = FDoptions;
5052
export const CFDoptions: AlgoOption[] = [toAlgoOption('CTane')];
5153
export const ARoptions: AlgoOption[] = [toAlgoOption('Apriori')];
5254
export const ApproxOptions: AlgoOption[] = [toAlgoOption('Pyro')];
55+
export const AFDOptions: AlgoOption[] = [toAlgoOption('Naive AFD Verifier')];
5356

5457
const toScreamingSnakeAlgoOption = (algo: Algorithms): AlgoOption => {
5558
return {

web-app/client/src/constants/primitiveInfoType.ts renamed to web-app/client/src/constants/primitiveInfoType.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1+
import { ReactNode } from 'react';
12
import { MainPrimitiveType } from 'types/globalTypes';
3+
import DescriptionAFD from './descriptionAFD';
24

35
export type PrimitiveInfoType = {
46
label: string;
5-
description: string;
7+
description: ReactNode;
68
link?: string;
79
};
810

911
const primitiveInfo: Partial<Record<MainPrimitiveType, PrimitiveInfoType>> = {
1012
[MainPrimitiveType.FD]: {
11-
label: 'Functional Dependencies',
13+
label: 'Functional Dependency Discovery',
1214
description:
13-
'Functional dependencies are crucial metadata for performing schema normalization, data cleaning and various data profiling tasks. A single FD represents a relationship between two disjoint sets of attributes, which states that the values from one set uniquely determine the values of another. Such hidden patterns provide a great start to get to know your data.',
15+
'Functional dependencies are crucial metadata for performing schema normalization, data cleaning and various data profiling tasks. A single FD represents a relationship between two disjoint sets of attributes, which states that the values from one set uniquely determine the values of another. Such hidden patterns provide a great start to get to know your data. This task discovers all FDs (either exact or approximate) contained in a provided table.',
1416
link: 'https://mstrutov.github.io/Desbordante/guides/fd-mining.html',
1517
},
1618
[MainPrimitiveType.CFD]: {
@@ -37,8 +39,8 @@ const primitiveInfo: Partial<Record<MainPrimitiveType, PrimitiveInfoType>> = {
3739
'Metric verification is a process of checking whether a specific metric functional dependency (MFD) holds on data or not. MFD is a relaxed form of classic functional dependencies which allows small variations in the values of the right hand side of a dependency. It other words, for MFD X⟶Y we still expect two different tuples to agree on values of attributes in X, but their values on Y can differ no more than some threshold. MFD can be verified for numeric and string types using different metrics. Currently available are: Euclidean, Levenshtein and Cosine. Results of metric verification process are presented as clusters of records which share the same left hand side, but differ in the right one. If distance of records\' values too far from any points of the same cluster, they are tagged with an "X" mark. A check mark is used otherwise.',
3840
},
3941
[MainPrimitiveType.AFD]: {
40-
label: 'Approximate Functional Dependencies',
41-
description: 'Description',
42+
label: 'Functional Dependency Validation',
43+
description: <DescriptionAFD />,
4244
},
4345
} as const;
4446

0 commit comments

Comments
 (0)