ofac 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/VERSION.yml +2 -1
- data/generators/ofac_migration/.DS_Store +0 -0
- data/generators/ofac_migration/templates/.DS_Store +0 -0
- data/lib/ofac/models/ofac_sdn.rb +1 -1
- data/lib/ofac/models/ofac_sdn_loader.rb +1 -1
- data/nbproject/project.properties +7 -0
- data/nbproject/project.xml +15 -0
- data/ofac.gemspec +57 -58
- data/pkg/ofac-0.1.0.gem +0 -0
- data/pkg/ofac-1.0.0.gem +0 -0
- data/rdoc/classes/Ofac.html +411 -0
- data/rdoc/classes/OfacMatch.html +239 -0
- data/rdoc/classes/OfacSdn.html +111 -0
- data/rdoc/classes/OfacSdnLoader.html +181 -0
- data/rdoc/classes/String.html +207 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/README_rdoc.html +317 -0
- data/rdoc/files/lib/ofac/models/ofac_rb.html +101 -0
- data/rdoc/files/lib/ofac/models/ofac_sdn_loader_rb.html +110 -0
- data/rdoc/files/lib/ofac/models/ofac_sdn_rb.html +108 -0
- data/rdoc/files/lib/ofac/ofac_match_rb.html +101 -0
- data/rdoc/files/lib/ofac/ruby_string_extensions_rb.html +101 -0
- data/rdoc/files/lib/ofac_rb.html +113 -0
- data/rdoc/fr_class_index.html +31 -0
- data/rdoc/fr_file_index.html +33 -0
- data/rdoc/fr_method_index.html +35 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- metadata +6 -7
- data/.gitignore +0 -6
data/History.txt
CHANGED
data/VERSION.yml
CHANGED
Binary file
|
Binary file
|
data/lib/ofac/models/ofac_sdn.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project xmlns="http://www.netbeans.org/ns/project/1">
|
3
|
+
<type>org.netbeans.modules.ruby.rubyproject</type>
|
4
|
+
<configuration>
|
5
|
+
<data xmlns="http://www.netbeans.org/ns/ruby-project/1">
|
6
|
+
<name>ofac</name>
|
7
|
+
<source-roots>
|
8
|
+
<root id="src.dir"/>
|
9
|
+
</source-roots>
|
10
|
+
<test-roots>
|
11
|
+
<root id="test.src.dir"/>
|
12
|
+
</test-roots>
|
13
|
+
</data>
|
14
|
+
</configuration>
|
15
|
+
</project>
|
data/ofac.gemspec
CHANGED
@@ -1,72 +1,71 @@
|
|
1
1
|
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ofac}
|
8
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kevin Tyll"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-21}
|
13
13
|
s.description = %q{Attempts to find a hit on the Office of Foreign Assets Control's Specially Designated Nationals list.}
|
14
14
|
s.email = %q{kevintyll@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
"test/test_helper.rb"
|
21
|
+
"History.txt",
|
22
|
+
"LICENSE",
|
23
|
+
"PostInstall.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION.yml",
|
27
|
+
"generators/ofac_migration/.DS_Store",
|
28
|
+
"generators/ofac_migration/ofac_migration_generator.rb",
|
29
|
+
"generators/ofac_migration/templates/.DS_Store",
|
30
|
+
"generators/ofac_migration/templates/migration.rb",
|
31
|
+
"lib/ofac.rb",
|
32
|
+
"lib/ofac/models/ofac.rb",
|
33
|
+
"lib/ofac/models/ofac_sdn.rb",
|
34
|
+
"lib/ofac/models/ofac_sdn_loader.rb",
|
35
|
+
"lib/ofac/ofac_match.rb",
|
36
|
+
"lib/ofac/ruby_string_extensions.rb",
|
37
|
+
"lib/tasks/ofac.rake",
|
38
|
+
"nbproject/project.properties",
|
39
|
+
"nbproject/project.xml",
|
40
|
+
"ofac.gemspec",
|
41
|
+
"pkg/ofac-0.1.0.gem",
|
42
|
+
"pkg/ofac-1.0.0.gem",
|
43
|
+
"rdoc/classes/Ofac.html",
|
44
|
+
"rdoc/classes/OfacMatch.html",
|
45
|
+
"rdoc/classes/OfacSdn.html",
|
46
|
+
"rdoc/classes/OfacSdnLoader.html",
|
47
|
+
"rdoc/classes/String.html",
|
48
|
+
"rdoc/created.rid",
|
49
|
+
"rdoc/files/README_rdoc.html",
|
50
|
+
"rdoc/files/lib/ofac/models/ofac_rb.html",
|
51
|
+
"rdoc/files/lib/ofac/models/ofac_sdn_loader_rb.html",
|
52
|
+
"rdoc/files/lib/ofac/models/ofac_sdn_rb.html",
|
53
|
+
"rdoc/files/lib/ofac/ofac_match_rb.html",
|
54
|
+
"rdoc/files/lib/ofac/ruby_string_extensions_rb.html",
|
55
|
+
"rdoc/files/lib/ofac_rb.html",
|
56
|
+
"rdoc/fr_class_index.html",
|
57
|
+
"rdoc/fr_file_index.html",
|
58
|
+
"rdoc/fr_method_index.html",
|
59
|
+
"rdoc/index.html",
|
60
|
+
"rdoc/rdoc-style.css",
|
61
|
+
"test/files/test_address_data_load.pip",
|
62
|
+
"test/files/test_alt_data_load.pip",
|
63
|
+
"test/files/test_sdn_data_load.pip",
|
64
|
+
"test/files/valid_flattened_file.csv",
|
65
|
+
"test/mocks/test/ofac_sdn_loader.rb",
|
66
|
+
"test/ofac_sdn_loader_test.rb",
|
67
|
+
"test/ofac_test.rb",
|
68
|
+
"test/test_helper.rb"
|
70
69
|
]
|
71
70
|
s.homepage = %q{http://github.com/kevintyll/ofac}
|
72
71
|
s.post_install_message = %q{For more information on ofac, see http://kevintyll.github.com/ofac/
|
@@ -80,15 +79,14 @@ Gem::Specification.new do |s|
|
|
80
79
|
|
81
80
|
* The OFAC data is not updated with any regularity, but you can sign up for email notifications when the data changes at
|
82
81
|
http://www.treas.gov/offices/enforcement/ofac/sdn/index.shtml.}
|
83
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
84
82
|
s.require_paths = ["lib"]
|
85
83
|
s.rubygems_version = %q{1.3.6}
|
86
84
|
s.summary = %q{Attempts to find a hit on the Office of Foreign Assets Control's Specially Designated Nationals list.}
|
87
85
|
s.test_files = [
|
86
|
+
"test/mocks/test/ofac_sdn_loader.rb",
|
88
87
|
"test/ofac_sdn_loader_test.rb",
|
89
|
-
|
90
|
-
|
91
|
-
"test/mocks/test/ofac_sdn_loader.rb"
|
88
|
+
"test/ofac_test.rb",
|
89
|
+
"test/test_helper.rb"
|
92
90
|
]
|
93
91
|
|
94
92
|
if s.respond_to? :specification_version then
|
@@ -101,3 +99,4 @@ Gem::Specification.new do |s|
|
|
101
99
|
else
|
102
100
|
end
|
103
101
|
end
|
102
|
+
|
data/pkg/ofac-0.1.0.gem
ADDED
Binary file
|
data/pkg/ofac-1.0.0.gem
ADDED
Binary file
|
@@ -0,0 +1,411 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Ofac</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Ofac</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/ofac/models/ofac_rb.html">
|
59
|
+
lib/ofac/models/ofac.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000007">db_hit?</a>
|
90
|
+
<a href="#M000005">new</a>
|
91
|
+
<a href="#M000008">possible_hits</a>
|
92
|
+
<a href="#M000006">score</a>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
<div id="section">
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
<!-- if method_list -->
|
111
|
+
<div id="methods">
|
112
|
+
<h3 class="section-bar">Public Class methods</h3>
|
113
|
+
|
114
|
+
<div id="method-M000005" class="method-detail">
|
115
|
+
<a name="M000005"></a>
|
116
|
+
|
117
|
+
<div class="method-heading">
|
118
|
+
<a href="#M000005" class="method-signature">
|
119
|
+
<span class="method-name">new</span><span class="method-args">(identity)</span>
|
120
|
+
</a>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
<div class="method-description">
|
124
|
+
<p>
|
125
|
+
Accepts a hash with the identity‘s demographic information
|
126
|
+
</p>
|
127
|
+
<pre>
|
128
|
+
Ofac.new({:name => 'Oscar Hernandez', :city => 'Clearwater', :address => '123 somewhere ln'})
|
129
|
+
</pre>
|
130
|
+
<p>
|
131
|
+
<tt>:name</tt> is required to get a <a href="Ofac.html#M000006">score</a>.
|
132
|
+
If <tt>:name</tt> is missing, an error will not be thrown, but a <a
|
133
|
+
href="Ofac.html#M000006">score</a> of 0 will be returned.
|
134
|
+
</p>
|
135
|
+
<p>
|
136
|
+
You can pass a string in for the full name:
|
137
|
+
</p>
|
138
|
+
<pre>
|
139
|
+
Ofac.new(:name => 'Victor De La Garza')
|
140
|
+
</pre>
|
141
|
+
<p>
|
142
|
+
Or you can specify the last and first names
|
143
|
+
</p>
|
144
|
+
<pre>
|
145
|
+
Ofac.new(:name => {:first_name => 'Victor', :last_name => 'De La Garza'})
|
146
|
+
</pre>
|
147
|
+
<p>
|
148
|
+
The first method will build a larger list of names for ruby to parse
|
149
|
+
through and more likely to find similar names. The second method is
|
150
|
+
quicker.
|
151
|
+
</p>
|
152
|
+
<p>
|
153
|
+
The more information provided, the higher the <a
|
154
|
+
href="Ofac.html#M000006">score</a> could be. A <a
|
155
|
+
href="Ofac.html#M000006">score</a> of 100 would mean all fields were passed
|
156
|
+
in, and all fields were 100% matches. If only the name is passed in without
|
157
|
+
an address, it will be impossible to get a <a
|
158
|
+
href="Ofac.html#M000006">score</a> of 100, even if the name matches
|
159
|
+
perfectly.
|
160
|
+
</p>
|
161
|
+
<p>
|
162
|
+
Acceptable hash keys and their weighting in <a
|
163
|
+
href="Ofac.html#M000006">score</a> calculation:
|
164
|
+
</p>
|
165
|
+
<ul>
|
166
|
+
<li><tt>:name</tt> (weighting = 60%) (required) This can be a person, business,
|
167
|
+
or marine vessel
|
168
|
+
|
169
|
+
</li>
|
170
|
+
<li><tt>:address</tt> (weighting = 10%)
|
171
|
+
|
172
|
+
</li>
|
173
|
+
<li><tt>:city</tt> (weighting = 30%)
|
174
|
+
|
175
|
+
</li>
|
176
|
+
</ul>
|
177
|
+
<p><a class="source-toggle" href="#"
|
178
|
+
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
179
|
+
<div class="method-source-code" id="M000005-source">
|
180
|
+
<pre>
|
181
|
+
<span class="ruby-comment cmt"># File lib/ofac/models/ofac.rb, line 28</span>
|
182
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">identity</span>)
|
183
|
+
<span class="ruby-ivar">@identity</span> = <span class="ruby-identifier">identity</span>
|
184
|
+
<span class="ruby-keyword kw">end</span>
|
185
|
+
</pre>
|
186
|
+
</div>
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
191
|
+
|
192
|
+
<div id="method-M000007" class="method-detail">
|
193
|
+
<a name="M000007"></a>
|
194
|
+
|
195
|
+
<div class="method-heading">
|
196
|
+
<a href="#M000007" class="method-signature">
|
197
|
+
<span class="method-name">db_hit?</span><span class="method-args">()</span>
|
198
|
+
</a>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<div class="method-description">
|
202
|
+
<p><a class="source-toggle" href="#"
|
203
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
204
|
+
<div class="method-source-code" id="M000007-source">
|
205
|
+
<pre>
|
206
|
+
<span class="ruby-comment cmt"># File lib/ofac/models/ofac.rb, line 89</span>
|
207
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">db_hit?</span>
|
208
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@identity</span>[<span class="ruby-identifier">:name</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">blank?</span>
|
209
|
+
|
210
|
+
<span class="ruby-comment cmt">#first get a list from the database of possible matches by name</span>
|
211
|
+
<span class="ruby-comment cmt">#this query is pretty liberal, we just want to get a list of possible</span>
|
212
|
+
<span class="ruby-comment cmt">#matches from the database that we can run through our ruby matching algorithm</span>
|
213
|
+
<span class="ruby-identifier">possible_sdns</span> = []
|
214
|
+
<span class="ruby-identifier">name_array</span> = <span class="ruby-identifier">process_name</span>
|
215
|
+
|
216
|
+
<span class="ruby-identifier">name_array</span>.<span class="ruby-identifier">delete_if</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">n</span><span class="ruby-operator">|</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator"><</span> <span class="ruby-value">2</span>}
|
217
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">name_array</span>.<span class="ruby-identifier">empty?</span>
|
218
|
+
<span class="ruby-identifier">sql_name_partial</span> = <span class="ruby-identifier">name_array</span>.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">partial_name</span><span class="ruby-operator">|</span> [<span class="ruby-value str">"name like ?"</span>, <span class="ruby-node">"%#{partial_name}%"</span>]}
|
219
|
+
<span class="ruby-identifier">sql_alt_name_partial</span> = <span class="ruby-identifier">name_array</span>.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">partial_name</span><span class="ruby-operator">|</span> [<span class="ruby-value str">"alternate_identity_name like ?"</span>, <span class="ruby-node">"%#{partial_name}%"</span>]}
|
220
|
+
|
221
|
+
<span class="ruby-identifier">name_conditions</span> = <span class="ruby-identifier">sql_name_partial</span>.<span class="ruby-identifier">transpose</span>
|
222
|
+
<span class="ruby-identifier">name_values</span> = <span class="ruby-identifier">name_conditions</span>.<span class="ruby-identifier">second</span>
|
223
|
+
<span class="ruby-identifier">name_conditions</span> = [<span class="ruby-identifier">name_conditions</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' and '</span>)]
|
224
|
+
<span class="ruby-identifier">alt_name_conditions</span> = <span class="ruby-identifier">sql_alt_name_partial</span>.<span class="ruby-identifier">transpose</span>
|
225
|
+
<span class="ruby-identifier">alt_name_values</span> = <span class="ruby-identifier">alt_name_conditions</span>.<span class="ruby-identifier">second</span>
|
226
|
+
<span class="ruby-identifier">alt_name_conditions</span> = [<span class="ruby-identifier">alt_name_conditions</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' and '</span>)]
|
227
|
+
<span class="ruby-identifier">conditions</span> = [<span class="ruby-node">"(#{name_conditions}) or (#{alt_name_conditions})"</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">name_values</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">alt_name_values</span>
|
228
|
+
|
229
|
+
<span class="ruby-identifier">possible_sdns</span> = <span class="ruby-constant">OfacSdn</span>.<span class="ruby-identifier">find_all_by_sdn_type</span>(<span class="ruby-value str">'individual'</span>,<span class="ruby-identifier">:select</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'name, alternate_identity_name, address, city'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">conditions</span>)
|
230
|
+
|
231
|
+
<span class="ruby-keyword kw">end</span>
|
232
|
+
<span class="ruby-keyword kw">end</span>
|
233
|
+
<span class="ruby-operator">!</span><span class="ruby-identifier">possible_sdns</span>.<span class="ruby-identifier">empty?</span>
|
234
|
+
<span class="ruby-keyword kw">end</span>
|
235
|
+
</pre>
|
236
|
+
</div>
|
237
|
+
</div>
|
238
|
+
</div>
|
239
|
+
|
240
|
+
<div id="method-M000008" class="method-detail">
|
241
|
+
<a name="M000008"></a>
|
242
|
+
|
243
|
+
<div class="method-heading">
|
244
|
+
<a href="#M000008" class="method-signature">
|
245
|
+
<span class="method-name">possible_hits</span><span class="method-args">()</span>
|
246
|
+
</a>
|
247
|
+
</div>
|
248
|
+
|
249
|
+
<div class="method-description">
|
250
|
+
<pre>
|
251
|
+
Returns an array of hashes of records in the OFAC data that found partial matches with that record's score.
|
252
|
+
|
253
|
+
Ofac.new({:name => 'Oscar Hernandez', :city => 'Clearwater', :address => '123 somewhere ln'}).possible_hits
|
254
|
+
</pre>
|
255
|
+
<p>
|
256
|
+
returns
|
257
|
+
</p>
|
258
|
+
<pre>
|
259
|
+
[{:address=>"123 Somewhere Ln", :score=>100, :name=>"HERNANDEZ, Oscar|GUAMATUR, S.A.", :city=>"Clearwater"}, {:address=>"123 Somewhere Ln", :score=>100, :name=>"HERNANDEZ, Oscar|Alternate Name", :city=>"Clearwater"}]
|
260
|
+
</pre>
|
261
|
+
<p><a class="source-toggle" href="#"
|
262
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
263
|
+
<div class="method-source-code" id="M000008-source">
|
264
|
+
<pre>
|
265
|
+
<span class="ruby-comment cmt"># File lib/ofac/models/ofac.rb, line 124</span>
|
266
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">possible_hits</span>
|
267
|
+
<span class="ruby-ivar">@possible_hits</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">retrieve_possible_hits</span>
|
268
|
+
<span class="ruby-keyword kw">end</span>
|
269
|
+
</pre>
|
270
|
+
</div>
|
271
|
+
</div>
|
272
|
+
</div>
|
273
|
+
|
274
|
+
<div id="method-M000006" class="method-detail">
|
275
|
+
<a name="M000006"></a>
|
276
|
+
|
277
|
+
<div class="method-heading">
|
278
|
+
<a href="#M000006" class="method-signature">
|
279
|
+
<span class="method-name">score</span><span class="method-args">()</span>
|
280
|
+
</a>
|
281
|
+
</div>
|
282
|
+
|
283
|
+
<div class="method-description">
|
284
|
+
<p>
|
285
|
+
Creates a <a href="Ofac.html#M000006">score</a>, 1 - 100, based on how well
|
286
|
+
the name and address match the data on the SDN (Specially Designated
|
287
|
+
Nationals) list.
|
288
|
+
</p>
|
289
|
+
<p>
|
290
|
+
The <a href="Ofac.html#M000006">score</a> is calculated by adding up the
|
291
|
+
weightings of each part that is matched. So if only name is matched, then
|
292
|
+
the max <a href="Ofac.html#M000006">score</a> is the weight for
|
293
|
+
<tt>:name</tt> which is 60
|
294
|
+
</p>
|
295
|
+
<p>
|
296
|
+
It‘s possible to get partial matches, which will add partial weight
|
297
|
+
to the <a href="Ofac.html#M000006">score</a>. If there is not a match on
|
298
|
+
the element as it is passed in, then each word element gets broken down and
|
299
|
+
matches are tried on each partial element. The weighting is distrubuted
|
300
|
+
equally for each partial that is matched.
|
301
|
+
</p>
|
302
|
+
<p>
|
303
|
+
If exact matches are not made, then a sounds like match is attempted. Any
|
304
|
+
match made by sounds like is given 75% of it‘s weight to the <a
|
305
|
+
href="Ofac.html#M000006">score</a>.
|
306
|
+
</p>
|
307
|
+
<p>
|
308
|
+
Example:
|
309
|
+
</p>
|
310
|
+
<p>
|
311
|
+
If you are trying to match the name Kevin Tyll and there is a record for
|
312
|
+
Smith, Kevin in the database, then we will try to match both Kevin and Tyll
|
313
|
+
separately, with each element Smith and Kevin. Since only Kevin will find a
|
314
|
+
match, and there were 2 elements in the searched name, the <a
|
315
|
+
href="Ofac.html#M000006">score</a> will be added by half the weighting for
|
316
|
+
<tt>:name</tt>. So since the weight for <tt>:name</tt> is 60, then we will
|
317
|
+
add 30 to the <a href="Ofac.html#M000006">score</a>.
|
318
|
+
</p>
|
319
|
+
<p>
|
320
|
+
If you are trying to match the name Kevin Gregory Tyll and there is a
|
321
|
+
record for Tyll, Kevin in the database, then we will try to match Kevin and
|
322
|
+
Gregory and Tyll separately, with each element Tyll and Kevin. Since both
|
323
|
+
Kevin and Tyll will find a match, and there were 3 elements in the searched
|
324
|
+
name, the <a href="Ofac.html#M000006">score</a> will be added by 2/3 the
|
325
|
+
weighting for <tt>:name</tt>. So since the weight for <tt>:name</tt> is 60,
|
326
|
+
then we will add 40 to the <a href="Ofac.html#M000006">score</a>.
|
327
|
+
</p>
|
328
|
+
<p>
|
329
|
+
If you are trying to match the name Kevin Tyll and there is a record for
|
330
|
+
Kevin Gregory Tyll in the database, then we will try to match Kevin and
|
331
|
+
Tyll separately, with each element Tyll and Kevin and Gregory. Since both
|
332
|
+
Kevin and Tyll will find a match, and there were 2 elements in the searched
|
333
|
+
name, the <a href="Ofac.html#M000006">score</a> will be added by 2/2 the
|
334
|
+
weighting for <tt>:name</tt>. So since the weight for <tt>:name</tt> is 60,
|
335
|
+
then we will add 60 to the <a href="Ofac.html#M000006">score</a>.
|
336
|
+
</p>
|
337
|
+
<p>
|
338
|
+
If you are trying to match the name Kevin Tyll, and there is a record for
|
339
|
+
Teel, Kevin in the database, then an exact match will be found for Kevin,
|
340
|
+
and a sounds like match will be made for Tyll. Since there were 2 elements
|
341
|
+
in the searched name, and the weight for <tt>:name</tt> is 60, then each
|
342
|
+
element is worth 30. Since Kevin was an exact match, it will add 30, and
|
343
|
+
since Tyll was a sounds like match, it will add 30 * .75. So the
|
344
|
+
<tt>:name</tt> portion of the search will be worth 53.
|
345
|
+
</p>
|
346
|
+
<p>
|
347
|
+
If data is in the database for city and or address, and you pass data in
|
348
|
+
for these elements, the <a href="Ofac.html#M000006">score</a> will be
|
349
|
+
reduced by 10% of the weight if there is no match or sounds like match. So
|
350
|
+
if you get a match on name, you‘ve already got a <a
|
351
|
+
href="Ofac.html#M000006">score</a> of 60. So if you don‘t pass in an
|
352
|
+
address or city, or if you do, but there is no city or address info in the
|
353
|
+
database, then your final <a href="Ofac.html#M000006">score</a> will be 60.
|
354
|
+
But if you do pass in a city, say Tampa, and the city in the Database is
|
355
|
+
New York, then we will deduct 10% of the weight (30 * .1) = 3 from the <a
|
356
|
+
href="Ofac.html#M000006">score</a> since 30 is the weight for
|
357
|
+
<tt>:city</tt>. So the final <a href="Ofac.html#M000006">score</a> will be
|
358
|
+
57.
|
359
|
+
</p>
|
360
|
+
<p>
|
361
|
+
If were searching for New York, and the database had New Deli, then there
|
362
|
+
would be a match on New, but not on Deli. Since there were 2 elements in
|
363
|
+
the searched city, each hit is worth 15. So the match on New would add 15,
|
364
|
+
but the non-match on York would subtract (15 * .1) = 1.5 from the <a
|
365
|
+
href="Ofac.html#M000006">score</a>. So the <a
|
366
|
+
href="Ofac.html#M000006">score</a> would be (60 + 15 - 1.5) = 74, due to
|
367
|
+
rounding.
|
368
|
+
</p>
|
369
|
+
<p>
|
370
|
+
Only <tt>:city</tt> and <tt>:address</tt> subtract from the <a
|
371
|
+
href="Ofac.html#M000006">score</a>, No match on name simply returns 0.
|
372
|
+
</p>
|
373
|
+
<p>
|
374
|
+
Matches for name are made for both the name and any aliases in the OFAC
|
375
|
+
database.
|
376
|
+
</p>
|
377
|
+
<p>
|
378
|
+
Matches for <tt>:city</tt> and <tt>:address</tt> will only be added to the
|
379
|
+
<a href="Ofac.html#M000006">score</a> if there is first a match on
|
380
|
+
<tt>:name</tt>.
|
381
|
+
</p>
|
382
|
+
<p>
|
383
|
+
We consider a <a href="Ofac.html#M000006">score</a> of 60 to be reasonable
|
384
|
+
as a hit.
|
385
|
+
</p>
|
386
|
+
<p><a class="source-toggle" href="#"
|
387
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
388
|
+
<div class="method-source-code" id="M000006-source">
|
389
|
+
<pre>
|
390
|
+
<span class="ruby-comment cmt"># File lib/ofac/models/ofac.rb, line 85</span>
|
391
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">score</span>
|
392
|
+
<span class="ruby-ivar">@score</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">calculate_score</span>
|
393
|
+
<span class="ruby-keyword kw">end</span>
|
394
|
+
</pre>
|
395
|
+
</div>
|
396
|
+
</div>
|
397
|
+
</div>
|
398
|
+
|
399
|
+
|
400
|
+
</div>
|
401
|
+
|
402
|
+
|
403
|
+
</div>
|
404
|
+
|
405
|
+
|
406
|
+
<div id="validator-badges">
|
407
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
408
|
+
</div>
|
409
|
+
|
410
|
+
</body>
|
411
|
+
</html>
|