Skip to content

Commit

Permalink
LKE-11926: Finer grained entity resolution ingestion
Browse files Browse the repository at this point in the history
  • Loading branch information
gmasclet committed Nov 6, 2024
1 parent 636af03 commit 4215d0d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 7 deletions.
56 changes: 50 additions & 6 deletions src/api/entityResolution/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
DeleteEntityResolutionMappingParams,
EntityResolutionMapping,
IngestionStatus,
StartIngestionParams,
StartEntityResolutionTaskParams,
UpdateEntityResolutionMappingParams
} from './types';

Expand All @@ -30,7 +30,7 @@ const {

export class EntityResolutionAPI extends Request {
/**
* Create a new entity resolution mapping.
* Create a new entity resolution mapping, for a given node category.
*/
createEntityResolutionMapping(params: CreateEntityResolutionMappingParams) {
return this.request({
Expand All @@ -42,7 +42,7 @@ export class EntityResolutionAPI extends Request {
}

/**
* Update an existing entity resolution mapping.
* Update an existing entity resolution mapping, for a given node category.
*/
updateEntityResolutionMapping(params: UpdateEntityResolutionMappingParams) {
return this.request({
Expand All @@ -54,7 +54,7 @@ export class EntityResolutionAPI extends Request {
}

/**
* Delete an existing entity resolution mapping.
* Delete an existing entity resolution mapping, for a given node category.
*/
deleteEntityResolutionMapping(params: DeleteEntityResolutionMappingParams) {
return this.request({
Expand All @@ -81,9 +81,16 @@ export class EntityResolutionAPI extends Request {
}

/**
* Start the entity resolution ingestion on a given data-source.
* Start a full ingestion task on a given data-source. This task:
* - Ensures all the graph indexes needed for entity resolution are created.
* - Fetches all the graph nodes for each mapped category.
* - Converts each fetched node into an entity resolution record.
* - Sends all the converted records to the entity resolution server.
* - Materializes the resolved entities in the graph database.
*
* By default, immediately returns, without waiting for the task to complete.
*/
startIngestion(params: StartIngestionParams) {
startFullIngestion(params: StartEntityResolutionTaskParams) {
return this.request({
errors: [UNAUTHORIZED, FORBIDDEN, DATA_SOURCE_UNAVAILABLE, ILLEGAL_SOURCE_STATE],
url: '/:sourceKey/entityResolution',
Expand All @@ -92,6 +99,43 @@ export class EntityResolutionAPI extends Request {
});
}

/**
* Start an incremental ingestion task on a given data-source. This task is similar to a full
* ingestion task, but it only fetches the graph nodes that have been modified after the latest
* ingestion.
*
* This task is going to fail if:
* - Incremental ingestion is not configured for the data-source.
* - Or if the ingestion state is not `done` (a full ingestion has to be done first).
*
* By default, immediately returns, without waiting for the task to complete.
*/
startIncrementalIngestion(params: StartEntityResolutionTaskParams) {
return this.request({
errors: [UNAUTHORIZED, FORBIDDEN, DATA_SOURCE_UNAVAILABLE, ILLEGAL_SOURCE_STATE],
url: '/:sourceKey/entityResolution',
method: 'PATCH',
params: params
});
}

/**
* Start a purge task for a given data-source. This task:
* - Removes all the entity nodes/edges in the graph database.
* - Deletes all the graph indexes related to entity resolution.
* - Empties the data-source in the entity-resolution server.
*
* By default, immediately returns, without waiting for the task to complete.
*/
startPurge(params: StartEntityResolutionTaskParams) {
return this.request({
errors: [UNAUTHORIZED, FORBIDDEN, DATA_SOURCE_UNAVAILABLE, ILLEGAL_SOURCE_STATE],
url: '/:sourceKey/entityResolution',
method: 'DELETE',
params: params
});
}

/**
* Get the status of the entity resolution ingestion, for a given data-source.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/api/entityResolution/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export type RecordAddressAttribute = (typeof RECORD_ADDRESS_ATTRIBUTES)[number];
export const RECORD_PHONE_ATTRIBUTES = ['number', 'fromDate', 'thruDate'] as const;
export type RecordPhoneAttribute = (typeof RECORD_PHONE_ATTRIBUTES)[number];

export interface StartIngestionParams extends IDataSourceParams {
export interface StartEntityResolutionTaskParams extends IDataSourceParams {
waitForCompletion?: boolean;
}

Expand Down

0 comments on commit 4215d0d

Please sign in to comment.