ofac 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +24 -49
  3. data/lib/ofac/version.rb +1 -0
  4. data/test/test_helper.rb +5 -1
  5. metadata +118 -94
  6. data/.document +0 -5
  7. data/.ruby-gemset +0 -1
  8. data/.ruby-version +0 -1
  9. data/History.txt +0 -134
  10. data/PostInstall.txt +0 -11
  11. data/VERSION.yml +0 -5
  12. data/generators/ofac_migration/.DS_Store +0 -0
  13. data/generators/ofac_migration/ofac_migration_generator.rb +0 -12
  14. data/generators/ofac_migration/templates/.DS_Store +0 -0
  15. data/generators/ofac_migration/templates/migration.rb +0 -31
  16. data/nbproject/project.properties +0 -7
  17. data/nbproject/project.xml +0 -15
  18. data/ofac.gemspec +0 -129
  19. data/rdoc/CreateOfacSdns.html +0 -249
  20. data/rdoc/Ofac.html +0 -434
  21. data/rdoc/OfacMatch.html +0 -299
  22. data/rdoc/OfacMigration.html +0 -138
  23. data/rdoc/OfacMigration/Generators.html +0 -138
  24. data/rdoc/OfacMigration/Generators/BuildGenerator.html +0 -251
  25. data/rdoc/OfacSdn.html +0 -209
  26. data/rdoc/OfacSdnLoader.html +0 -238
  27. data/rdoc/README_rdoc.html +0 -323
  28. data/rdoc/String.html +0 -262
  29. data/rdoc/classes/Ofac.html +0 -411
  30. data/rdoc/classes/OfacMatch.html +0 -239
  31. data/rdoc/classes/OfacSdn.html +0 -111
  32. data/rdoc/classes/OfacSdnLoader.html +0 -190
  33. data/rdoc/classes/String.html +0 -207
  34. data/rdoc/created.rid +0 -10
  35. data/rdoc/files/README_rdoc.html +0 -317
  36. data/rdoc/files/lib/ofac/models/ofac_rb.html +0 -101
  37. data/rdoc/files/lib/ofac/models/ofac_sdn_loader_rb.html +0 -110
  38. data/rdoc/files/lib/ofac/models/ofac_sdn_rb.html +0 -108
  39. data/rdoc/files/lib/ofac/ofac_match_rb.html +0 -101
  40. data/rdoc/files/lib/ofac/ruby_string_extensions_rb.html +0 -101
  41. data/rdoc/files/lib/ofac_rb.html +0 -113
  42. data/rdoc/fr_class_index.html +0 -31
  43. data/rdoc/fr_file_index.html +0 -33
  44. data/rdoc/fr_method_index.html +0 -35
  45. data/rdoc/images/add.png +0 -0
  46. data/rdoc/images/arrow_up.png +0 -0
  47. data/rdoc/images/brick.png +0 -0
  48. data/rdoc/images/brick_link.png +0 -0
  49. data/rdoc/images/bug.png +0 -0
  50. data/rdoc/images/bullet_black.png +0 -0
  51. data/rdoc/images/bullet_toggle_minus.png +0 -0
  52. data/rdoc/images/bullet_toggle_plus.png +0 -0
  53. data/rdoc/images/date.png +0 -0
  54. data/rdoc/images/delete.png +0 -0
  55. data/rdoc/images/find.png +0 -0
  56. data/rdoc/images/loadingAnimation.gif +0 -0
  57. data/rdoc/images/macFFBgHack.png +0 -0
  58. data/rdoc/images/package.png +0 -0
  59. data/rdoc/images/page_green.png +0 -0
  60. data/rdoc/images/page_white_text.png +0 -0
  61. data/rdoc/images/page_white_width.png +0 -0
  62. data/rdoc/images/plugin.png +0 -0
  63. data/rdoc/images/ruby.png +0 -0
  64. data/rdoc/images/tag_blue.png +0 -0
  65. data/rdoc/images/tag_green.png +0 -0
  66. data/rdoc/images/transparent.png +0 -0
  67. data/rdoc/images/wrench.png +0 -0
  68. data/rdoc/images/wrench_orange.png +0 -0
  69. data/rdoc/images/zoom.png +0 -0
  70. data/rdoc/index.html +0 -96
  71. data/rdoc/js/darkfish.js +0 -155
  72. data/rdoc/js/jquery.js +0 -18
  73. data/rdoc/js/navigation.js +0 -142
  74. data/rdoc/js/search.js +0 -94
  75. data/rdoc/js/search_index.js +0 -1
  76. data/rdoc/js/searcher.js +0 -228
  77. data/rdoc/lib/generators/ofac_migration/build/build_generator_rb.html +0 -97
  78. data/rdoc/lib/generators/ofac_migration/build/templates/create_ofac_sdns_rb.html +0 -97
  79. data/rdoc/lib/ofac/models/ofac_rb.html +0 -97
  80. data/rdoc/lib/ofac/models/ofac_sdn_loader_rb.html +0 -97
  81. data/rdoc/lib/ofac/models/ofac_sdn_rb.html +0 -97
  82. data/rdoc/lib/ofac/ofac_match_rb.html +0 -97
  83. data/rdoc/lib/ofac/ruby_string_extensions_rb.html +0 -97
  84. data/rdoc/lib/ofac_rb.html +0 -97
  85. data/rdoc/rdoc-style.css +0 -208
  86. data/rdoc/rdoc.css +0 -595
  87. data/rdoc/table_of_contents.html +0 -120
