config

Creastes a hash-ref of sanction source configuration, including their url, description and parser callback. It accepts the following list of named args:

-eu_token: required if eu_url is empty

The token required for accessing EU sanctions (usually added as an arg to URL).

<eu_url>: required if eu_token is empty

EU Sanctions full url, token included.

ofac_sdn_url: optional

OFAC-SDN download url.

ofac_consolidated_url: optional

OFAC Consilidated download url.

hmt_url: optional

MHT Sanctions download url.

get_country_code

If the arg is a country code, it's returned in lower case; otherwise the arg is converted to country code.

_process_sanction_entry

Processes an entry retrieved from sanction resources and saves it into the specified key-value dataset. An entry may have multilpe names (aliases), each of which will be taken as a key in the dataset with the same values/info.

It takes following list of args:

- dataset: A hash ref of form [ name => info ] in which the entry will be saved
- data: a hash of entry data that may contain:
  • name: an array of names/aliases

  • date_of_birth: an array of dates of birth

    Dates of birth are not of standardized format in some data sources; so they are processed in three steps: 1- as a first step it will be tried to converetd them into epoch, saved as dob_epoch; 2- otherwise to extract year (or an array of years) of birth, saved as dob_year; and 3- finally, to saved as raw text in dob_text.

  • place_of_birth: an array of country names or codes

  • residence: an array of country names or codes

  • nationality: an array of country names or codes

  • citizen: an array of country names or codes

  • postal_code: an array of postal/zip codes

  • national_id: an array of national ID numbers

  • passport_no: an array of passort numbers

run

Fetches latest version of lists, and returns combined hash of successfully downloaded ones

_entries_from_file

Get the sanction entries from a file locally

_entries_from_remote_src

Get the sanction entries from a remote source includes retry mechanism

_epoch_to_date

Converts an epoch timestamp to a date string in YYYY-MM-DD format.

my $date = $fetcher->_epoch_to_date(1672444800);

_clean_url

Removes specific query parameters from a URL.

my $clean_url = $fetcher->_clean_url($url);

_create_hash

Converts the data to a string and creates a SHA-256 hash.

my $hash = $fetcher->create_hash($data);