kmds.utils package

Submodules

kmds.utils.config_reader module

kmds.utils.config_reader.get_config(config_file_name: str) Dict[Any, Any]

Load the config file from the config directory, use the yaml library to return a dictionary configuration

Parameters:

config_file_name (str) – the name of the config file, this is the absolute path as a string

Returns:

The config file as a python dictionary - has keys for properties and values for corresponding settings

Return type:

Dict[Any, Any]

kmds.utils.load_utils module

kmds.utils.load_utils.format_records(records: List[KMObservation]) DataFrame

Format a list of observations into a dataframe for display

Parameters:

records (List[KMObservation]) – List of observations

Returns:

Dataframe containing the records

Return type:

DataFrame

kmds.utils.load_utils.get_workflow(onto: Ontology) Workflow

Given an ontology, return the workflow instance

Parameters:

onto (Ontology) – The ontology from which the workflow instance must be loaded

Returns:

The workflow in this ontology

Return type:

Workflow

kmds.utils.load_utils.load_data_rep_observations(onto: Ontology) DataFrame

Load the data representation observations from the provided ontology

Parameters:

onto (Ontology) – The ontology containing the data representation observations

Returns:

The list of data representation observations

Return type:

DataFrame

kmds.utils.load_utils.load_exp_observations(onto: Ontology) DataFrame

Return the exploratory data analysis observations from the ontology

Parameters:

onto (Ontology) – The ontology from which the EDA observations are to be returned

Returns:

List of EDA observations in the ontology

Return type:

DataFrame

kmds.utils.load_utils.load_kb(kb_location: str) Ontology

Load knowledge base. The user can verify the knowledge base path with check_valid_path() in path utils, the knowledge base can be a url, the onus of verifying that that the knowledgebase location is valid is on the caller of the method, this method does not verify the validity

Parameters:
  • kb_name (str) – the knowledge base to load

  • Returns – Ontology: Returns a previously created knowledge base

kmds.utils.load_utils.load_model_selection_observations(onto: Ontology) DataFrame

Load the model selection observations from the ontology

Parameters:

onto (Ontology) – The ontology containing the model selection observations

Returns:

The list of model selection observations

Return type:

DataFrame

kmds.utils.load_utils.load_modelling_choice_observations(onto: Ontology) DataFrame

Load the modelling choice observations from the ontology

Parameters:

onto (Ontology) – The ontology containing modelling choice observations

Returns:

The list of modelling choice observations in the ontology

Return type:

DataFrame

kmds.utils.load_utils.load_observations(onto: Ontology) DataFrame

Load all observations from the ontology.

This method calls all the load methods for the different observation types, for example load_exploratory_observations(), load_data_rep_observations(), etc., and concatenates them, and returns a single DataFrame.

Parameters:

onto (Ontology) – The ontology from which the observations are to be returned.

Returns:

A DataFrame containing all observations in the ontology.

Return type:

DataFrame

kmds.utils.path_utils module

kmds.utils.path_utils.check_valid_path(file_path: Path) bool

Check if a file exists at the provided path

Parameters:

file_path (Path) – The path to a file

Returns:

True if the file exists, else False

Return type:

bool

kmds.utils.path_utils.get_kb_dir() Path
kmds.utils.path_utils.get_kb_file_path(file_name: str) Path

Given a file name for a knowledge base, return the path to it as a Path

Parameters:

file_name (str) – the filename of the knowledge base

Returns:

the path corresponding to the provided file name

Return type:

Path

kmds.utils.path_utils.get_ontology_path() Path

Return the ontology file path as a Path

Returns:

the path to the ontology file

Return type:

Path

kmds.utils.path_utils.get_package_kb_path(kb_name: str) str

Backward-compatible alias for get_kb_file_path.

This keeps the original public API while avoiding duplicate logic.

Module contents

Utility package for KMDS helpers.