@@ -1,262 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
-
7
- <title>class String - ofac 2.0.1</title>
8
-
9
- <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
-
11
- <script type="text/javascript">
12
- var rdoc_rel_prefix = "./";
13
- </script>
14
-
15
- <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
- <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
- <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
- <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
- <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
- <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
-
22
-
23
- <body id="top" class="class">
24
- <nav id="metadata">
25
- <nav id="home-section" class="section">
26
- <h3 class="section-header">
27
- <a href="./index.html">Home</a>
28
- <a href="./table_of_contents.html#classes">Classes</a>
29
- <a href="./table_of_contents.html#methods">Methods</a>
30
- </h3>
31
- </nav>
32
-
33
-
34
- <nav id="search-section" class="section project-section" class="initially-hidden">
35
- <form action="#" method="get" accept-charset="utf-8">
36
- <h3 class="section-header">
37
- <input type="text" name="search" placeholder="Search" id="search-field"
38
- title="Type to search, Up and Down to navigate, Enter to load">
39
- </h3>
40
- </form>
41
-
42
- <ul id="search-results" class="initially-hidden"></ul>
43
- </nav>
44
-
45
-
46
-
47
-
48
- <div id="file-metadata">
49
- <nav id="file-list-section" class="section">
50
- <h3 class="section-header">Defined In</h3>
51
- <ul>
52
- <li>lib/ofac/ruby_string_extensions.rb
53
- </ul>
54
- </nav>
55
-
56
-
57
- </div>
58
-
59
- <div id="class-metadata">
60
-
61
- <nav id="parent-class-section" class="section">
62
- <h3 class="section-header">Parent</h3>
63
-
64
- <p class="link">Object
65
-
66
- </nav>
67
-
68
-
69
-
70
- <!-- Method Quickref -->
71
- <nav id="method-list-section" class="section">
72
- <h3 class="section-header">Methods</h3>
73
-
74
- <ul class="link-list">
75
-
76
- <li ><a href="#method-i-ofac_soundex">#ofac_soundex</a>
77
-
78
- <li ><a href="#method-i-ofac_sounds_like">#ofac_sounds_like</a>
79
-
80
- </ul>
81
- </nav>
82
-
83
- </div>
84
-
85
- <div id="project-metadata">
86
- <nav id="fileindex-section" class="section project-section">
87
- <h3 class="section-header">Pages</h3>
88
-
89
- <ul>
90
-
91
- <li class="file"><a href="./README_rdoc.html">README</a>
92
-
93
- </ul>
94
- </nav>
95
-
96
- <nav id="classindex-section" class="section project-section">
97
- <h3 class="section-header">Class and Module Index</h3>
98
-
99
- <ul class="link-list">
100
-
101
- <li><a href="./CreateOfacSdns.html">CreateOfacSdns</a>
102
-
103
- <li><a href="./Ofac.html">Ofac</a>
104
-
105
- <li><a href="./OfacMatch.html">OfacMatch</a>
106
-
107
- <li><a href="./OfacMigration.html">OfacMigration</a>
108
-
109
- <li><a href="./OfacMigration/Generators.html">OfacMigration::Generators</a>
110
-
111
- <li><a href="./OfacMigration/Generators/BuildGenerator.html">OfacMigration::Generators::BuildGenerator</a>
112
-
113
- <li><a href="./OfacSdn.html">OfacSdn</a>
114
-
115
- <li><a href="./OfacSdnLoader.html">OfacSdnLoader</a>
116
-
117
- <li><a href="./String.html">String</a>
118
-
119
- </ul>
120
- </nav>
121
-
122
- </div>
123
- </nav>
124
-
125
- <div id="documentation">
126
- <h1 class="class">class String</h1>
127
-
128
- <div id="description" class="description">
129
-
130
- </div><!-- description -->
131
-
132
-
133
-
134
-
135
- <section id="5Buntitled-5D" class="documentation-section">
136
-
137
-
138
-
139
-
140
-
141
- <!-- Constants -->
142
- <section id="constants-list" class="section">
143
- <h3 class="section-header">Constants</h3>
144
- <dl>
145
-
146
- <dt id="Ofac_SoundexChars">Ofac_SoundexChars
147
-
148
- <dd class="description">
149
-
150
-
151
- <dt id="Ofac_SoundexCharsDel">Ofac_SoundexCharsDel
152
-
153
- <dd class="description">
154
-
155
-
156
- <dt id="Ofac_SoundexCharsEx">Ofac_SoundexCharsEx
157
-
158
- <dd class="description">
159
-
160
-
161
- <dt id="Ofac_SoundexNums">Ofac_SoundexNums
162
-
163
- <dd class="description">
164
-
165
-
166
- </dl>
167
- </section>
168
-
169
-
170
-
171
-
172
- <!-- Methods -->
173
-
174
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
175
- <h3 class="section-header">Public Instance Methods</h3>
176
-
177
-
178
- <div id="method-i-ofac_soundex" class="method-detail ">
179
-
180
- <div class="method-heading">
181
- <span class="method-name">ofac_soundex</span><span
182
- class="method-args">(census = true)</span>
183
-
184
- <span class="method-click-advice">click to toggle source</span>
185
-
186
- </div>
187
-
188
-
189
- <div class="method-description">
190
-
191
- <p>desc: <a
192
- href="http://en.wikipedia.org/wiki/Soundex">en.wikipedia.org/wiki/Soundex</a></p>
193
-
194
-
195
-
196
-
197
- <div class="method-source-code" id="ofac_soundex-source">
198
- <pre><span class="ruby-comment"># File lib/ofac/ruby_string_extensions.rb, line 9</span>
199
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">ofac_soundex</span>(<span class="ruby-identifier">census</span> = <span class="ruby-keyword">true</span>)
200
- <span class="ruby-identifier">str</span> = <span class="ruby-identifier">upcase</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-constant">Ofac_SoundexCharsDel</span>).<span class="ruby-identifier">squeeze</span>
201
-
202
- <span class="ruby-identifier">str</span>[<span class="ruby-value">0</span> <span class="ruby-operator">..</span> <span class="ruby-value">0</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">str</span>[<span class="ruby-value">1</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>].
203
- <span class="ruby-identifier">delete</span>(<span class="ruby-constant">Ofac_SoundexCharsEx</span>).
204
- <span class="ruby-identifier">tr</span>(<span class="ruby-constant">Ofac_SoundexChars</span>, <span class="ruby-constant">Ofac_SoundexNums</span>)[<span class="ruby-value">0</span> <span class="ruby-operator">..</span> (<span class="ruby-identifier">census</span> <span class="ruby-operator">?</span> <span class="ruby-value">2</span> <span class="ruby-operator">:</span> <span class="ruby-value">-1</span>)].
205
- <span class="ruby-identifier">ljust</span>(<span class="ruby-value">3</span>, <span class="ruby-string">&#39;0&#39;</span>) <span class="ruby-keyword">rescue</span> <span class="ruby-string">&#39;&#39;</span>
206
- <span class="ruby-keyword">end</span></pre>
207
- </div><!-- ofac_soundex-source -->
208
-
209
- </div>
210
-
211
-
212
-
213
-
214
- </div><!-- ofac_soundex-method -->
215
-
216
-
217
- <div id="method-i-ofac_sounds_like" class="method-detail ">
218
-
219
- <div class="method-heading">
220
- <span class="method-name">ofac_sounds_like</span><span
221
- class="method-args">(other, census = true)</span>
222
-
223
- <span class="method-click-advice">click to toggle source</span>
224
-
225
- </div>
226
-
227
-
228
- <div class="method-description">
229
-
230
-
231
-
232
-
233
-
234
-
235
- <div class="method-source-code" id="ofac_sounds_like-source">
236
- <pre><span class="ruby-comment"># File lib/ofac/ruby_string_extensions.rb, line 18</span>
237
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">ofac_sounds_like</span>(<span class="ruby-identifier">other</span>, <span class="ruby-identifier">census</span> = <span class="ruby-keyword">true</span>)
238
- <span class="ruby-identifier">ofac_soundex</span>(<span class="ruby-identifier">census</span>) <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">ofac_soundex</span>(<span class="ruby-identifier">census</span>)
239
- <span class="ruby-keyword">end</span></pre>
240
- </div><!-- ofac_sounds_like-source -->
241
-
242
- </div>
243
-
244
-
245
-
246
-
247
- </div><!-- ofac_sounds_like-method -->
248
-
249
-
250
- </section><!-- public-instance-method-details -->
251
-
252
- </section><!-- 5Buntitled-5D -->
253
-
254
- </div><!-- documentation -->
255
-
256
-
257
- <footer id="validator-badges">
258
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
259
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
260
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
261
- </footer>
262
-
@@ -1,411 +0,0 @@
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>&nbsp;&nbsp;
90
- <a href="#M000005">new</a>&nbsp;&nbsp;
91
- <a href="#M000008">possible_hits</a>&nbsp;&nbsp;
92
- <a href="#M000006">score</a>&nbsp;&nbsp;
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&#8216;s demographic information
126
- </p>
127
- <pre>
128
- Ofac.new({:name =&gt; 'Oscar Hernandez', :city =&gt; 'Clearwater', :address =&gt; '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 =&gt; '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 =&gt; {:first_name =&gt; 'Victor', :last_name =&gt; '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">&lt;</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">&quot;name like ?&quot;</span>, <span class="ruby-node">&quot;%#{partial_name}%&quot;</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">&quot;alternate_identity_name like ?&quot;</span>, <span class="ruby-node">&quot;%#{partial_name}%&quot;</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">&quot;(#{name_conditions}) or (#{alt_name_conditions})&quot;</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">&gt;</span> <span class="ruby-value str">'name, alternate_identity_name, address, city'</span>, <span class="ruby-identifier">:conditions</span> =<span class="ruby-operator">&gt;</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 =&gt; 'Oscar Hernandez', :city =&gt; 'Clearwater', :address =&gt; '123 somewhere ln'}).possible_hits
254
- </pre>
255
- <p>
256
- returns
257
- </p>
258
- <pre>
259
- [{:address=&gt;&quot;123 Somewhere Ln&quot;, :score=&gt;100, :name=&gt;&quot;HERNANDEZ, Oscar|GUAMATUR, S.A.&quot;, :city=&gt;&quot;Clearwater&quot;}, {:address=&gt;&quot;123 Somewhere Ln&quot;, :score=&gt;100, :name=&gt;&quot;HERNANDEZ, Oscar|Alternate Name&quot;, :city=&gt;&quot;Clearwater&quot;}]
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&#8216;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&#8216;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&#8216;ve already got a <a
351
- href="Ofac.html#M000006">score</a> of 60. So if you don&#8216;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>