Skip to main content

@idpass/data-collect-core / FormClassifier

Class: FormClassifier

Defined in: services/FormClassifier.ts:68

Classifies forms into entity types based on the dependsOn topology.

The algorithm mirrors the proven logic from AppInstanceStore.loadEntityData:

  1. Top-level forms (no dependsOn) → Group
  2. Dependent forms that are themselves dependsOn targets → Individual
  3. Dependent forms that are NOT targets (in a mixed hierarchy) → Record

In simple configs where no non-top-level form is a target (e.g., household → individual), all dependent forms stay as Individual (no Record classification).

Constructors

Constructor

new FormClassifier(): FormClassifier

Returns

FormClassifier

Methods

classifyAll()

static classifyAll(forms): Map<string, FormClassification>

Defined in: services/FormClassifier.ts:72

Classify all forms and return a Map keyed by form name.

Parameters

forms

FormDefinition[]

Returns

Map<string, FormClassification>


classifyForm()

static classifyForm(formName, forms): FormClassification

Defined in: services/FormClassifier.ts:172

Classify a single form by name within the context of all forms. Returns a safe default (Record) for unknown form names.

Parameters

formName

string

forms

FormDefinition[]

Returns

FormClassification