For the complete documentation index, see llms.txt. This page is also available as Markdown.

Configuration

defineConfig

Defines and validates a complete event type (birth, death, marriage, or any custom event). Parses and validates the config at startup; throws if the config is invalid.

Signature

function defineConfig(config: EventConfigInput): EventConfig

Parameters

The EventConfig object

Attributes

Configuration defining an event type registered in OpenCRVS (for example birth or death).

idstringRequired

Machine-readable identifier of the event (e.g. "birth", "death").

dateOfEventany ofOptional

Reference to the field capturing the date of the event (e.g. date of birth). Defaults to the event creation date if unspecified.

or
actionsone of[]Required

Configuration of core and custom actions associated with the event.

or
or
or
or
or
or
or
or
actionOrderstring[]Optional

Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions.

analyticsbooleanRequired

Indicates whether the records of this event type are included in analytics

Default: true

The EventConfig object

Example 1 — marriage event

import { defineConfig, field, ActionType } from '@opencrvs/toolkit/events'

export const marriageEvent = defineConfig({
  id: 'marriage',
  label: { id: 'event.marriage.label', defaultMessage: 'Marriage', description: '' },
  title: {
    id: 'event.marriage.title',
    defaultMessage: '{bride.name.firstname} & {groom.name.firstname}',
    description: ''
  },
  fallbackTitle: { id: 'event.marriage.fallbackTitle', defaultMessage: 'No names provided', description: '' },
  dateOfEvent: field('marriage.date'),
  summary: { fields: [{ fieldId: 'marriage.date' }, { fieldId: 'marriage.placeOfMarriage' }] },
  declaration: MARRIAGE_DECLARATION_FORM,
  actions: [
    { type: ActionType.DECLARE, label: { id: 'event.marriage.declare', defaultMessage: 'Declare', description: '' }, review: MARRIAGE_REVIEW_FORM, form: MARRIAGE_DECLARATION_FORM },
    { type: ActionType.REGISTER, label: { id: 'event.marriage.register', defaultMessage: 'Register', description: '' }, review: MARRIAGE_REVIEW_FORM, form: MARRIAGE_DECLARATION_FORM }
  ]
})

Example 2 — birth event with date/place references

Last updated