Inspector#

class sdgx.data_models.inspectors.base.Inspector(inspect_level=None, *args, **kwargs)[source]#

Bases: object

Base Inspector class

Inspector is used to inspect data and generate metadata automatically.

Parameters:

ready (bool) – Ready to inspect, maybe all fields are fitted, or indicate if there is more data, inspector will be more precise.

_inspect_level: int = 10#

Private variable used to store property inspect_level’s value.

fit(raw_data: DataFrame, *args, **kwargs)[source]#

Fit the inspector.

Parameters:

raw_data (pd.DataFrame) – Raw data

inspect(*args, **kwargs) dict[str, Any][source]#

Inspect raw data and generate metadata.

property inspect_level#

the email column may be recognized as email, but it may also be recognized as the id column, and it may also be recognized by different inspectors at the same time identified as a discrete column, which will cause confusion in subsequent processing), the inspect_leve is used when determining the specific type of a column.

We will preset different inspector levels for different inspectors, usually more specific inspectors will get higher levels, and general inspectors (like discrete) will have inspect_level.

The value of the variable inspect_level is limited to 1-100. In baseclass and bool, discrete and numeric types, the inspect_level is set to 10. For datetime and id types, the inspect_level is set to 20.

Current inspect_level value will make it easier for developers to insert a custom inspector from the middle.

Type:

Inspected level is a concept newly introduced in version 0.1.6. Since a single column in the table may be marked by different inspectors at the same time (for example

pii = False#

PII refers if a column contains private or sensitive information.

ready: bool = False#

Indicates whether the inspector has completed its inference.

When completed, ready == True.