table: addTableValues()

in web/src/connectors/task-annotator-connector/task-annotator-utils.ts [160:211]


                    table: addTableValues(ann),
                    rowspan: ann.data?.rowspan,
                    colspan: ann.data?.colspan,
                    ...addTableValues(ann)
                },
                children: ann.children,
                links: ann.links,
                original_annotation_id: ann.originalAnnotationId
            },
            ...cells
        ];
    }

    const bound: Bound =
        ann.boundType === 'text' && ann.tokens ? getTokensBound(ann.tokens) : ann.bound;

    return [
        {
            id: +ann.id,
            type: ann.boundType,
            bbox: boundToBBox(bound),
            category: ann.category,
            data: {
                tokens: ann.tokens,
                dataAttributes: filteredDataAttrs,
                table: ann.table,
                rows: ann.table?.rows,
                cols: ann.table?.cols,
                row: ann.data?.row,
                col: ann.data?.col,
                rowspan: ann.data?.rowspan,
                colspan: ann.data?.colspan
            },
            children: ann.children,
            text: tokensByAnnotation,
            links: ann.links,
            segments: ann.segments,
            ...(ann.comment && { comment: ann.comment }),
            ...(ann.few_shot_learning && { few_shot_learning: ann.few_shot_learning })
        }
    ];
};

const addChildrenToAnnotation = (parent: Annotation, annotations: Annotation[]): Annotation => {
    const children: number[] = (parent.children as number[]) ?? [];
    for (let ann of annotations) {
        if (ann.boundType !== 'text') {
            if (
                isR2InsideR1(boundToRect(parent.bound), boundToRect(ann.bound)) &&
                ann.id !== parent.id &&
                !children.includes(+ann.id)
            ) {