Checks if the input profile info matches a sanctioned entity. The arguments are the same as those of get_sanctioned_info.
It returns 1 if a match is found, otherwise 0.
Matches fields possibly available in addition to name and date of birth.
Returns a a hash-ref reporting the matched fields if it succeeeds; otherwise returns false (undef).
Tries to find a match a sanction entry matching the input profile args. It takes arguments in two forms. In the new API, it takes a hashref containing the following named arguments:
- first_name: first name
- last_name: last name
- date_of_birth: (optional) date of birth as a string or epoch
- place_of_birth: (optional) place of birth as a country name or code
- residence: (optional) name or code of the country of residence
- nationality: (optional) name or code of the country of nationality
- citizen: (optional) name or code of the country of citizenship
- postal_code: (optional) postal/zip code
- national_id: (optional) national ID number
- passport_no: (oiptonal) passort number
For backward compatibility it also supports the old API, taking the following args:
- first_name: first name
- last_name: last name
- date_of_birth: (optional) date of birth as a string or epoch
It returns a hash-ref containg the following data:
-
- matched: 1 if a match was found; 0 otherwise
-
- list: the source for the matched entry,
-
- matched_args: a name-value hash-ref of the similar arguments,
-
- comment: additional comments if necessary,
Indexes data by name. Each name may have multiple matching entries.
Data::Validate::Sanctions - Validate a name against sanctions lists
# as exported function
use Data::Validate::Sanctions qw/is_sanctioned get_sanction_file set_sanction_file/;
set_sanction_file('/var/storage/sanction.csv');
my ($first_name, $last_name) = ("First", "Last Name");
print 'BAD' if is_sanctioned($first_name, $last_name);
# as OO
use Data::Validate::Sanctions;
#You can also set sanction_file in the new method.
my $validator = Data::Validate::Sanctions->new(sanction_file => '/var/storage/sanction.csv');
print 'BAD' if $validator->is_sanctioned("$last_name $first_name");
Data::Validate::Sanctions is a simple validitor to validate a name against sanctions lists.
The list is from: - https://www.treasury.gov/ofac/downloads/sdn.csv, - https://www.treasury.gov/ofac/downloads/consolidated/cons_prim.csv - https://ofsistorage.blob.core.windows.net/publishlive/ConList.csv - https://webgate.ec.europa.eu/fsd/fsf/public/files/xmlFullSanctionsList_1_1/content?token=$eu_token
run update_sanctions_csv
to update the bundled csv.
The path of list can be set by function "set_sanction_file" or by method "new". If not set, then environment variable $ENV{SANCTION_FILE} will be checked, at last the default file in this package will be used.
is_sanctioned($last_name, $first_name);
is_sanctioned($first_name, $last_name);
is_sanctioned("$last_name $first_name");
when one string is passed, please be sure last_name is before first_name.
or you can pass first_name, last_name (last_name, first_name), we'll check both "$last_name $first_name" and "$first_name $last_name".
retrun 1 if match is found and 0 if match is not found.
It will remove all non-alpha chars and compare with the list we have.
my $result =get_sanctioned_info($last_name, $first_name, $date_of_birth);
print 'match: ', $result->{matched_args}->{name}, ' on list ', $result->{list} if $result->{matched};
return hashref with keys: matched 1 or 0, depends if name has matched list name of list matched (present only if matched) matched_args The list of arguments matched (name, date of birth, residence, etc.)
It will remove all non-alpha chars and compare with the list we have.
Fetches latest versions of sanction lists, and updates corresponding sections of stored file, if needed
Returns timestamp of when the latest list was updated. If argument is provided - return timestamp of when that list was updated.
Create the object, and set sanction_file
my $validator = Data::Validate::Sanctions->new(sanction_file => '/var/storage/sanction.csv');
get sanction_file which is used by "is_sanctioned" (procedure-oriented)
set sanction_file which is used by "is_sanctioned" (procedure-oriented)
Pass in the client's name and sanctioned individual's name to see if they are similar or not
Exports the sanction lists to a local file in YAML format.
Gets the sanction list content with lazy loading.
Binary.com [email protected]
Copyright 2014- Binary.com
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.