TODO: Update the description, clarify the open questions for the InventoryScript, and implement the required changes after the clarifications

Statistic Notebook for Entities

The following statistics can be created with this notebook:

  • How many projects, samples and datasets were created per time unit (day, week, month, year).

    The statistics are output per

    • LOGS group

    • Person (or filtered by a specific person)

    • Instrument (or filtered by a specific person) (only for statistic of datasets)

    Plots are created showing the respective number per year, month, calendar week and day and written to a html. In addition, csv files are created with the respective information.

    For samples, the statistics on “prepared” and “discarded” are created for each person. For projects, statistics on “creted on” and “modified on” are created for each person.

    For the datasets the acquisition date is used. For the statistics of projects per group “created on” is used. For the statistcs of projects per person “created on” and “modified on” is used.

  • Which and how many experiments, projects and samples were created per instrument.

    A chart per instrument is created as a html.

Important: The statistics are only generated for a period between 21.09.1677 and 11.04.2262. All other data is excluded from the statistics.If only the “discarded” time or “modified on” time falls within the period, the date is only removed from the statistics for “discarded”/”modified on”.

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

import sys, os
sys.path.append(os.path.abspath("..")) # for local imports
from datetime import datetime

from LOGS import LOGS
from LOGS_solutions.GenerateStatistics.StatisticEntities.StatisticsDatasets import StatisticsDatasets
from LOGS_solutions.GenerateStatistics.StatisticEntities.StatisticsProjects import StatisticsProjects
from LOGS_solutions.GenerateStatistics.StatisticEntities.StatisticsSamples import StatisticsSamples
from LOGS_solutions.GenerateStatistics.StatisticEntities.StatisticsInventories import StatisticsInventories

Parameters

Please set the parameters as you like.

The following parameters are for all scripts:

  • target_path: The target path, where all statistics should be saved. Default: Within the folder containing the script, a new folder “statistics” is created in which all statistics are saved.

  • begin_date: Lowest date limit for statistics to be created. Has to be a datetime object. Statistics of datasets and instruments are filtered based on the dataset acquisition date. Statistics of projects are filtered basede on createdOn.
    Default: None (no limit)

  • end_date: Highest date limit for statistics to be created. Has to be a datetime object. Statistics of datasets and instruments are filtered based on the dataset acquisition date. Statistics of projects are filtered basede on createdOn.
    Default: None (no limit)

Specific Parameter for the statistics of datasets, projects and samples:

  • show_num_heatmap: Boolean if the number should be shown in the heatmap.
    Default: True

  • persons: List of persons for statistics. Has to be a list of the person ids. Please write 0 for “No person”. If the list is empty the statistics of all persons will be created.
    Default: []

Specific Parameter of the statistics of datasets and inventories:

  • inventory_items: List of ids of inventory_items which have to be included in the statistics. If the list is empty the statistics of all inventory_items in the given inventories will be created. Default: []

Specific Parameter for the statistics of datasets:

  • inventories: List of integers with the Inventory ids, which should be included in the statistic (for example the id of the inventory “instruments”)

Specific Parameter for the statistics of inventories:

  • inventory: The inventory id, which should be included in the statistic (for example the id of the inventory “instruments”)

  • cutoff: Only the statistics that correspond to >= the cut-off are displayed. The cutoff refers to the number of the respective entity. The cutoff must be an integer.
    Default: 0

## for all scripts
target_path = "./statistics"  
begin_date = datetime(2024, 1, 1) # begin_date example: datetime(2024, 1, 1)
end_date = datetime(2024, 2, 28) # end_date example: datetime(2024, 2, 28)

# datasets, projects, samples
show_num_heatmap = True
persons = []

# datasets only
inventories_datasets = [31] 
inventory_items_datasets = []

# insventories only
inventory_inventories = 2
inventory_items_inventories = ["Method"]
cutoff = 0

Initialize class objects

Please make sure that the logs.json config file is in the same folder as the other classes and the notebook.

If the formatting of the config file is not clear, refer to the instructions for help: https://docs.logs-python.com/pages/setup.html

The different classes do the following:

  • StatisticsDatasets: How many datasets were created per time unit for LOGS group, persons and instruments

  • StatisticsProjects: How many projects were created per time unit for LOGS group, persons

  • StatisticsSamples: How many samples were created per time unit for LOGS group, persons

  • StatisticsInstruments: Which and how many experiments, projects and samples were created per instrument

