utils.libutils.anonymizer.service

Module Contents

Classes

AnonymizerService

class utils.libutils.anonymizer.service.AnonymizerService
static is_valid_email(email: str) bool

Check if the given email is valid based on regex pattern.

Parameters:

email – str, email address to be checked

Returns:

bool, True if the email is valid, otherwise False

static is_valid_phone_number(phone_number: str) bool

Check if the given phone number is valid based on regex pattern.

Parameters:

phone_number – str, phone number to be checked

Returns:

bool, True if the phone number is valid, otherwise False

static is_valid_credit_card(credit_card_number: str) bool

Check if the given credit card number is valid based on regex pattern.

Parameters:

credit_card_number – str, credit card number to be checked

Returns:

bool, True if the credit card number is valid, otherwise False

static generate_random_email() str

Generate a random email address using predefined domains.

Returns:

str, generated random email address

static generate_random_phone_number(original_field: str) str

Generate a random phone number with country code if originally present.

Parameters:

original_field – str, original phone number field

Returns:

str, generated random phone number

static generate_random_credit_card() str

Generate a random credit card number.

Returns:

str, generated random credit card number

static copy_head(data_frame: pandas.DataFrame) pandas.DataFrame

Copy the head of a DataFrame.

Parameters:

data_frame – pd.DataFrame, the DataFrame to copy the head from

Returns:

pd.DataFrame, copied head of the DataFrame

static anonymize_dataframe_head(data_frame: pandas.DataFrame) pandas.DataFrame

Anonymize the head of a given DataFrame by replacing sensitive data.

Parameters:

data_frame – pd.DataFrame, the DataFrame to anonymize the head

Returns:

pd.DataFrame, anonymized head of the DataFrame