@plust/datasleuth - v0.2.0
    Preparing search index...

    Class ResultMerger

    Result merger utility to combine results from multiple research tracks

    Index

    Constructors

    Methods

    • Merges research data from multiple tracks

      Parameters

      • tracks: Record<
            string,
            {
                name: string;
                results: any[];
                data: Record<string, any>;
                metadata?: Record<string, any>;
                errors: { message: string; step?: string; code?: string }[];
                completed: boolean;
            },
        >

        Track results to merge

      • options: ConflictResolutionOptions = ...

        Conflict resolution options

      Returns Record<string, any>

      Merged data object

    • Merges results from multiple tracks into a cohesive output

      Parameters

      • tracks: Record<
            string,
            {
                name: string;
                results: any[];
                data: Record<string, any>;
                metadata?: Record<string, any>;
                errors: { message: string; step?: string; code?: string }[];
                completed: boolean;
            },
        >

        Track results to merge

      • state: ResearchState

        Current research state

      • options: ConflictResolutionOptions = ...

        Conflict resolution options

      Returns any

      Merged results object

    • Creates a merge function for use with parallel research

      Parameters

      Returns (
          tracks: Record<
              string,
              {
                  name: string;
                  results: any[];
                  data: Record<string, any>;
                  metadata?: Record<string, any>;
                  errors: { message: string; step?: string; code?: string }[];
                  completed: boolean;
              },
          >,
          state: ResearchState,
      ) => {
          data: Record<string, any>;
          results: any;
          metadata: {
              mergeStrategy:
                  | "custom"
                  | "first"
                  | "last"
                  | "mostConfident"
                  | "majority"
                  | "weighted";
              tracksCount: number;
              mergedAt: string;
          };
      }

      A merge function that can be used with the parallel step