Closed preritdas closed 1 month ago
The changes introduce a new class, DNCPhoneRemover
, which extends BaseValidator
. This class is responsible for filtering out mobile phone numbers from a list of MD5WithPII
objects that are marked as "do not call" (DNC). Additionally, a new test function, test_dnc_phone_remover
, has been added to validate the functionality of the DNCPhoneRemover
class, ensuring that it correctly handles various DNC statuses.
File | Change Summary |
---|---|
real_intent/validate/phone.py |
Added DNCPhoneRemover class and _validate method to filter out DNC mobile phone numbers. |
tests/test_validation.py |
Added test_dnc_phone_remover function to validate the functionality of the DNCPhoneRemover class. |
DNCPhoneRemover
class's functionality of filtering mobile phone numbers based on DNC status.In the meadow, phones do roam,
DNC whispers, "Leave them home."
A rabbit hops with glee and cheer,
Filtering calls, the path is clear.
With every number, we comply,
In the fields, our spirits fly! 🐇✨
real_intent/validate/phone.py (1)
`145-167`: **LGTM!** The `DNCPhoneRemover` class is a valuable addition that removes DNC phone numbers in-place without affecting the lead count. The implementation is clean, well-documented, and aligns with the stated purpose. Some key observations: - The class extends `BaseValidator`, following the existing validation pattern. - The `_validate` method correctly filters out phone numbers with `do_not_call` set to `True`. - The in-place modification of the `mobile_phones` attribute is an efficient approach. - The method returns the modified list of `MD5WithPII` objects, maintaining the original lead count. Overall, this class enhances the validation process by providing a mechanism to handle DNC compliance while preserving the lead data integrity.tests/test_validation.py (1)
`208-240`: **LGTM!** The `test_dnc_phone_remover` function provides comprehensive test coverage for the `DNCPhoneRemover` class. It covers various scenarios of DNC phone statuses and checks that the remover correctly retains or removes phones based on their DNC status. The test aligns with the PR objective of removing DNC phone numbers while retaining the leads. Great job!
Does not remove DNC leads, instead strips leads of DNC phone numbers in-place.
Useful for the FUB integration, as no DNC phone numbers are included without reducing the lead count.
Summary by CodeRabbit
New Features
DNCPhoneRemover
class to filter out mobile phone numbers marked as "do not call" from lists.Tests
DNCPhoneRemover
, ensuring compliance with DNC regulations.