Docs · Validators

enum validator

Reject any value not in an exact, case-sensitive allow-list.

Validator type
enum
Cost
Pure compute · no AI
Free-text resolver
No
In the catalogue
36 templates

Reference

Format

Membership test against an explicit `values` array. Comparison is strict equality — case-sensitive, whitespace-sensitive. Normalise upstream (lowercase, trim) if your data is dirty.

Examples

  • values: ['male', 'female', 'other', 'unknown']
  • values: ['permanent', 'fixed_term', 'apprentice']
  • values: ['USD', 'EUR', 'CHF']

How it runs

Implementation

A faithful summary of lib/validators.ts. Validators are pure functions and run identically in the Worker, the Workbench and the MCP server — one implementation, so the three cannot disagree about whether a value is valid.

sourcelib/validators.ts
function validEnum(value, params) {
  const vs = Array.isArray(params.values) ? params.values : []
  return vs.includes(value)
    ? OK
    : fail('enum_invalid', `expected one of ${vs.join(', ')}`)
}

Config

Use in a template

Validators attach to a field on a custom template. The cascade runs them after mapping but before commit; failures surface in the per-row validation report.

configtemplate.yaml
fields:
  - column: gender
    type: enum
    enum_values: [male, female, other, unknown]
    validators:
      - type: enum
        values: [male, female, other, unknown]

Watch out

Common gotchas

  • Strict equality only — `Male` will fail against `male`. Lowercase in your transform first.
  • This explicit validator is strict equality. A field typed `enum` with `enum_values` is ALSO enforced by the row validator on its own — case, accents, surrounding space and space/hyphen-vs-underscore folded, plus a fixed table of documented synonyms (`M` / `Männlich` / `Homme` → `male`, `American Express` → `amex`, `no-show` → `noshow`, `first-line` → `1L`) — and the value is rewritten to the canonical spelling before any explicit validator runs.
  • No partial match and no catch-all: `KVG Basic` is not `kvg`, and a value outside the enum and outside the synonym table is a row error (`enum_invalid`).

Where it runs

Three routes, no AI cost.

  • POST/v1/validate-rowValidate one row against a template. Stateless, no key, pure compute — the fastest way to try enum against a real value.no key
  • POST/v1/uploads/:id/validateRun every field validator over the parsed upload, without committing. Returns errors and warnings per row.read
  • POST/v1/uploads/:id/commitValidates on the way out. skip_invalid_rows drops the failures instead of failing the commit.commit

Validators are pure functions, so they add nothing to the AI bill. Every map draws a small flat per-map fee from your prepaid token wallet ($10 minimum, shared across the phi-cloud suite); only columns that reach the metered LLM layer, plus any-to-any convert and structural reshape, bill real AI tokens. See pricing

Catalogue

