Dataset Report Notebook
With this notebook you can create a report on a data set as a pdf and html document.
The diagrams are displayed and the parameters of the data set. You can also display only a few parameters that you need. To do this, you can set them as parameter, as shown below.
If you choose to print the report, we recommend using Google Chrome for the best results.
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.GenerateDatasetReport.DatasetReportGenerator import DatasetReportGenerator
Parameters
Please set the parameters as you like.
target_path: Path, where the dataset should be stored, if None the directory of the script will be used as target path.
dataset_id: The id of the dataset for which the report will be created.
param_category: Dictionary which includes all needed categories. Please use the following format for the param_category:
{“Category name”: [“parameter1”, “parameter2”, …]} The category name has to be the name of the first category not of the subcategory.
If you want all of the parameters of the given category please use the following format: {“Category name”: []}
If the param_category is not set, the all of the categories will be in the report.
Filtering parameters of subcategories or their nested subcategories is not supported.
excluded_tracks: List with the names of the tracks which should be excluded in the report, if empty all tracks will be included.
separate_complex_plots: If True, the complex plots will be separated into real and imaginary parts. Default: True
Important: This classes uses absolute paths. To obtain the correct absolute path, you must ensure that the relative path is correct in relation to the directory in which the script is executed. If you are not sure, use the absolute path for target_path. If you want to use the directory of the script as target_path, than you don't have to set one.
target_path = "reports"
dataset_id = 1
param_category = {"Unit parameter":["Parameter 1", "Periodic table", "SI voltage"], "Kingdom": []} # Optional
excluded_tracks = ["one", "two"] # Optional
separate_complex_plots = True # Optional
Create a report for a specific dataset by ID
If you want to generate a report only for the dataset with the ID you specified earlier, use the code below. To generate reports for all datasets, please use the alternative code provided further down.
logs = LOGS()
datasets_report = DatasetReportGenerator(
logs=logs,
dataset_id=dataset_id,
target_path=target_path,
#param_category=param_category,
#excluded_tracks=excluded_tracks,
separate_complex_plots=separate_complex_plots,
)
datasets_report.create_datasets_report()
Create reports of all datasets
If the report is to be generated for all datasets, uncomment the entire cell below.
# logs = LOGS()
# def process_dataset(dataset):
# dataset_id = dataset.id
# try:
# datasets_report = DatasetReportGenerator(
# logs=logs,
# dataset_id=dataset_id,
# target_path=target_path,
# # excluded_tracks=excluded_tracks,
# # param_category=param_category,
# separate_complex_plots=separate_complex_plots,
# )
# datasets_report.create_datasets_report()
# except Exception as e:
# with open("failed_datasets_notebook.txt", "a") as f:
# f.write(f"{dataset_id}: {e}\n")
# for dataset in logs.datasets():
# process_dataset(dataset)