logs = LOGS()
statistics_dataset = StatisticsDatasets(logs, inventories_datasets, target_path, begin_date, end_date, show_num_heatmap, persons=persons, inventory_items=inventory_items_datasets)
statistics_projects = StatisticsProjects(logs, target_path, begin_date, end_date, show_num_heatmap, persons=persons)
statistics_samples = StatisticsSamples(logs, target_path, begin_date, end_date, show_num_heatmap, filtered_persons=persons)
statistics_inventories = StatisticsInventories(logs, inventory_inventories, target_path, begin_date, end_date, inventory_items=inventory_items_inventories, cutoff=cutoff)

Create Statistics

If you would like to create all statistics, simply complete the following section. If you only want to create one specific statistic, please comment out the others.

statistics_dataset.create_statistic()
statistics_projects.create_statistic()
statistics_samples.create_statistic()
statistics_inventories.create_statistic()
2026-02-13 14:23:05,651 - INFO - Starting to generate statistics for datasets.
2026-02-13 14:23:05,675 - INFO - Processing datasets in the given time frame: begin date: 2024-01-01 00:00:00 - end date: 2024-02-29 00:00:00.
2026-02-13 14:23:05,789 - INFO - Finished processing datasets.
2026-02-13 14:23:06,085 - WARNING - No data available for the statistic of datasets of inventory item of .
2026-02-13 14:23:06,406 - INFO - Finished generating statistics for datasets.
2026-02-13 14:23:06,407 - INFO - Starting to generate statistics for projects.
2026-02-13 14:23:06,415 - INFO - No projects found in the given time frame.
2026-02-13 14:23:06,416 - INFO - Starting to generate statistics for samples.
2026-02-13 14:23:06,430 - INFO - No samples found in the given time frame.
2026-02-13 14:23:06,465 - INFO - Processing inventory items.
Processing inventory item Test Instrument (ID: 269)...
Processing project name (ID: 110) for inventory item Test Instrument...
project id:  110  | project name:  name count:  0
dataset-project count:  0
Processing project nan (ID: 105) for inventory item Test Instrument...
project id:  105  | project name:  nan count:  0
dataset-project count:  0
Processing project project1 (ID: 1) for inventory item Test Instrument...
project id:  1  | project name:  project1 count:  0
dataset-project count:  0
Processing project project2 (ID: 2) for inventory item Test Instrument...
project id:  2  | project name:  project2 count:  0
dataset-project count:  0
Processing project project3 (ID: 3) for inventory item Test Instrument...
project id:  3  | project name:  project3 count:  0
dataset-project count:  0
Processing project Project4 (ID: 4) for inventory item Test Instrument...
project id:  4  | project name:  Project4 count:  0
dataset-project count:  0
Processing project Project C (ID: 108) for inventory item Test Instrument...
project id:  108  | project name:  Project C count:  0
dataset-project count:  0
Processing project Project D (ID: 109) for inventory item Test Instrument...
project id:  109  | project name:  Project D count:  0
dataset-project count:  0
Processing project Test Project (ID: 100) for inventory item Test Instrument...
project id:  100  | project name:  Test Project count:  0
dataset-project count:  0
Processing inventory item TestInv A (ID: 474)...
Processing project name (ID: 110) for inventory item TestInv A...
project id:  110  | project name:  name count:  0
dataset-project count:  0
Processing project nan (ID: 105) for inventory item TestInv A...
project id:  105  | project name:  nan count:  0
dataset-project count:  0
Processing project project1 (ID: 1) for inventory item TestInv A...
project id:  1  | project name:  project1 count:  0
dataset-project count:  0
Processing project project2 (ID: 2) for inventory item TestInv A...
project id:  2  | project name:  project2 count:  0
dataset-project count:  0
Processing project project3 (ID: 3) for inventory item TestInv A...
project id:  3  | project name:  project3 count:  0
dataset-project count:  0
Processing project Project4 (ID: 4) for inventory item TestInv A...
project id:  4  | project name:  Project4 count:  0
dataset-project count:  0
Processing project Project C (ID: 108) for inventory item TestInv A...
project id:  108  | project name:  Project C count:  0
dataset-project count:  0
Processing project Project D (ID: 109) for inventory item TestInv A...
project id:  109  | project name:  Project D count:  0
dataset-project count:  0
Processing project Test Project (ID: 100) for inventory item TestInv A...
project id:  100  | project name:  Test Project count:  0
dataset-project count:  0
Processing inventory item TestInv B (ID: 475)...
Processing project name (ID: 110) for inventory item TestInv B...
project id:  110  | project name:  name count:  0
dataset-project count:  0
Processing project nan (ID: 105) for inventory item TestInv B...
project id:  105  | project name:  nan count:  0
dataset-project count:  0
Processing project project1 (ID: 1) for inventory item TestInv B...
project id:  1  | project name:  project1 count:  0
dataset-project count:  0
Processing project project2 (ID: 2) for inventory item TestInv B...
project id:  2  | project name:  project2 count:  0
dataset-project count:  0
Processing project project3 (ID: 3) for inventory item TestInv B...
project id:  3  | project name:  project3 count:  0
dataset-project count:  0
Processing project Project4 (ID: 4) for inventory item TestInv B...
project id:  4  | project name:  Project4 count:  0
dataset-project count:  0
Processing project Project C (ID: 108) for inventory item TestInv B...
project id:  108  | project name:  Project C count:  0
dataset-project count:  0
Processing project Project D (ID: 109) for inventory item TestInv B...
project id:  109  | project name:  Project D count:  0
dataset-project count:  0
Processing project Test Project (ID: 100) for inventory item TestInv B...
project id:  100  | project name:  Test Project count:  0
dataset-project count:  0
Processing inventory item TestInv A (ID: 477)...
Processing project name (ID: 110) for inventory item TestInv A...
project id:  110  | project name:  name count:  0
dataset-project count:  0
Processing project nan (ID: 105) for inventory item TestInv A...
project id:  105  | project name:  nan count:  0
dataset-project count:  0
Processing project project1 (ID: 1) for inventory item TestInv A...
project id:  1  | project name:  project1 count:  0
dataset-project count:  0
Processing project project2 (ID: 2) for inventory item TestInv A...
project id:  2  | project name:  project2 count:  0
dataset-project count:  0
Processing project project3 (ID: 3) for inventory item TestInv A...
project id:  3  | project name:  project3 count:  0
dataset-project count:  0
Processing project Project4 (ID: 4) for inventory item TestInv A...
project id:  4  | project name:  Project4 count:  0
dataset-project count:  0
Processing project Project C (ID: 108) for inventory item TestInv A...
project id:  108  | project name:  Project C count:  0
dataset-project count:  0
Processing project Project D (ID: 109) for inventory item TestInv A...
project id:  109  | project name:  Project D count:  0
dataset-project count:  0
Processing project Test Project (ID: 100) for inventory item TestInv A...
project id:  100  | project name:  Test Project count:  0
dataset-project count:  0
Processing inventory item TestInv B (ID: 478)...
Processing project name (ID: 110) for inventory item TestInv B...
project id:  110  | project name:  name count:  0
dataset-project count:  0
Processing project nan (ID: 105) for inventory item TestInv B...
project id:  105  | project name:  nan count:  0
dataset-project count:  0
Processing project project1 (ID: 1) for inventory item TestInv B...
project id:  1  | project name:  project1 count:  0
dataset-project count:  0
Processing project project2 (ID: 2) for inventory item TestInv B...
project id:  2  | project name:  project2 count:  0
dataset-project count:  0
Processing project project3 (ID: 3) for inventory item TestInv B...
project id:  3  | project name:  project3 count:  0
dataset-project count:  0
Processing project Project4 (ID: 4) for inventory item TestInv B...
project id:  4  | project name:  Project4 count:  0
dataset-project count:  0
Processing project Project C (ID: 108) for inventory item TestInv B...
project id:  108  | project name:  Project C count:  0
dataset-project count:  0
Processing project Project D (ID: 109) for inventory item TestInv B...
project id:  109  | project name:  Project D count:  0
dataset-project count:  0
Processing project Test Project (ID: 100) for inventory item TestInv B...
project id:  100  | project name:  Test Project count:  0
dataset-project count:  0
Processing inventory item TestInv A (ID: 480)...
Processing project name (ID: 110) for inventory item TestInv A...
project id:  110  | project name:  name count:  0
dataset-project count:  0
Processing project nan (ID: 105) for inventory item TestInv A...
project id:  105  | project name:  nan count:  0
dataset-project count:  0
Processing project project1 (ID: 1) for inventory item TestInv A...
project id:  1  | project name:  project1 count:  0
dataset-project count:  0
Processing project project2 (ID: 2) for inventory item TestInv A...
project id:  2  | project name:  project2 count:  0
dataset-project count:  0
Processing project project3 (ID: 3) for inventory item TestInv A...
project id:  3  | project name:  project3 count:  0
dataset-project count:  0
Processing project Project4 (ID: 4) for inventory item TestInv A...
project id:  4  | project name:  Project4 count:  0
dataset-project count:  0
Processing project Project C (ID: 108) for inventory item TestInv A...
project id:  108  | project name:  Project C count:  0
dataset-project count:  0
Processing project Project D (ID: 109) for inventory item TestInv A...
project id:  109  | project name:  Project D count:  0
dataset-project count:  0
Processing project Test Project (ID: 100) for inventory item TestInv A...
project id:  100  | project name:  Test Project count:  0
dataset-project count:  0
Processing inventory item TestInv B (ID: 481)...
Processing project name (ID: 110) for inventory item TestInv B...
project id:  110  | project name:  name count:  0
dataset-project count:  0
Processing project nan (ID: 105) for inventory item TestInv B...
project id:  105  | project name:  nan count:  0
dataset-project count:  0
Processing project project1 (ID: 1) for inventory item TestInv B...
project id:  1  | project name:  project1 count:  0
dataset-project count:  0
Processing project project2 (ID: 2) for inventory item TestInv B...
project id:  2  | project name:  project2 count:  0
dataset-project count:  0
Processing project project3 (ID: 3) for inventory item TestInv B...
project id:  3  | project name:  project3 count:  0
dataset-project count:  0
Processing project Project4 (ID: 4) for inventory item TestInv B...
project id:  4  | project name:  Project4 count:  0
dataset-project count:  0
Processing project Project C (ID: 108) for inventory item TestInv B...
project id:  108  | project name:  Project C count:  0
dataset-project count:  0
Processing project Project D (ID: 109) for inventory item TestInv B...
project id:  109  | project name:  Project D count:  0
dataset-project count:  0
Processing project Test Project (ID: 100) for inventory item TestInv B...
project id:  100  | project name:  Test Project count:  0
dataset-project count:  0
Processing inventory item TestInv A (ID: 483)...
Processing project name (ID: 110) for inventory item TestInv A...
project id:  110  | project name:  name count:  0
dataset-project count:  0
Processing project nan (ID: 105) for inventory item TestInv A...
project id:  105  | project name:  nan count:  0
dataset-project count:  0
Processing project project1 (ID: 1) for inventory item TestInv A...
project id:  1  | project name:  project1 count:  0
dataset-project count:  0
Processing project project2 (ID: 2) for inventory item TestInv A...
project id:  2  | project name:  project2 count:  0
dataset-project count:  0
Processing project project3 (ID: 3) for inventory item TestInv A...
project id:  3  | project name:  project3 count:  0
dataset-project count:  0
Processing project Project4 (ID: 4) for inventory item TestInv A...
project id:  4  | project name:  Project4 count:  0
dataset-project count:  0
Processing project Project C (ID: 108) for inventory item TestInv A...
project id:  108  | project name:  Project C count:  0
dataset-project count:  0
Processing project Project D (ID: 109) for inventory item TestInv A...
project id:  109  | project name:  Project D count:  0
dataset-project count:  0
Processing project Test Project (ID: 100) for inventory item TestInv A...
project id:  100  | project name:  Test Project count:  0
dataset-project count:  0
Processing inventory item TestInv B (ID: 484)...
Processing project name (ID: 110) for inventory item TestInv B...
project id:  110  | project name:  name count:  0
dataset-project count:  0
Processing project nan (ID: 105) for inventory item TestInv B...
project id:  105  | project name:  nan count:  0
dataset-project count:  0
Processing project project1 (ID: 1) for inventory item TestInv B...
project id:  1  | project name:  project1 count:  0
dataset-project count:  0
Processing project project2 (ID: 2) for inventory item TestInv B...
project id:  2  | project name:  project2 count:  0
dataset-project count:  0
Processing project project3 (ID: 3) for inventory item TestInv B...
project id:  3  | project name:  project3 count:  0
dataset-project count:  0
Processing project Project4 (ID: 4) for inventory item TestInv B...
project id:  4  | project name:  Project4 count:  0
dataset-project count:  0
Processing project Project C (ID: 108) for inventory item TestInv B...
project id:  108  | project name:  Project C count:  0
dataset-project count:  0
Processing project Project D (ID: 109) for inventory item TestInv B...
project id:  109  | project name:  Project D count:  0
dataset-project count:  0
Processing project Test Project (ID: 100) for inventory item TestInv B...
project id:  100  | project name:  Test Project count:  0
dataset-project count:  0
2026-02-13 14:23:07,995 - INFO - Finished processing inventory Instrument.
Total amount of inventory items in Instrument:  9
Creating inventory statistics...
Creating plots for instruments...
Creating statistic for instrument Test Instrument (ID: 269)...
Creating statistic for instrument TestInv A (ID: 474)...
Creating statistic for instrument TestInv B (ID: 475)...
Creating statistic for instrument TestInv A (ID: 477)...
Creating statistic for instrument TestInv B (ID: 478)...
Creating statistic for instrument TestInv A (ID: 480)...
Creating statistic for instrument TestInv B (ID: 481)...
Creating statistic for instrument TestInv A (ID: 483)...
Creating statistic for instrument TestInv B (ID: 484)...
Inventory path:  /home/zischka/Documents/logs-py-public-solutions/logs-py-solutions-public/examples/GenerateStatistics/statistics/inventory
2026-02-13 14:23:08,379 - INFO - Finished generating statistics for inventory items.