Related templates

  • Usersusers_v1

    User directory: identity, contact, role, and onboarding metadata.

    Fields · role

  • Transactionstransactions_v1

    Payment / ledger transactions: amount, currency, status, customer linkage.

    Fields · status

  • Employee rosteremployee_roster_v1

    Names, AHV/GLN, contract type, address.

    Fields · contract_type

  • Patient demographicspatient_demographics_v1

    Patient identity. Emits FHIR Patient.

    Fields · gender

  • Appointment logappointment_log_v1

    Past appointments. Emits FHIR Appointment.

    Fields · status

  • Insurance contractsinsurance_contracts_v1

    Payer / contract metadata.

    Fields · contract_type

  • Encountersencounters_v1

    Visits and hospital stays: patient, setting, admission and discharge. Emits FHIR Encounter.

    Fields · encounter_classstatus

  • Diagnosesconditions_v1

    Patient diagnoses coded in ICD-10, with clinical status and onset. Emits FHIR Condition.

    Fields · clinical_status

  • Vaccinationsimmunizations_v1

    Vaccinations given or declined: vaccine, date, lot and site. Emits FHIR Immunization.

    Fields · status

  • Allergiesallergies_v1

    Allergies and intolerances: substance, criticality and status. Emits FHIR AllergyIntolerance.

    Fields · criticalityclinical_status

  • Care facilitiescare_facilities_v1

    Sites, wards and rooms where care happens, with their status. Emits FHIR Location.

    Fields · status

  • Healthcare organizationshealthcare_organizations_v1

    Hospitals, practices, labs and payers with their GLN or NPI. Emits FHIR Organization.

    Fields · organization_type

  • Leadsleads_v1

    Sales leads: contact, source, status, and creation metadata.

    Fields · sourcestatus

  • Opportunitiesopportunities_v1

    Deals in pipeline: amount, stage, probability, close date, owner.

    Fields · stage

  • Accountsaccounts_v1

    Company-level CRM records: domain, industry, headcount, country, ARR band.

    Fields · arr_band

  • Activitiesactivities_v1

    Log of CRM touches and events: calls, emails, meetings, demos, notes, tasks.

    Fields · kind

  • Support ticketssupport_tickets_v1

    Customer support cases: requester, subject, priority, status, assignee and resolution time.

    Fields · prioritystatuschannel

  • Campaignscampaigns_v1

    Marketing campaigns: channel, dates, budget, spend and the leads they brought in.

    Fields · channel

  • Ordersorders_v1

    Purchase orders: customer, total, status, shipping address, tax and discount.

    Fields · status

  • Returnsreturns_v1

    Return and refund records: order linkage, reason, amount, status.

    Fields · reasonstatus

  • Shipmentsshipments_v1

    Parcels on their way: order, carrier, tracking number, dates and delivery status.

    Fields · status

  • Subscriptionssubscriptions_v1

    Recurring plans: customer, plan, price, billing interval, renewal and cancellation.

    Fields · intervalstatus

  • Paymentspayments_v1

    Masked card payments: brand, last 4 digits, amount, processor reference. PCI scope — full PAN must NEVER be imported, only the last 4 digits.

    Fields · card_brandstatus

  • Invoicesinvoices_v1

    Accounts-receivable invoices: amounts, due dates, payment status.

    Fields · status

  • KYC profileskyc_profiles_v1

    Know-Your-Customer identity profiles with risk rating. Contains PII.

    Fields · risk_rating

  • Chart of accountschart_of_accounts_v1

    The account plan: number, name, type and parent account.

    Fields · account_type

  • Expensesexpenses_v1

    Employee expense claims: who, what, how much, and whether it was approved.

    Fields · categorystatus

  • Purchase orderspurchase_orders_v1

    Purchase orders: supplier, item, quantity, price and delivery date.

    Fields · status

  • Employeesemployees_v1

    Employee master records with identity, contact, and bank details. Contains PII.

    Fields · status

  • Time offtime_off_v1

    Leave and absence records: type, dates, and approval status.

    Fields · typestatus

  • Candidatescandidates_v1

    Recruiting pipeline: applicant contact, role, and stage.

    Fields · stage

  • Timesheetstimesheets_v1

    Hours worked per person and day, with project and overtime.

    Fields · status

  • Training recordstraining_records_v1

    Courses and certifications per person: completion, score and expiry.

    Fields · status

  • Benefits enrollmentsbenefits_enrollments_v1

    Who is enrolled in which benefit plan, at what coverage level and with how many dependents. Health-plan enrolment can reveal health and family data.

    Fields · plan_typecoverage_level

  • One line-of-therapy / pathway recommendation from a clinical guideline (NCCN/ESMO/NICE/ASCO). Maps to drug-database.clinical_guidelines.

    Fields · sourceline_of_therapy

  • One HTA body's cost-effectiveness decision for a drug×indication, with ICER/QALY economics. Maps to drug-database.hta_assessments.

    Fields · sourcedecisionhbpb_basis

Explore

All 19 validator types

The complete list a template field can declare. There is no SNOMED validator — it required an affiliate licence, no template used it, and it was removed in 2026.

Ready when you are

Validate every row — before it lands.

Attach checksum-strict validators to any field, and gate risky commits behind the requires_hitl flag. One key runs the whole cascade.

Prepaid token wallet · schema-only data-minimization mode · no free tier