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.
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.
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
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
Parameter
File format selector:
Key
format
Label
Export file format
Type
Value list
Values
JSON
CSV
XML
File metadata type selector:
Key
metadata_type
Label
Metadata type
Type
Value list
Values
EMBEDDED
CONTAINER
OBJECT
File name prefix:
Key
file_prefix
Label
File prefix
Type
String
Usage
This function appears always available in a container.
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.
During function execution, the log will show what is happening.