Welcome to elo-indexserver-client’s documentation!¶
Indices and tables¶
eloservice¶
- class eloservice.elo_service.EloService(url: str, user: str, password: str, cache_enable: bool = True, cache_ttl: int = 600, cache_maxsize: int = 128)¶
This class is the main class for the ELO service
- checkout(sord_id: str) Sord ¶
This function checks out a sord in ELO
- Parameters:
sord_id – The sordID of the sord in ELO
- Returns:
The checked out sord
- create_folder(path: str, separator='¶') str ¶
This function creates new folder in ELO
Depending on the given path it is possible to create 1 or multiple folders. If the folder already exists, nothing is changed and the sordID of the existing folder is returned.
- Parameters:
path – The path in ELO to the needed folder/ doc (e.g. = ¶Alpha AG¶Eingangsrechnungen¶2023¶November¶20¶)
separator – The separator which should be used to split the path (default = “¶”)
- Returns:
The sordID of the created folder
Note: a mask and metadata can not directly be assigned consistently to the folder in the same call. As they would only be assigned if the folder did not exist before. If the folder already exists, the mask and metadata would not be written. To write the mask and metadata, use the method
overwrite_mask_fields()
after the folder was created.
- deserialize_map_fields_table(table: list[dict[str, MapValue]]) dict[str, str] ¶
The reverse of serialize_map_fields_table. Given a table, it transforms it to a dictionary of map fields. Which can be directly written to elo via the method write_map_fields. All operations are done in memory and no ELO operations are performed.
In Elo a table is faked by formatting the keys of the map fields. Example: We assume some employee table with columns are “EMPLOYEE_NAME”, “AGE”, and we assume 2 rows, then the keys are formatted as follows: “EMPLOYEE_NAME1”, “AGE1”, “EMPLOYEE_NAME2”, “AGE2”
Notice that the row number is appended to the column name. Where the row number is a positive integer starting from 1 and can be any number of digits. Also Notice that there is no “table name” in the keys. The column names are arbitrary and do not need to contain any information about the table.
the result can directly be used in the function write_map_fields
- Parameters:
table – a list of dictionaries, each dictionary represents a row in the table
- Returns:
a dictionary of map fields, for the use in the function write_map_fields
- download_file(sord_id: str, file_path: str)¶
This function downloads a file from ELO :param sord_id: The sordID of the file which should be downloaded :param file_path: The path where the file should be saved
- exists(search_mask_fields: dict | None = None, search_mask_id: str | None = None) bool ¶
This function checks if an object exists that matches all the given metadata
- Parameters:
search_mask_fields – The metadata that should be searched for (default = None)
search_mask_id – The maskID of the mask that should be searched (default = None)
- Returns:
True if an object exists, False if not
- get_mask_fields(sord_id: str) dict ¶
This function returns the mask fields of a sord in ELO
ELOFIELD -> Python type:
text -> str
numerical -> float, int, Decimal
date(time) -> datetime
list -> list of str
- Parameters:
sord_id – The sordID of the sord in ELO
- Returns:
The mask fields of the sord
- move(source_sord_id: str, path: str, separator='¶')¶
This function moves a sord in ELO
- Parameters:
source_sord_id – The sordID of the sord in ELO which should be moved
path – The path of the new parent folder in ELO
separator – The separator which should be used to split the path (default = “¶”)
- Returns:
The sordId of the moved sord
- overwrite_mask_fields(sord_id: str, mask_name: str, metadata: dict, metadata_force: dict | None = None)¶
This function removes the old metadata and overwrite it with the new metadata
- Parameters:
sord_id – The sordID of the mask in ELO
mask_name – The name of the mask in ELO
metadata – The metadata which should be overwritten
metadata_force – The metadata which should be overwritten even if the given key is not in the mask. Can be needed for special metadata like the filename. The key in the dict is used as ID and as ‘name’ at the same time. Setting the key name in ELO seems to be irrelevant anyway, the ID seems to always have priority.(default = None)
- read_map_fields(sord_id: str, keys: list[str] | None = None, map_domain: str = 'Objekte') dict[str, MapValue] ¶
This function read either all map fields or a list of specific map field from a sord in ELO. In both cases, the return type is a dictionary with the key as the key of the map field and the value as the value of the map field.
- Parameters:
sord_id – The sordID of the sord in ELO you want to read the map fields from
keys – A list of keys which should be read. If None or empty list, all keys are read (default = None)
map_domain – The map domain in ELO (default = “Objekte”). This is what is displayed in the ELO client in the additional infos tab. Common map domains are ‘Objekte’ and ‘Formdata’.
- remove(sord_id: str)¶
This function removes a sord in ELO
- Parameters:
sord_id – The sordID of the sord in ELO
- search(search_mask_fields: dict | None = None, search_mask_id: str | None = None, max_results: int = 100) [<class 'str'>] ¶
This function searches for objects that match all the given metadata
- Parameters:
search_mask_fields – The metadata that should be searched for (default = None)
search_mask_id – The maskID of the mask that should be searched (default = None)
max_results – The maximum number of results that should be returned (default = 100)
- Returns:
The sordIDs of the found objects
- serialize_map_fields_table(map_fields: dict[str, MapValue], column_names: list[str])¶
Helper Method to serializes, given the raw elo map fields, a table like format. The table is represented as a list of dictionaries, where each dictionary represents a row in the table. All operations are done in memory and no ELO operations are performed.
In Elo a table is faked by formatting the keys of the map fields. Example: We assume some employee table with columns are “EMPLOYEE_NAME”, “AGE”, and we assume 2 rows, then the keys are formatted as follows: “EMPLOYEE_NAME1”, “AGE1”, “EMPLOYEE_NAME2”, “AGE2”
Notice that the row number is appended to the column name. Where the row number is a positive integer starting from 1 and can be any number of digits. Also Notice that there is no “table name” in the keys. The column names are arbitrary and do not need to contain any information about the table.
- Parameters:
map_fields – a dictionary of map fields, comes from the function read_map_fields
column_names – a list of column names
- Returns:
a list of dictionaries, each dictionary represents a row in the table
- update_file(sord_id: str, file_path: str, filename='', filename_objkey_id='51', filename_objkey='', filedate=None)¶
This function updates a file in ELO
- Parameters:
sord_id – The sordID of the file in ELO
filename – The name of the file in ELO, if not given the name of the file_path is used
file_path – The path of the file which should be uploaded
filename_objkey_id – The objkeyID of the filename objkey in ELO, default is “51” (–> objkey “ELO_FNAME”)
filename_objkey – The filename in the tab ‘Options’ in ELO
filedate – The date of the file, in UTC, default is the modification date of the file. Format is in
- ISO 8601 e.g.”2021-08-25T15:00:00”. The date is stored in UTC in ELO and displayed in the local time zone of the
user client.
- upload_file(file_path: str, parent_id: str, filemask_id='0', filename='', filename_objkey_id='51', filename_objkey='', filedate=None) str ¶
This function uploads a file to ELO
- Parameters:
filename – The name of the file in ELO, if not given the name of the file_path is used. This is the filename which is shown in the directory tree. However, also referred to as kurzbezeichnung in ELO.
filemask_id – The maskID of the filemask in ELO, default is “0” (–> mask “Freie Eingabe” = STD mask)
file_path – The path of the file which should be uploaded
parent_id – The sordID of the parent folder in ELO
filename_objkey_id – The objkeyID of the filename objkey in ELO, default is “51” (–> objkey “ELO_FNAME”) this sets the filename in the tab ‘Options’
:param filename_objkey The filename in the tab ‘Options’ in ELO :param filedate: The date of the file, in UTC, default is the modification date of the file. Format is in
ISO 8601 e.g.”2021-08-25T15:00:00”. The date is stored in UTC in ELO and displayed in the local time zone of the user client.
- Returns:
The sordID of the uploaded file
- write_map_fields(sord_id: str, fields: dict, map_domain: str = 'Objekte', value_type: ValueType = 'string', content_type='text/plain; charset=ISO_8859_1')¶
This function writes map fields to a sord in ELO.
Existing map fields are overwritten when writing the same key. Old map fields which are not overwritten will remain.
There are three different value types: * string: The value is stored as a string. The value is limited to 255 characters. * blob_string: The value is stored as a blob. The value is unlimited in size. * blob_file: The value is stored as a blob. The value is unlimited in size. The param content_type should be used to specify the content type of the blob.
Map Fields in ELO are defined as follows: * the map_domain specifies the database table in which the map fields are stored. There are two common ones ‘objekte’ and ‘formdata’. Furthermore, there can also be special map domains unique to each server. * The fields are a key value pair, unique to that domain. That are assigned to a SORD object.
Implementation details: The key is a string. The value can either be a string (limited to 255 characters) or a blob (unlimited size). The value_type specifies the type of the value. Internally the string value is stored as varchar(255) and the blob value is stored as varchar(*). Therefore, if a string value is larger than 255 characters, the value is stored as a blob.
- Parameters:
sord_id – The sordID of the sord in ELO
fields – The fields that should be written key: The key of the map field: str value: The value of the map field. The type of the value depends on the value_type parameter. For value_type = MapUtil.ValueType.string: str For value_type = MapUtil.ValueType.blob_string: str For value_type = MapUtil.ValueType.blob_file. It can either be a str which is interpreted as a file path or bytes which is interpreted as the content blob.
map_domain – The map domain in ELO (default = “Objekte”)
value_type – The value type of the fields (default = MapUtil.ValueType.string)
content_type – The content type of the blob (default = “text/plain; charset=ISO_8859_1”)