kevintyll-ofac 1.1.9 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +8 -1
- data/VERSION.yml +1 -1
- data/lib/ofac/models/ofac.rb +11 -3
- data/test/files/test_address_data_load.pip +2 -2
- data/test/files/valid_flattened_file.csv +4 -4
- data/test/ofac_test.rb +20 -12
- metadata +4 -3
data/History.txt
CHANGED
|
@@ -56,4 +56,11 @@
|
|
|
56
56
|
* 1 minor enhancement:
|
|
57
57
|
* Added a method, db_hit? for when your more concerned with speed than accuracy. db_hit? will retun true if there is an exact name match
|
|
58
58
|
in the ofac_sdn database. This method ignores address and city and does not produce a score.
|
|
59
|
-
Usage: Ofac.new({:name => 'Oscar Hernandez', :city => 'Clearwater', :address => '123 somewhere ln'}).db_hit?
|
|
59
|
+
Usage: Ofac.new({:name => 'Oscar Hernandez', :city => 'Clearwater', :address => '123 somewhere ln'}).db_hit?
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
== 1.1.10 2009-07-28
|
|
63
|
+
|
|
64
|
+
* 1 minor enhancement:
|
|
65
|
+
* Modified the select in OfacSdn to use the city to pull records from the database. This is another compromise to improve performance,
|
|
66
|
+
but still get a score. The db_hit? method is still faster, but this will still calculate a score for accuracy.
|
data/VERSION.yml
CHANGED
data/lib/ofac/models/ofac.rb
CHANGED
|
@@ -147,9 +147,17 @@ class Ofac
|
|
|
147
147
|
sql_alt_name_partial = name_array.collect {|partial_name| ["alternate_identity_name like ?", "%#{partial_name}%"]}
|
|
148
148
|
conditions = sql_name_partial + sql_alt_name_partial
|
|
149
149
|
conditions = conditions.transpose
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
unless @identity[:city].blank?
|
|
151
|
+
city_condition = ' and (city like ? or city is null)'
|
|
152
|
+
end
|
|
153
|
+
name_values = conditions.second
|
|
154
|
+
conditions = conditions.first.join(' or ')
|
|
155
|
+
conditions = "(#{conditions})"
|
|
156
|
+
conditions += city_condition if city_condition
|
|
157
|
+
condition_array = [conditions] + name_values
|
|
158
|
+
condition_array += ["%#{@identity[:city]}%"] if city_condition
|
|
159
|
+
|
|
160
|
+
possible_sdns = OfacSdn.find_all_by_sdn_type('individual',:select => 'name, alternate_identity_name, address, city', :conditions => condition_array)
|
|
153
161
|
possible_sdns = possible_sdns.collect {|sdn|{:name => "#{sdn['name']}|#{sdn['alternate_identity_name']}", :city => sdn['city'], :address => sdn['address']}}
|
|
154
162
|
|
|
155
163
|
match = OfacMatch.new({:name => {:weight => 60, :token => "#{name_array.join(' ')}"},
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
39|29|"Bal Harbour Shopping Center, Via Italia"|"Panama City"|"Panama"|-0-
|
|
6
6
|
41|41|"Avenida de Concha, Espina 8, E-28036"|"Madrid"|"Spain"|-0-
|
|
7
7
|
41|102|-0- |-0- |-0- |-0-
|
|
8
|
-
66|111|-0- |"
|
|
8
|
+
66|111|-0- |-0- |"Italy"|-0-
|
|
9
9
|
66|117|-0- |-0- |"Panama"|-0-
|
|
10
|
-
66|125|"1840 West 49th Street"
|
|
10
|
+
66|125|"1840 West 49th Street"|-0- |"United States"|-0-
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
``|`AEROTAXI EJECUTIVO, S.A.`|``|`CUBA`|``|``|``|``|``|``|``|``|`Bal Harbour Shopping Center, Via Italia`|`Panama City`|`Panama`|``|``|``|``|`2009-05-06 15:55:24`|`2009-05-06 15:55:24`
|
|
12
12
|
``|`AGENCIA DE VIAJES GUAMA`|``|`CUBA`|``|``|``|``|``|``|``|``|`Avenida de Concha, Espina 8, E-28036`|`Madrid`|`Spain`|``|`aka`|`NATIONAL BANK OF CUBA`|``|`2009-05-06 15:55:24`|`2009-05-06 15:55:24`
|
|
13
13
|
``|`AGENCIA DE VIAJES GUAMA`|``|`CUBA`|``|``|``|``|``|``|``|``|``|``|``|``|`aka`|`NATIONAL BANK OF CUBA`|``|`2009-05-06 15:55:24`|`2009-05-06 15:55:24`
|
|
14
|
-
``|`AGUIAR, Raul`|`individual`|`CUBA`|`Director, Banco Nacional de Cuba`|``|``|``|``|``|``|`; Director, Banco Nacional de Cuba
|
|
15
|
-
``|`AGUIAR, Raul`|`individual`|`CUBA`|`Director, Banco Nacional de Cuba`|``|``|``|``|``|``|`; Director, Banco Nacional de Cuba
|
|
14
|
+
``|`AGUIAR, Raul`|`individual`|`CUBA`|`Director, Banco Nacional de Cuba`|``|``|``|``|``|``|`; Director, Banco Nacional de Cuba.`|``|``|`Italy`|``|`aka`|`BNC`|``|`2009-05-06 15:55:24`|`2009-05-06 15:55:24`
|
|
15
|
+
``|`AGUIAR, Raul`|`individual`|`CUBA`|`Director, Banco Nacional de Cuba`|``|``|``|``|``|``|`; Director, Banco Nacional de Cuba.`|``|``|`Italy`|``|`aka`|`NATIONAL BANK OF CUBA`|``|`2009-05-06 15:55:24`|`2009-05-06 15:55:24`
|
|
16
16
|
``|`AGUIAR, Raul`|`individual`|`CUBA`|`Director, Banco Nacional de Cuba`|``|``|``|``|``|``|`; Director, Banco Nacional de Cuba.`|``|``|`Panama`|``|`aka`|`BNC`|``|`2009-05-06 15:55:24`|`2009-05-06 15:55:24`
|
|
17
17
|
``|`AGUIAR, Raul`|`individual`|`CUBA`|`Director, Banco Nacional de Cuba`|``|``|``|``|``|``|`; Director, Banco Nacional de Cuba.`|``|``|`Panama`|``|`aka`|`NATIONAL BANK OF CUBA`|``|`2009-05-06 15:55:24`|`2009-05-06 15:55:24`
|
|
18
|
-
``|`AGUIAR, Raul`|`individual`|`CUBA`|`Director, Banco Nacional de Cuba`|``|``|``|``|``|``|`; Director, Banco Nacional de Cuba.`|`1840 West 49th Street
|
|
19
|
-
``|`AGUIAR, Raul`|`individual`|`CUBA`|`Director, Banco Nacional de Cuba`|``|``|``|``|``|``|`; Director, Banco Nacional de Cuba.`|`1840 West 49th Street
|
|
18
|
+
``|`AGUIAR, Raul`|`individual`|`CUBA`|`Director, Banco Nacional de Cuba`|``|``|``|``|``|``|`; Director, Banco Nacional de Cuba.`|`1840 West 49th Street`|``|`United States`|``|`aka`|`BNC`|``|`2009-05-06 15:55:24`|`2009-05-06 15:55:24`
|
|
19
|
+
``|`AGUIAR, Raul`|`individual`|`CUBA`|`Director, Banco Nacional de Cuba`|``|``|``|``|``|``|`; Director, Banco Nacional de Cuba.`|`1840 West 49th Street`|``|`United States`|``|`aka`|`NATIONAL BANK OF CUBA`|``|`2009-05-06 15:55:24`|`2009-05-06 15:55:24`
|
data/test/ofac_test.rb
CHANGED
|
@@ -22,9 +22,6 @@ class OfacTest < Test::Unit::TestCase
|
|
|
22
22
|
assert_equal 0, Ofac.new({:name => 'Kevin T P'}).score
|
|
23
23
|
assert_equal 0, Ofac.new({:name => "O'Brian"}).score
|
|
24
24
|
assert_equal 0, Ofac.new({:name => {:first_name => 'Matthew',:last_name => "O'Brian"}}).score
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
should "give a score of 0 if there is no name match but there is an address and city match" do
|
|
28
25
|
assert_equal 0, Ofac.new({:name => 'Kevin', :address => '123 somewhere ln', :city => 'Clearwater'}).score
|
|
29
26
|
end
|
|
30
27
|
|
|
@@ -47,19 +44,15 @@ class OfacTest < Test::Unit::TestCase
|
|
|
47
44
|
assert_equal 60, Ofac.new({:name => {:last_name => 'Oscar'}}).score
|
|
48
45
|
end
|
|
49
46
|
|
|
50
|
-
should "deduct scores for non matches on address
|
|
47
|
+
should "deduct scores for non matches on address if data is in the database" do
|
|
51
48
|
#if there is data for address or city in the database, and that info is passed in, then 10%
|
|
52
|
-
#of the weight will be deducted if there is
|
|
49
|
+
#of the weight will be deducted if there is no match or sounds like match
|
|
53
50
|
|
|
54
|
-
#only name matches
|
|
55
|
-
assert_equal 56, Ofac.new({:name => 'Oscar Hernandez', :city => 'no match', :address => 'no match'}).score
|
|
56
|
-
#only name matches
|
|
57
|
-
assert_equal 56, Ofac.new({:name => 'Oscar Hernandez', :city => 'Las Vegas', :address => 'no match'}).score
|
|
58
51
|
#name and city match
|
|
59
52
|
assert_equal 89, Ofac.new({:name => 'Oscar Hernandez', :city => 'Clearwater', :address => 'no match'}).score
|
|
60
|
-
#
|
|
61
|
-
#score = 60 for name
|
|
62
|
-
assert_equal
|
|
53
|
+
#the record is pulled because clear is like clearwater, but it's not a match
|
|
54
|
+
#score = 60 for name - (30 * .1) for Clear = 57
|
|
55
|
+
assert_equal 57, Ofac.new({:name => 'Oscar Hernandez', :city => 'Clear'}).score
|
|
63
56
|
end
|
|
64
57
|
|
|
65
58
|
should "not deduct from score if no data for city or address is in the database" do
|
|
@@ -80,6 +73,20 @@ class OfacTest < Test::Unit::TestCase
|
|
|
80
73
|
assert_equal 90, Ofac.new({:name => 'Oscar Hernandez', :city => 'Clearwater'}).score
|
|
81
74
|
end
|
|
82
75
|
|
|
76
|
+
should "not find a match if the city does not match" do
|
|
77
|
+
assert_equal 0, Ofac.new({:name => 'Oscar Hernandez', :city => 'Tampa'}).score
|
|
78
|
+
#only name matches
|
|
79
|
+
assert_equal 0, Ofac.new({:name => 'Oscar Hernandez', :city => 'no match', :address => 'no match'}).score
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
should "find a match if the city is not passed in" do
|
|
83
|
+
assert_equal 60, Ofac.new({:name => 'Oscar Hernandez'}).score
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
should "find a match if the city is not in the database" do
|
|
87
|
+
assert_equal 60, Ofac.new({:name => 'Raul AGUIAR'}).score
|
|
88
|
+
end
|
|
89
|
+
|
|
83
90
|
should "give a score of 100 if there is a name and city and address match" do
|
|
84
91
|
assert_equal 100, Ofac.new({:name => 'Oscar Hernandez', :city => 'Clearwater', :address => '123 somewhere ln'}).score
|
|
85
92
|
end
|
|
@@ -141,5 +148,6 @@ class OfacTest < Test::Unit::TestCase
|
|
|
141
148
|
sdn = Ofac.new({:name => 'Oscar de la Hernandez', :city => 'bad city', :address => 'bad address'})
|
|
142
149
|
assert !sdn.db_hit?
|
|
143
150
|
end
|
|
151
|
+
|
|
144
152
|
end
|
|
145
153
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kevintyll-ofac
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kevin Tyll
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-07-
|
|
12
|
+
date: 2009-07-28 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
@@ -48,6 +48,7 @@ files:
|
|
|
48
48
|
- test/test_helper.rb
|
|
49
49
|
has_rdoc: true
|
|
50
50
|
homepage: http://github.com/kevintyll/ofac
|
|
51
|
+
licenses:
|
|
51
52
|
post_install_message: |-
|
|
52
53
|
For more information on ofac, see http://kevintyll.github.com/ofac/
|
|
53
54
|
|
|
@@ -79,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
79
80
|
requirements: []
|
|
80
81
|
|
|
81
82
|
rubyforge_project:
|
|
82
|
-
rubygems_version: 1.
|
|
83
|
+
rubygems_version: 1.3.5
|
|
83
84
|
signing_key:
|
|
84
85
|
specification_version: 2
|
|
85
86
|
summary: Attempts to find a hit on the Office of Foreign Assets Control's Specially Designated Nationals list.
|