nexusLIMS.exporters#
Multi-destination export framework for NexusLIMS records.
This package provides a plugin-based architecture for exporting NexusLIMS XML records to multiple repository destinations (CDCS, LabArchives, eLabFTW, etc.).
The main entry point is export_records(), which:
Exports XML files to all enabled destinations using the configured strategy
Logs results to the upload_log database table
Returns success/failure results for each file
Example:
>>> from nexusLIMS.exporters import export_records
>>> results = export_records([xml_file], [session])
>>> if was_successfully_exported(xml_file, results):
... print("Exported successfully!")
Subpackages#
Submodules#
Package Contents#
Functions#
Export NexusLIMS records to all enabled destinations. |
|
Check if a file was successfully exported to at least one destination. |
API#
- nexusLIMS.exporters.export_records(xml_files: list[Path], sessions: list[Session], activities_per_session: list[list[AcquisitionActivity]] | None = None, reservation_events: list[ReservationEvent | None] | None = None) dict[Path, list[ExportResult]][source]#
Export NexusLIMS records to all enabled destinations.
Main entry point for exporting records. Called by record_builder.py after XML records are built and validated. Exports each record to all enabled destinations using the configured strategy, logs results to the database, and returns success/failure information.
- Parameters:
xml_files – List of XML record file paths to export
sessions – Corresponding Session objects (same length and order as xml_files)
activities_per_session – Corresponding AcquisitionActivity lists for each session (optional). If None, each session will have an empty activities list.
reservation_events – Corresponding ReservationEvent for each session (optional). If None, each session will have reservation_event=None.
- Returns:
Mapping of XML file path to list of export results (one per destination)
- Return type:
dict[Path, list[ExportResult]]
- nexusLIMS.exporters.was_successfully_exported(xml_file: Path, results: dict[Path, list[ExportResult]]) bool[source]#
Check if a file was successfully exported to at least one destination.
- Parameters:
xml_file – XML file path to check
results – Export results from export_records()
- Returns:
True if at least one destination succeeded, False otherwise
- Return type: