Skip to main content

inferHeadersAndTypes

chainalign-backend


chainalign-backend / mappingAssistant / inferHeadersAndTypes

Function: inferHeadersAndTypes()

inferHeadersAndTypes(rawData, sourceType, tenantId, user): Promise<{ dataWithInferredHeaders: any[]; inferredHeaders: object[]; }>

Defined in: mappingAssistant.js:29

Uses an LLM to infer headers and data types from raw, unstructured data. It also determines if the first row is a header or data, and identifies potential PII.

Parameters

rawData

The raw data, either array of arrays (sheets) or array of objects (DB).

any[] | string[][]

sourceType

string

The type of data source (e.g., 'googleSheet', 'postgresql').

tenantId

string

The ID of the tenant making the request.

user

any

The user object (e.g., from req.user).

Returns

Promise<{ dataWithInferredHeaders: any[]; inferredHeaders: object[]; }>

A promise that resolves to inferred headers (with metadata) and data formatted with those headers.