Developer Docs
API Reference
Services
Progress Tracking
Classes
Class: ProgressTrackingService

web


web / lib/services/progress-tracking / ProgressTrackingService

Class: ProgressTrackingService

Centralized progress tracking service to ensure consistency across job handlers

Constructors

Constructor

new ProgressTrackingService(): ProgressTrackingService

Returns

ProgressTrackingService

Methods

getTotalForStage()

static getTotalForStage(job, stage): number

Get the appropriate total count based on whether deduplication is enabled This ensures all stages use consistent totals

Parameters

job

ImportJob

stage

string

Returns

number


createDeduplicationProgress()

static createDeduplicationProgress(totalRows, uniqueRows, internalDuplicates, externalDuplicates): DuplicationSummary

Calculate progress for deduplication stage

Parameters

totalRows

number

uniqueRows

number

internalDuplicates

number

externalDuplicates

number

Returns

DuplicationSummary


updateJobProgress()

static updateJobProgress(payload, jobId, stage, processedCount, job, additionalData): Promise<void>

Update job progress with standardized calculation

Parameters

payload

BasePayload

jobId

string | number

stage

string

processedCount

number

job

ImportJob

additionalData

Record<string, unknown> = {}

Returns

Promise<void>


updateGeocodingProgress()

static updateGeocodingProgress(payload, jobId, processedCount, job, geocodingResults): Promise<void>

Update geocoding progress specifically

Parameters

payload

BasePayload

jobId

string | number

processedCount

number

job

ImportJob

geocodingResults

Record<string, unknown>

Returns

Promise<void>


createInitialProgress()

static createInitialProgress(totalRows): ProgressInfo

Initialize progress for new import job

Parameters

totalRows

number

Returns

ProgressInfo


isStageComplete()

static isStageComplete(job, stage): boolean

Check if job stage is complete based on progress

Parameters

job

ImportJob

stage

string

Returns

boolean


getCompletionPercentage()

static getCompletionPercentage(job, stage): number

Calculate percentage completion for display

Parameters

job

ImportJob

stage

string

Returns

number