Validation

final_contacts = pd.read_csv('data/final_contacts.csv').fillna('')
final_contact_methods = pd.read_csv('data/final_contact_methods.csv').fillna('')
final_gifts = pd.read_csv('data/final_gifts.csv').fillna('')

Helpers


source

missing_no_required_fields

 missing_no_required_fields (df:pandas.core.frame.DataFrame, columns:list)

Validate that no required fields are missing in the dataframe



source

email_is_valid

 email_is_valid (s)

Validates an email address.



source

number_is_valid

 number_is_valid (s)

Validates a US phone number.



source

zip_is_valid

 zip_is_valid (p)

Validates a postal code.


Testing Column Names

Contacts Column Names


source

test_contacts_columns

 test_contacts_columns ()

Test that the final_contacts dataframe has the correct columns.


test_contacts_columns()

Gift Column Names


source

test_gifts_columns

 test_gifts_columns ()

Validate the columns of the final gifts dataframe


test_gifts_columns()

Contact Method Column Names


source

test_contact_method_columns

 test_contact_method_columns ()

Validate the columns of the final_contact_methods dataframe


test_contact_method_columns()

Validating Contacts Table

Validating Required Fields Are Not Missing


source

test_contact_required_fields

 test_contact_required_fields ()

Validate that all required fields are present in the final_contacts dataframe.


test_contact_required_fields()

Validating ContactType


source

test_contacts_contact_type

 test_contacts_contact_type ()

Validates that the ContactType column only contains the values ‘Household’ and ‘Organization’


test_contacts_contact_type()

Validating Email


source

test_contact_email

 test_contact_email ()

Validates that all emails are valid


test_contact_email()

Validating Phone Number


source

test_contact_phone_number_valid

 test_contact_phone_number_valid ()

Validate that all phone numbers are valid


test_contact_phone_number_valid()

Validating Postal


source

test_contact_valid_zip

 test_contact_valid_zip ()

Validates that all contacts have a valid zip code


test_contact_valid_zip()

Validating Deceased


source

test_contact_deceased

 test_contact_deceased ()

Validate that all contacts are either deceased or not deceased.


test_contact_deceased()

Validating Gifts

Validating Required Fields Are Not Missing


source

test_gift_required_fields

 test_gift_required_fields ()

Validate that all required fields are present in the gift data.


test_gift_required_fields()

Validating GiftType


source

test_gift_type

 test_gift_type ()

Test that all gift types are valid


test_gift_type()

Validating GiftAmount


source

test_gift_amount_is_float

 test_gift_amount_is_float ()

Test that the GiftAmount column is a float


test_gift_amount_is_float()

Validating CreditCardType


source

test_credit_card_type

 test_credit_card_type ()

Test that all credit card types are valid.


test_credit_card_type()

Validating PledgeId


source

test_gift_pledge_id

 test_gift_pledge_id ()

Test that the number of gifts is equal to the number of unique pledge IDs


test_gift_pledge_id()

Validating ContactMethods

Validating Required Fields Are Not Missing


source

test_contact_method_required_fields

 test_contact_method_required_fields ()


test_contact_method_required_fields()

Validating Type


source

test_contact_method_type

 test_contact_method_type ()

Test that all contact methods are one of the three types


test_contact_method_type()

Export

import nbdev
nbdev.nbdev_export('04_Test.ipynb')