Skip to content

edsteva.utils.checks

MissingColumnError

Bases: Exception

Exception raised when a concept is missing

Source code in edsteva/utils/checks.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class MissingColumnError(Exception):
    """Exception raised when a concept is missing"""

    def __init__(
        self,
        required_columns: List,
        df_name: str = "",
    ):
        to_display_per_column = [f"- {column}" for column in required_columns]
        str_to_display = "\n".join(to_display_per_column)

        if df_name:
            df_name = f" {df_name} "
        message = (
            f"The{df_name}DataFrame is missing some columns, "
            "namely:\n"
            f"{str_to_display}"
        )

        super().__init__(message)

MissingTableError

Bases: Exception

Exception raised when a table is missing in the Data

Source code in edsteva/utils/checks.py
28
29
30
31
32
33
34
35
36
37
38
39
40
class MissingTableError(Exception):
    """Exception raised when a table is missing in the Data"""

    def __init__(
        self,
        required_tables: List,
    ):
        to_display_per_concept = [f"- {concept}" for concept in required_tables]
        str_to_display = "\n".join(to_display_per_concept)

        message = f"Data is missing some tables, namely:\n {str_to_display}"

        super().__init__(message)