US Treasury OFAC lists from the Sanctions List Service (SLS):
ofac-sdn: the Specially Designated Nationals and Blocked Persons List (SDN), about 19,000 entries;ofac-cons: the Consolidated (non-SDN) list (SSI, FSE, NS-PLC, NS-MBS, CAPTA, NS-CMIC), a few hundred entries.
Format used: the legacy CSV files (SDN.CSV + ALT.CSV +
ADD.CSV + SDN_COMMENTS.CSV, and the CONS_* equivalents). Each
file fits Hot's default 16 MiB response cap (SDN.CSV is about
5.8 MB). They carry the id, name, type, programs, aliases and
addresses as columns; dates of birth and nationalities are parsed
from the Remarks column (DOB 10 Dec 1948; alt. DOB 1950; nationality Iran; ...). SDN.XML (29 MB) and the Advanced XML
(128 MB) exceed the default cap.
Versioning: SLS's file listing (POST /api/PublicationPreview/SdnList and .../ConsolidatedList) gives
each file's SHA-256 and publication date, so a refresh skips the
download when nothing changed.
Values
CSV_FIELD
CSV_FIELD: Str "(?:\"((?:[^\"]|\"\")*)\"|([^,\\r\\n]*))"
LISTS
LISTS: Map {
ofac-sdn: {
list: "OFAC SDN List",
manifest: "/api/PublicationPreview/SdnList",
primary: "SDN.CSV",
alt: "ALT.CSV",
add: "ADD.CSV",
comments: "SDN_COMMENTS.CSV"
},
ofac-cons: {
list: "OFAC Consolidated (non-SDN) List",
manifest: "/api/PublicationPreview/ConsolidatedList",
primary: "CONS_PRIM.CSV",
alt: "CONS_ALT.CSV",
add: "CONS_ADD.CSV",
comments: "CONS_COMMENTS.CSV"
}
}
SLS_BASE
SLS_BASE: Str "https://sanctionslistservice.ofac.treas.gov"
Functions
address-line
fn (row: Vec): Str
csv-value
fn (groups: Vec, i: Int): Str?
detail-url
fn (ent-num: Str): Str
The OFAC Sanctions List Search page for an entry.
entry-from-group
fn (source: Str, list: Str, group: Vec): Any
export-url
fn (file: Str): Str
The SLS download URL for an export file name (it redirects to a signed S3 URL).
fetch
fn (source: Str, known-version: Str?): Map
Download and parse one OFAC list. Returns {source, version, entries, published}. known-version (or null) is the version
already cached: when the manifest shows the same version, the files
are not downloaded and entries is null.
fetch-file
fn (file: Str, optional: Bool): Str
kind
fn (raw: Str?): Str
manifest
fn (source: Str): Map
The SLS file listing for "ofac-sdn" or "ofac-cons": a Map from
file name to {size, last-updated, sha256}.
parse
fn (source: Str, primary: Str, alt: Str, add: Str, comments: Str): Vec<::sanctions::entry/Entry>
Build Entry records from the four OFAC CSV texts (pure). source
is "ofac-sdn" or "ofac-cons"; alt, add and comments may
be "".
SDN.CSV columns: ent_num, SDN_Name, SDN_Type, Program, Title, Call_Sign, Vess_type, Tonnage, GRT, Vess_flag, Vess_owner, Remarks. ALT.CSV: ent_num, alt_num, alt_type, alt_name, alt_remarks. ADD.CSV: ent_num, add_num, address, city/state/postal, country, add_remarks. SDN_COMMENTS.CSV: ent_num, remarks continued.
parse-csv
fn (text: Str, n: Int): Vec<Vec>
Parse an OFAC legacy CSV file into rows of n values each. OFAC's
null marker -0- and blanks become null. The trailing 0x1A end
marker and blank lines are ignored.
Example
::sanctions::ofac/parse-csv("36,\"AEROCARIBBEAN AIRLINES\",-0- \r\n", 3)
// [["36", "AEROCARIBBEAN AIRLINES", null]]
parse-manifest
fn (files: Any): Map
Turn the SLS listing JSON (a Vec of {fileName, size, lastUpdated, hashCodes}, where hashCodes is itself a JSON string) into {file-name: {size, last-updated, sha256}}. Exposed for testing.
parse-remarks
fn (remarks: Str?): Map
Pull dates of birth and nationalities out of an OFAC Remarks value:
DOB / alt. DOB items (ISO-normalized), and nationality /
citizen items (as ISO country codes when known).
Example
::sanctions::ofac/parse-remarks("DOB 19 Jun 1951; POB Giza, Egypt; nationality Egypt.")
// {dobs: ["1951-06-19"], nationalities: ["EG"]}
programs
fn (raw: Str?): Vec<Str>
remark-items
fn (remarks: Str?): Vec<Str>
remark-values
fn (items: Vec<Str>, label: Str): Vec<Str>
row-pattern
fn (n: Int): Str
A multi-line regex matching one CSV row of n fields at the start of a line (quoted fields may contain commas and doubled quotes).
rows-of
fn (group: Vec, tag: Str): Vec<Vec>
tag-rows
fn (rows: Vec<Vec>, tag: Str): Vec
version
fn (source: Str, files: Map): Str?
A version string for a list from its SLS manifest: the SHA-256 of
the primary CSV (first 16 hex digits), or its lastUpdated when no
hash is listed. Null when the manifest has no entry for the file.