Skip to content

Latest commit

 

History

History
72 lines (51 loc) · 2.16 KB

File metadata and controls

72 lines (51 loc) · 2.16 KB

Dynamic Upload Metadata Schema

{config_path}/metadata.json defines how upload metadata is collected, validated, and stored.


Field Definition

Each field supports the following properties.

Required Properties

  • key (string, unique) Unique identifier used in API payloads and stored metadata.
  • label (string) Human-readable label displayed in the UI.
  • type (string) Data type of the field. Supported values: string, text, number, integer, boolean, date, datetime, select, multiselect.

Common Properties

  • required (boolean) Whether the field must be present.
  • placeholder (string) Placeholder text shown in the UI.
  • help / description (string) Helper text displayed below the input.
  • default (any) Default value used by the frontend when initializing the upload form.

Select and Multiselect Properties

  • options (array) Allowed values. Each entry may be a string or an object of the form { "label": "...", "value": "..." }.
  • allowCustom (boolean) When enabled, users may provide values not listed in options (the UI uses a datalist-style input).

Validation Rules

  • min, max Numeric bounds for number and integer fields.
  • minLength, maxLength Length constraints for string and text fields.
  • regex Regular expression the value must match. Enforced both on the frontend and backend.

Filename Extraction (Optional)

  • extract_regex Optional Python regular expression applied to the uploaded filename to prefill the field. If the pattern matches, capture group 1 is used; otherwise, the full match is used. For date fields, named groups year, month, and day are combined into YYYY-MM-DD.

Behavior

  • The active schema is exposed via GET /api/metadata.
  • Filename extraction is available via POST /api/metadata/extract.
  • During upload initiation, metadata is validated server-side against the schema.
  • The frontend and CLI both use the extraction endpoint for filename-based prefilling.
  • Metadata is stored per upload as JSON in the meta_data field.