Developer / Plugins / Data Loaders

Data loaders

Last updated on 13-May-2020 by Jakob Jakobsen Boysen
Jakob Jakobsen Boysen

Platform Lead
boysen@scifeon.com

With this plugin you can create your own data loader for the Data Upload page and File Upload element on entity pages in Scifeon.

Definition

Data loaders are defined in the contributions.json file. A data loader is described by the following JSON:

  • id Used for referencing the data loader.
  • src The relative path to the data loader implementation.
  • description An optional description, mainly used for administrators.

A data loader must implement the interface DataLoader.

Example

In this example a simple data loader accepting JSON-files where the filename starts with "result-" is built. In this implementation, the actual JSON-file is not parsed -- a simple result is just returned. See the custom data loader tutorial for an example of a real life implementation.

Implementation

src/data-loaders/custom-data-loader.ts:

contributions.json

The following snippet defines the data loader, thus making it available for data upload: