nexusLIMS.exporters.destinations.elabftw#

eLabFTW export destination plugin.

Exports NexusLIMS XML records to eLabFTW electronic lab notebook by creating experiments with markdown summaries and attaching the full XML record.

Module Contents#

Classes#

ExtraFieldsGroup

eLabFTW extra fields group definition.

ExtraField

eLabFTW extra field definition.

ELabFTWConfig

eLabFTW configuration object for extra fields metadata.

ExtraFieldsMetadata

Complete eLabFTW extra fields metadata structure.

ELabFTWDestination

eLabFTW export destination plugin.

API#

class nexusLIMS.exporters.destinations.elabftw.ExtraFieldsGroup(/, **data: Any)[source]#

Bases: pydantic.BaseModel

eLabFTW extra fields group definition.

Groups are used to organize related fields in the eLabFTW UI.

id#

Type: int

name#

Type: str

class nexusLIMS.exporters.destinations.elabftw.ExtraField(/, **data: Any)[source]#

Bases: pydantic.BaseModel

eLabFTW extra field definition.

Represents a single structured metadata field with type validation. See: https://doc.elabftw.net/metadata.html#schema-description

type#

Type: typing.Literal[text, date, datetime-local, email, number, select, radio, checkbox, url, time]

value#

Type: str | int | float | bool

description#

Type: str | None

position#

Type: int | None

group_id#

Type: int | None

required#

Type: bool | None

blank_value_on_duplicate#

Type: bool | None

model_config#
class nexusLIMS.exporters.destinations.elabftw.ELabFTWConfig(/, **data: Any)[source]#

Bases: pydantic.BaseModel

eLabFTW configuration object for extra fields metadata.

display_main_text#

Type: bool

extra_fields_groups#

Type: list[nexusLIMS.exporters.destinations.elabftw.ExtraFieldsGroup]

class nexusLIMS.exporters.destinations.elabftw.ExtraFieldsMetadata(/, **data: Any)[source]#

Bases: pydantic.BaseModel

Complete eLabFTW extra fields metadata structure.

This is the top-level object sent to eLabFTW’s metadata field.

extra_fields#

Type: dict[str, nexusLIMS.exporters.destinations.elabftw.ExtraField]

elabftw#

Type: nexusLIMS.exporters.destinations.elabftw.ELabFTWConfig

class nexusLIMS.exporters.destinations.elabftw.ELabFTWDestination[source]#

eLabFTW export destination plugin.

Creates one eLabFTW experiment per NexusLIMS session, with a markdown summary of the session and the full XML record attached as a file.

Variables:
  • name (str) – Destination identifier: “elabftw”

  • priority (int) – Export priority: 85 (after CDCS but before LabArchives)

name#

‘elabftw’

priority#

85

property enabled: bool#

Check if eLabFTW is configured and enabled.

Returns:

True if both NX_ELABFTW_API_KEY and NX_ELABFTW_URL are configured

Return type:

bool

validate_config() tuple[bool, str | None][source]#

Validate eLabFTW configuration.

Tests:

  • NX_ELABFTW_API_KEY is configured

  • NX_ELABFTW_URL is configured

  • Can authenticate to eLabFTW API

Returns:

(is_valid, error_message)

Return type:

tuple[bool, str | None]

export(context: ExportContext) ExportResult[source]#

Export record to eLabFTW.

Creates an experiment with an HTML summary of the session, then attaches the XML record file. Never raises exceptions - all errors are caught and returned as ExportResult with success=False.

Parameters:

context – Export context with file path and session metadata

Returns:

Result of the export attempt

Return type:

ExportResult