Skip to content
Snippets Groups Projects
Alberto Parra's avatar
266dfd81
Name Last commit Last update
images
README.md
main.py

Metadata extractor function

This function allows to generate CSV, JSON or XML files with the metadata or embedded metadata of the objects or container.

This function can be executed in two ways:

  • By selecting the files in the file explorer from which you want to extract the information.
  • Without selecting any file, the function will generate a file with the data of all the files in the container.

To extract container metadata you do not need to select any file.

the generated file is stored in the root of the container.

Installation

Functions can be found in the Configuration menu, in the Functions section.

Function Menu

First thing to set in your function is the name, following the requirements for the name. Description is optional. In the section below, place the code from the repo in the editor.

Function Code

Configuration

Build commands

The configuration section contains information about what to install for the function to work. This function uses specific versions from the following libraries: pandas and openpyxl. Therefore, the following line of code has to be added to the Build Params section:

pip install pandas==1.3.5 openpyxl==3.0.9

Function Build

Trigger

Triggers tell the function when it must be executed.

As this function can be launched both by selecting a file or on the whole container, we check the value 'Always show it' on the field 'Show this function in the management interface when'.

Name

Metadata extractor

Type

On Demand (manually Launched By Users)

Show this function in the management interface when

Always show it

Function Trigger

Parameter

File format selector:

Key

format

Label

Export file format

Type

Value list

Values

JSON
CSV
XML

Format Parameter

File metadata type selector:

Key

metadata_type

Label

Metadata type

Type

Value list

Values

EMBEDDED
CONTAINER
OBJECT

Format Type

File name prefix:

Key

file_prefix

Label

File prefix

Type

String

File Prefix

Usage

This function appears always available in a container.

Function Usage

In this popup you can choose the format of the generated file, the type of metadata (object, container or embedded) and the prefix with which the generated file will be named.

Parameters

During function execution, the log will show what is happening.

Parameters