Copy Datasets and associated metadata between different LOGS groups

This solution copies datasets linked to one or more source projects from a source LOGS group to a target LOGS group. During the transfer, it can also copy the related metadata and referenced entities needed to recreate the project content in the target group.

To run this notebook you need a Jupyter kernel. A kernel is a Python environment that executes the code from your notebook. If no Jupyter kernel is set up yet, you can register one with the following command in the terminal:

python -m ipykernel install --user --name env_name --display-name "YourName"

Imports

Please import all necessary modules first by executing the following section

#!/usr/bin/env python3

from LOGS import LOGS
from LOGS_solutions.CopyProjectBetweenGroups.CopyProjectLib import CopyProject

Parameters

Connection parameters

  • source_key: API key for the source LOGS group that will be read from.

  • source_url: Base URL of the source LOGS group.

  • target_key: API key for the target LOGS group that will receive copied content.

  • target_url: Base URL of the target LOGS group.

CopyParameters create options

  • projectCreateMissing: Create the target project when a matching project does not already exist.

  • sampleCreateMissing: Create missing samples in the target group.

  • datasetCreateMissing: Create missing datasets in the target group.

  • methodCreateMissing: Create missing methods in the target group.

  • personCreateMissing: Create missing persons in the target group.

  • inventoryItemCreateMissing: Create missing inventory items in the target group.

  • customTypeCreateMissing: Create missing custom types in the target group.

  • customFieldCreateMissing: Create missing custom fields in the target group.

  • attachmentCreateMissing: Create missing attachments in the target group.

These boolean options control whether the copy process is allowed to create missing entities in the target group instead of only mapping to entities that already exist.

source_key = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
source_url = "https://source.logs.com/sourceGroup"

target_key = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
target_url = "https://target.logs.com/targetGroup"

# create two logs instances (source and target LOGS)
copy = CopyProject(
    LOGS(source_url, source_key),
    LOGS(target_url, target_key),
    CopyParameters(projectCreateMissing=True, sampleCreateMissing=True, customFieldCreateMissing=True, customTypeCreateMissing=True),
)

copy.copyProjectContent(["MySourceProjectName"])