Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contextual data for auto cluster and summarization #2959

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

subinasr
Copy link
Contributor

Changes

  • Send tags as contextual information for Auto clustering and Auto summarization

This PR doesn't introduce any:

  • temporary files, auto-generated files or secret keys
  • build works
  • eslint issues
  • typescript issues
  • codegen errors
  • console.log meant for debugging
  • typos
  • unwanted comments
  • conflict markers

Comment on lines 41 to 43
const handleTagRemove = useCallback(() => {
onRemove(label);
}, [onRemove, label]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use label as tag name and put onRemove in onClick of Button

@@ -147,6 +158,7 @@ export interface AnalyticalStatementInputProps {
listeners?: Listeners;
onSelectedNgramChange: (item: string | undefined) => void;
framework: Framework;
frameworkTagLabels: { [x: string]: string };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
frameworkTagLabels: { [x: string]: string };
frameworkTagLabels: Record<string, string>;

if (attribute.widgetType === 'MATRIX1D') {
const pillars = attribute.data?.value;
const test = Object.keys(pillars ?? [])
?.map((pillarKey) => Object.keys(pillars?.[pillarKey] ?? []))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
?.map((pillarKey) => Object.keys(pillars?.[pillarKey] ?? []))
?.map((pillarKey) => Object.keys(pillars?.[pillarKey] ?? {}))

}
if (attribute.widgetType === 'MATRIX1D') {
const pillars = attribute.data?.value;
const test = Object.keys(pillars ?? [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const test = Object.keys(pillars ?? [])
const pillarKeys = Object.keys(pillars ?? [])

Comment on lines 790 to 831
const selectedFilters = useMemo(() => (
listToMap(
sourcesFilterValue?.entriesFilterData?.filterableData,
(d) => d.filterKey,
(d) => d.valueList,
)
), [sourcesFilterValue?.entriesFilterData?.filterableData]);

const selectedFilterKeys = useMemo(() => (
Object.keys(selectedFilters ?? {})
), [
selectedFilters,
]);

const widgetTagMap = useMemo(() => (frameworkFilters
?.map((widget) => {
if (
widget.widgetType === 'SELECT'
|| widget.widgetType === 'MULTISELECT'
|| widget.widgetType === 'ORGANIGRAM'
|| widget.widgetType === 'MATRIX1D'
|| widget.widgetType === 'MATRIX2D'
) {
return widget;
}
return undefined;
}).filter(isDefined).filter(
(ff) => selectedFilterKeys.includes(ff.key),
)?.map((ff) => ({
key: ff.key,
options: ff.properties?.options,
}))
), [
frameworkFilters,
selectedFilterKeys,
]);

const widgetTagLabels = useMemo(() => (
widgetTagMap?.flatMap(
(option) => option?.options?.filter(
(widget) => selectedFilters?.[option.key]?.includes(widget.key),
)?.map(
(item: {key: string, label: string}) => item?.label,
),
).filter(isDefined)
), [
selectedFilters,
widgetTagMap,
]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do it inside a single useMemo

);

const widgetTagsFromPrimaryTagging: {
[x: string]: string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[x: string]: string
Record<string, string>

@@ -1148,15 +1157,142 @@ function PillarAnalysis() {
}));
}, [setSourcesFilterValue]);

const entriesForStatements = listToMap(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add useMemo for all functions in this page

@AdityaKhatri AdityaKhatri force-pushed the feature/tags-analysis-module branch from 1068368 to 86d2c9e Compare June 13, 2024 06:02
@subinasr subinasr force-pushed the feature/tags-analysis-module branch from 86d2c9e to 0705da8 Compare June 13, 2024 06:47
@subinasr subinasr marked this pull request as ready for review June 13, 2024 07:52
@subinasr subinasr requested a review from AdityaKhatri June 13, 2024 07:53
@subinasr subinasr force-pushed the feature/tags-analysis-module branch 2 times, most recently from 7a4291b to e9a9c18 Compare June 13, 2024 09:57
@subinasr subinasr force-pushed the feature/tags-analysis-module branch from e9a9c18 to a3af782 Compare June 13, 2024 09:58
@AdityaKhatri AdityaKhatri merged commit dc4f20b into develop Jun 13, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants