author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
714,098
09.01.2020 23:43:13
18,000
0aa20a42b5ef8299e09fa766ac31f42dc5ec010a
add updated peers
[ { "change_type": "MODIFY", "old_path": "src/chainparams.cpp", "new_path": "src/chainparams.cpp", "diff": "@@ -138,6 +138,33 @@ public:\n// Adding some nodes in case it works\nif (!gArgs.IsArgSet(\"-without-tor\") || gArgs.GetBoolArg(\"-dynamic-network\", false)) {\n// protocol-90009 with proper TOR v3 support\n+ vSeeds.emplace_back(\"aizckfmksnk54gqcg5fur22cz22vzut2ig7cexz45pfm7witswzawcqd.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"zca2vot3ucw6bjvdg6yhgjxzvyqv7fl27pvu4pskdng6w6dhjfrs5myd.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"ho6iij2ag6fcnwnqhfwkzfvitcvbrr3lmlgetxlve2isvfqp72vwu5ad.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"obtsnd4wobjuubco4v2awt534zoog2wtq3oknloibmeul3dh5cxycjqd.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"jdaootwqo25qcfq3qjcantgfwlilzzc72e6ormt6t3gnafeacjzgd3qd.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"ry7yyqv4oeu2kjygco5xvcvi2sgr5bxkynvh6yctftghwe2jy6w2wkqd.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"f3cy2jkmfl3qzqpk4srruhpefkunq3rj6wi7z57yzinyxpk3rmbluoad.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"25hj4mdmslzvu2lngo4jcsbrouwsdktv6ps3xifipju74oqyoply6qad.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"amafdqgkmtbkld45kaal5cwwfbrsgnimw77gawwltsaklgxxlubjvhid.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"n7rk4xqurrvedhhghkkvz2pmxalgmoviokgjiwjgcvpcxa6piym5m2ad.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"rje6q245yhiyn4setn5abjlcqwapxzgwbfksrscexyhv7ffjdasmvaqd.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"wu6bebmvs6jw2t6lmjg3aako5synunxm4i3zb7bybvzrvxe277achfad.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"jvnd4gjzhmuiaph5xft6ju4twt5gjmpbqdc2sis7gd2pnnqpwwpqz5id.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"wuoki3rq3htqmtrmrtkqtnxzgfsgclwj7jrxk35abkwksni2asdepzyd.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"3czrw4cxofudpyhl46whvcyzgmkciaai2uw7s6motxejb3fijdkgmuqd.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"7wg3vv67i5m3uiectqw4taj5pm3qmxnlgyb7ks7e5oilo62g7mxn2zqd.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"y2y2cr6h4dn3g5l4545mj7dw245i3fsuixx6he6r4w4aqh3j23pwqoid.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"hrpy4r4xijwps32lknzbyd36ad6vaibumceioaxe62smpiv22oktiwad.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"oy2q3dl6pupe4mk2dzrbtbvpf3fjru2ajdr4rsrxlxpaweqn3utvxzad.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"u7ikxx5hloxuvyr53mwqdzgxr5cjpabqruzqrx5qfcvuv6kpa22gsjid.onion\"); //v6 SUNEROK\n+ vSeeds.emplace_back(\"jno3zpfsdgrtdaxlyuowipokbumoidyecmczrjru7tjfovfjkztl2pad.onion\"); //v6 Swat\n+ vSeeds.emplace_back(\"763co2copdnav2ik2jlq33wzj2rogt4wfexjvukx5tg3tiepm2ahbrid.onion\"); //v6 Swat\n+ vSeeds.emplace_back(\"yvvioyzj3w5k6z64urv55xuh65oftcy5wts4tgwpi6hxdeixamsn63qd.onion\"); //v6 Marplez SGP\n+ vSeeds.emplace_back(\"zwvqhwne3mlefxd52q35cckzdo46uhvcuvl7qdzqlatgpfqe4r43suid.onion\"); //v6 Marplez AMS\n+ vSeeds.emplace_back(\"ojmwnkopgmpotm2byx7vsm7xplqxhctutw3d3ve7k5mbybsuydfk46qd.onion\"); //v6 Marplez NYC\n+ vSeeds.emplace_back(\"g7cbcrcxdy7kszjmvw62bfm5douesjtkioqycc6m4gpomybcsohba7ad.onion\"); //v6 2lazy2debug DE\n+ vSeeds.emplace_back(\"2zju2kcvt55h3v5dnghtduw5hrqqlt6nggngtyjnrjgybu7tqz4wvdad.onion\"); //v6 2lazy2debug NL\nvSeeds.emplace_back(\"3zal3m6ixo3vhvaeihybqi4r7vs33l2a4x7qce2gb6seqog2sk67lkyd.onion\");\nvSeeds.emplace_back(\"jcq2di2z5t2x6xibjuak4syslkx46rkid6vpuzys3rnn65vhwfywhrid.onion\");\n}\n" } ]
C++
MIT License
vergecurrency/verge
add updated peers
714,098
10.01.2020 23:02:30
18,000
f73c4b6ca9ba2a4207eecaa609f51b679b63cf06
add missing build flag, add new rc we never added the build definition to autoconf init (also added an rc flag)
[ { "change_type": "MODIFY", "old_path": "configure.ac", "new_path": "configure.ac", "diff": "@@ -4,11 +4,12 @@ define(_CLIENT_VERSION_MAJOR, 6)\ndefine(_CLIENT_VERSION_MINOR, 0)\ndefine(_CLIENT_VERSION_REVISION, 2)\ndefine(_CLIENT_VERSION_BUILD, 0)\n+define(_CLIENT_VERSION_RC, 0)\ndefine(_CLIENT_VERSION_IS_RELEASE, true)\ndefine(_COPYRIGHT_YEAR, 2020)\ndefine(_COPYRIGHT_HOLDERS,[The %s developers])\ndefine(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Verge Core]])\n-AC_INIT([Verge Leviosa],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/vergecurrency/VERGE/issues],[verge],[https://vergecurrency.com/])\n+AC_INIT([Verge Leviosa],m4_join([.], _CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MINOR, _CLIENT_VERSION_REVISION, m4_if(_CLIENT_VERSION_BUILD, [0], [], _CLIENT_VERSION_BUILD))m4_if(_CLIENT_VERSION_RC, [0], [], [rc]_CLIENT_VERSION_RC),[https://github.com/vergecurrency/verge/issues],[verge],[https://vergecurrency.com/])\nAC_CONFIG_SRCDIR([src/validation.cpp])\nAC_CONFIG_HEADERS([src/config/verge-config.h])\nAC_CONFIG_AUX_DIR([build-aux])\n" } ]
C++
MIT License
vergecurrency/verge
add missing build flag, add new rc we never added the build definition to autoconf init (also added an rc flag)
714,098
11.01.2020 20:44:15
18,000
1569064e8c6037b4b7db36660d42d366b5a05f4a
add testnet port info
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -21,8 +21,8 @@ Protocol | PoW (proof of Work)\nAlgorithms | scrypt, x17, Lyra2rev2, myr-groestl, & blake2s\nBlocktime | 30 seconds\nTotal Supply | 16,500,000,000 XVG\n-RPC port | 20102\n-P2P port | 21102\n+RPC port | 20102 (testnet: 21102)\n+P2P port | 21102 (testnet: 21104)\npre-mine | N/A\nICO | N/A\n" } ]
C++
MIT License
vergecurrency/verge
add testnet port info
714,098
11.01.2020 20:53:01
18,000
d4e40360c83532910710e6911845db6dc8cc3f31
change regtest port conflicts with btc's p2p port..
[ { "change_type": "MODIFY", "old_path": "contrib/linearize/example-linearize.cfg", "new_path": "contrib/linearize/example-linearize.cfg", "diff": "# verged RPC settings (linearize-hashes)\nrpcuser=someuser\nrpcpassword=somepassword\n-#datadir=~/.verge3\n+#datadir=~/.VERGE\nhost=127.0.0.1\n#mainnet default\n-port=20103\n+port=21102\n#testnet default\n-#port=120103\n+#port=21104\n#regtest default\n-#port=18443\n+#port=31102\n# bootstrap.dat hashlist settings (linearize-hashes)\nmax_height=313000\n@@ -19,14 +19,14 @@ max_height=313000\n# bootstrap.dat input/output settings (linearize-data)\n# mainnet\n-netmagic=f9beb4d9\n-genesis=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f\n-input=/home/example/.verge3/blocks\n-\n-# testnet\n-#netmagic=0b110907\n-#genesis=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943\n-#input=/home/example/.verge3/testnet3/blocks\n+netmagic=f7a77eff\n+genesis=00000fc63692467faeb20cdb3b53200dc601d75bdfa1001463304cc790d77278\n+input=/home/example/.VERGE/blocks\n+\n+# testnet3\n+#netmagic=cdf2c0ef\n+#genesis=768cc22f70bbcc4de26f83aca1b4ea2a7e25f0d100497ba47c7ff2d9b696414c\n+#input=/home/example/.VERGE/testnet3/blocks\n# \"output\" option causes blockchain files to be written to the given location,\n# with \"output_file\" ignored. If not used, \"output_file\" is used instead.\n" }, { "change_type": "MODIFY", "old_path": "src/chainparams.cpp", "new_path": "src/chainparams.cpp", "diff": "@@ -407,7 +407,7 @@ public:\npchMessageStart[1] = 0xbf;\npchMessageStart[2] = 0xb5;\npchMessageStart[3] = 0xda;\n- nDefaultPort = 8333;\n+ nDefaultPort = 31102;\nnPruneAfterHeight = 1000;\ngenesis = CreateGenesisBlock(1462058066, 2, 0x1e0fffff, 1);\n" } ]
C++
MIT License
vergecurrency/verge
change regtest port conflicts with btc's p2p port..
714,094
20.01.2020 12:54:30
18,000
579a14d36f321bb3ab1c0e04f052e5195f3ac2ef
Update README.md Updated Readme to include Sudo Make Install if updating from previous version (and Verge-QT command still brings you to previous build)
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -185,10 +185,16 @@ The _slightly_ longer version:\n```shell\ngit clone https://github.com/vergecurrency/VERGE && cd VERGE && ./autogen.sh && ./configure && make\n```\n+ If updating from previous version, dont forget to:\n+ ```shell\n+ sudo make install\n+ ```\n> **Note**: If you get a \"memory exhausted\" error, make a swap file. (https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04)\n+\n+\n### Mac OS X Wallet\n> **Note:** This has only been confirmed to work on OS X Sierra (10.12) and OS X High Sierra (10.13) with XCode 9.2 and `Apple LLVM version 9.0.0 (clang-900.0.39.2)`.\n" } ]
C++
MIT License
vergecurrency/verge
Update README.md (#1024) Updated Readme to include Sudo Make Install if updating from previous version (and Verge-QT command still brings you to previous build)
714,092
08.02.2020 10:21:46
-3,600
766b44f6af214c1ca9dcba07a18716aff3841a82
Add correct coverage label
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "<img src=\"https://img.shields.io/badge/status-stable-green.svg\">\n<img src=\"https://img.shields.io/badge/license-MIT-blue.svg\">\n<a href=\"https://codecov.io/gh/vergecurrency/VERGE\">\n- <img src=\"https://codecov.io/gh/vergecurrency/VERGE/branch/develop/graph/badge.svg\" />\n+ <img src=\"https://codecov.io/gh/vergecurrency/VERGE/branch/master/graph/badge.svg\" />\n</a>\n<a href=\"https://github.com/vergecurrency/VERGE/releases\">\n<img alt=\"GitHub All Releases\" src=\"https://img.shields.io/github/downloads/vergecurrency/VERGE/total?style=social\">\n" } ]
C++
MIT License
vergecurrency/verge
Add correct coverage label
714,098
09.04.2020 17:20:38
14,400
14853859fb21f8be8bf326f6c63d8a847e554f5c
remove a peer
[ { "change_type": "MODIFY", "old_path": "src/chainparams.cpp", "new_path": "src/chainparams.cpp", "diff": "@@ -149,7 +149,6 @@ public:\nvSeeds.emplace_back(\"amafdqgkmtbkld45kaal5cwwfbrsgnimw77gawwltsaklgxxlubjvhid.onion\"); //v6 SUNEROK\nvSeeds.emplace_back(\"n7rk4xqurrvedhhghkkvz2pmxalgmoviokgjiwjgcvpcxa6piym5m2ad.onion\"); //v6 SUNEROK\nvSeeds.emplace_back(\"rje6q245yhiyn4setn5abjlcqwapxzgwbfksrscexyhv7ffjdasmvaqd.onion\"); //v6 SUNEROK\n- vSeeds.emplace_back(\"wu6bebmvs6jw2t6lmjg3aako5synunxm4i3zb7bybvzrvxe277achfad.onion\"); //v6 SUNEROK\nvSeeds.emplace_back(\"jvnd4gjzhmuiaph5xft6ju4twt5gjmpbqdc2sis7gd2pnnqpwwpqz5id.onion\"); //v6 SUNEROK\nvSeeds.emplace_back(\"wuoki3rq3htqmtrmrtkqtnxzgfsgclwj7jrxk35abkwksni2asdepzyd.onion\"); //v6 SUNEROK\nvSeeds.emplace_back(\"3czrw4cxofudpyhl46whvcyzgmkciaai2uw7s6motxejb3fijdkgmuqd.onion\"); //v6 SUNEROK\n" } ]
C++
MIT License
vergecurrency/verge
remove a peer
714,092
10.06.2020 08:17:52
-7,200
5baaa8ca49f7e29649a6169a557438f70b5a041e
Adjust status shield
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "<p align=\"center\"><img src=\"https://raw.githubusercontent.com/vergecurrency/VERGE/master/readme-header.png\" alt=\"Verge Source Code\"></p>\n<p align=\"center\">\n- <a href=\"https://circleci.com/gh/vergecurrency/VERGE/tree/master\" target=\"_blank\"><img src=\"https://circleci.com/gh/vergecurrency/VERGE/tree/master.svg?style=svg\"></a>\n+ <a href=\"https://circleci.com/gh/vergecurrency/verge/tree/master\" target=\"_blank\"><img src=\"https://circleci.com/gh/vergecurrency/verge/tree/master.svg?style=svg\"></a>\n<img src=\"https://img.shields.io/badge/status-stable-green.svg\">\n<img src=\"https://img.shields.io/badge/license-MIT-blue.svg\">\n<a href=\"https://codecov.io/gh/vergecurrency/VERGE\">\n" } ]
C++
MIT License
vergecurrency/verge
Adjust status shield
714,111
17.09.2020 15:50:56
-7,200
26f1e2568f35066c3eaac3de1c73445cc2f64b0f
Fix broken English bot responses
[ { "change_type": "MODIFY", "old_path": ".github/workflows/greetings.yml", "new_path": ".github/workflows/greetings.yml", "diff": "@@ -10,11 +10,12 @@ jobs:\nwith:\nrepo-token: ${{ secrets.GITHUB_TOKEN }}\nissue-message: |\n- So sorry to hear, that you've in trouble with our software. We will\n- review your ticket as soon as we can. Please make sure to state your problem as\n- detailed as possible and also consider checking our FAQ/Wiki sites.\n+ Hi! Thank you for filing an issue. Please be patient before anyone responds.\n+ Make sure your issue is filled in with as many details as possible.\n+ Its also recommended to check out previously resolved or closed issues so no duplicates are created.\n+ There's also the chance the anwser for your issue can be found on one of the XVG wiki/FAQ's.\npr-message: |\n- Thank you for submitting a Pull-Request to the Verge repository.\n- Please make sure that you read the CONTRIBUTION.md in order to quickily\n- move forward with your ticket. Moreover we would like you to also have\n- a look onto your pipelines and upcoming reviews.\n+ Thank you for your submitted Pull-Request!\n+ Please make sure that you've read the CONTRIBUTION.md to prevent unwanted comments. ;)\n+ Be patient before anyone responds or reviews your Pull-Request.\n+ Keep in touch with this Pull-Request to make this a quick process!\n" } ]
C++
MIT License
vergecurrency/verge
Fix broken English bot responses
714,108
26.09.2020 18:40:56
14,400
2265086499276b5cae23bf75d3f814c31f3a7274
Update go.sh Fix for Ubuntu 20.04 LTS, db4.8 custom build.
[ { "change_type": "MODIFY", "old_path": "go.sh", "new_path": "go.sh", "diff": "@@ -110,6 +110,11 @@ echo \"${green}BerkeleyDb already present...$(grep --include *.h -r '/usr/' -e 'D\nelse\nwget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz\ntar -xzvf db-4.8.30.NC.tar.gz\n+result5=$(cat /etc/issue | grep -Po '20.04')\n+if [ $result5 = \"20.04\" ]\n+then\n+sed -i 's/__atomic_compare_exchange/__db_atomic_compare_exchange/g' ~/db-4.8.30.NC/dbinc/atomic.h\n+fi\nresult2=$(cat /etc/issue | grep -Po '19.04')\nif [ $result2 = \"19.04\" ]\nthen\n" } ]
C++
MIT License
vergecurrency/verge
Update go.sh Fix for Ubuntu 20.04 LTS, db4.8 custom build.
714,108
26.09.2020 19:55:08
14,400
faf913ad4723664182ad64c7d51ce1443478b880
Update go.sh fix grab the right file for bootstrap
[ { "change_type": "MODIFY", "old_path": "go.sh", "new_path": "go.sh", "diff": "@@ -287,7 +287,7 @@ cd ~\necho -n \"Success....Blockchain is now downloading press Ctrl-C to cancel but it will take longer to sync from 0. And you will have to start verge manual\"\nsudo rm QT-Wallet*.zip\n-echo \"wget --no-check-certificate \" $(lynx --dump --listonly https://verge-blockchain.com/down/ | grep -o \"https://verge-blockchain.com/blockchain5.*zip\" | head -1 ) > link.sh\n+echo \"wget --no-check-certificate \" $(lynx --dump --listonly https://verge-blockchain.com/download/ | grep -o \"https://verge-blockchain*.*zip\" | head -1 ) > link.sh\nsh link.sh\nunzip -o QT-Wallet*.zip -d ~/.VERGE\nsudo rm QT-Wallet*.zip\n" } ]
C++
MIT License
vergecurrency/verge
Update go.sh fix grab the right file for bootstrap
714,098
17.02.2021 15:50:58
18,000
d8fb68b6f0a1cce6401be42456391381dc3b2ba7
raise min proto ver
[ { "change_type": "MODIFY", "old_path": "src/version.h", "new_path": "src/version.h", "diff": "@@ -21,7 +21,7 @@ static const int INIT_PROTO_VERSION = 209;\nstatic const int GETHEADERS_VERSION = 90001;\n//! disconnect from peers older than this proto version\n-static const int MIN_PEER_PROTO_VERSION = 90008;\n+static const int MIN_PEER_PROTO_VERSION = 90009;\n//! nTime field added to CAddress, starting with this version;\n//! if possible, avoid requesting addresses nodes older than this\n" } ]
C++
MIT License
vergecurrency/verge
raise min proto ver
714,098
20.02.2021 09:07:05
18,000
993b1574330c273f94c98c54e7198093a0c85c04
add another checkpoint
[ { "change_type": "MODIFY", "old_path": "src/chainparams.cpp", "new_path": "src/chainparams.cpp", "diff": "@@ -240,6 +240,7 @@ public:\n{3700001, uint256S(\"0x65a6844e9cee118fd45edb78e36ed81eee149a16ccec7d859951a28ef6604cfe\")}, // manifests the v6 hardfork\n{4000000, uint256S(\"0x61dca6a2a662da0fddaa7c19aa95f09d6ffda3c0b33a4613ab3698f25b5b9552\")},\n{4500000, uint256S(\"0x180f33d62de99ed493700fa7d4607a81ca7c26a96f497670c08191a933ce28a6\")},\n+ {4750000, uint256S(\"0xa1a59a1b1e2ccd0ee5d7ec86d41107dfa12f63d99dfab281003d95e05f805302\")},\n}\n};\n@@ -277,6 +278,7 @@ public:\n{4000000, uint256S(\"0x61dca6a2a662da0fddaa7c19aa95f09d6ffda3c0b33a4613ab3698f25b5b9552\")},\n{4500000, uint256S(\"0x180f33d62de99ed493700fa7d4607a81ca7c26a96f497670c08191a933ce28a6\")},\n{4714560, uint256S(\"0x073cbdba83dac29384fdc8b4b07199718cb43997558925dcd4824c1e228971d6\")}, // updated 2/1/2021\n+ {4750000, uint256S(\"0xa1a59a1b1e2ccd0ee5d7ec86d41107dfa12f63d99dfab281003d95e05f805302\")},\n}\n};\n" } ]
C++
MIT License
vergecurrency/verge
add another checkpoint
714,095
21.02.2021 22:26:30
-3,600
e1bd846f0d023b2de12a9ec1ad2684c14232bcf0
Add -version option to verge-cli
[ { "change_type": "MODIFY", "old_path": "src/verge-cli.cpp", "new_path": "src/verge-cli.cpp", "diff": "@@ -51,6 +51,8 @@ static void SetupCliArgs()\ngArgs.AddArg(\"-rpcwallet=<walletname>\", \"Send RPC for non-default wallet on RPC server (needs to exactly match corresponding -wallet option passed to verged)\", false, OptionsCategory::OPTIONS);\ngArgs.AddArg(\"-stdin\", \"Read extra arguments from standard input, one per line until EOF/Ctrl-D (recommended for sensitive information such as passphrases). When combined with -stdinrpcpass, the first line from standard input is used for the RPC password.\", false, OptionsCategory::OPTIONS);\ngArgs.AddArg(\"-stdinrpcpass\", strprintf(\"Read RPC password from standard input as a single line. When combined with -stdin, the first line from standard input is used for the RPC password.\"), false, OptionsCategory::OPTIONS);\n+ gArgs.AddArg(\"-version\", \"Print version and exit\", false, OptionsCategory::OPTIONS);\n+\n// Hidden\ngArgs.AddArg(\"-h\", \"\", false, OptionsCategory::HIDDEN);\n" } ]
C++
MIT License
vergecurrency/verge
Add -version option to verge-cli (#1064)
714,108
24.02.2021 20:18:34
18,000
a5f0ecc6bedf872a668e170a3405016114cf0b3f
Update go.sh take care of wallet.dat, backup and recopy when recompiling, now show openssl version as well.
[ { "change_type": "MODIFY", "old_path": "go.sh", "new_path": "go.sh", "diff": "#!/bin/bash\n+#// full deployement : wget -O - https://raw.githubusercontent.com/vergecurrency/VERGE/master/go.sh | bash\n+var=`date +\"%FORMAT_STRING\"`\n+now=`date +\"%m_%d_%Y\"`\n+now=`date +\"%Y-%m-%d-%s\"`\n+\n+if [ -e ~/.VERGE/VERGE.conf ]\n+then\n+ cp -a ~/.VERGE/VERGE.conf ~/VERGE.conf\n+ cp -a ~/.VERGE/VERGE.conf ~/VERGE.conf${now}\n+fi\n+if [ -e ~/.VERGE/wallet.dat ]\n+then\n+ cp -a ~/.VERGE/wallet.dat ~/wallet.dat\n+ cp -a ~/.VERGE/wallet.dat ~/Vwallet.dat${now}\n+fi\n-#// full deployement : wget -O - https://raw.githubusercontent.com/badbrainIRC/VERGE/master/go.sh | bash\nsudo rm -Rf ~/VERGE\n# generating entropy make it harder to guess the randomness!.\necho \"Initializing random number generator...\"\n@@ -165,6 +179,7 @@ else\ngrep --include=*.hpp -r '/usr/' -e \"define BOOST_LIB_VERSION\"\nfi\n+echo Libssl version: $(/usr/bin/openssl version)\n#// Clone files from repo, Permissions and make\ngit clone --recurse-submodules https://github.com/vergecurrency/VERGE\n@@ -278,6 +293,17 @@ sudo chmod +x ~/Desktop/VERGE.desktop\nsudo cp ~/Desktop/VERGE.desktop /usr/share/applications/VERGE.desktop\nsudo chmod +x /usr/share/applications/VERGE.desktop\n+if [ -e ~/VERGE.conf ]\n+then\n+ cp -a ~/VERGE.conf ~/.VERGE/VERGE.conf\n+ rm ~/VERGE.conf\n+fi\n+if [ -e ~/wallet.dat ]\n+then\n+ cp -a ~/wallet.dat ~/.VERGE/wallet.dat\n+ rm ~/wallet.dat\n+fi\n+\n# Erase all VERGE compilation directory , cleaning\ncd ~\n" } ]
C++
MIT License
vergecurrency/verge
Update go.sh take care of wallet.dat, backup and recopy when recompiling, now show openssl version as well.
714,108
24.02.2021 20:46:57
18,000
dfacc2eabc1df100ee38d9aa27df76ead83b919d
Update go.sh fix in case you redo go.sh multiple times. remove old snapshot.
[ { "change_type": "MODIFY", "old_path": "go.sh", "new_path": "go.sh", "diff": "@@ -315,6 +315,9 @@ echo -n \"Success....Blockchain is now downloading press Ctrl-C to cancel but it\nsudo rm QT-Wallet*.zip\necho \"wget --no-check-certificate \" $(lynx --dump --listonly https://verge-blockchain.com/download/ | grep -o \"https://verge-blockchain*.*zip\" | head -1 ) > link.sh\nsh link.sh\n+sudo rm -Rf ~/.VERGE/blocks\n+sudo rm -Rf ~/.VERGE/chainstate\n+sudo rm ~/.VERGE/peers.dat\nunzip -o QT-Wallet*.zip -d ~/.VERGE\nsudo rm QT-Wallet*.zip\n#// Start Verge\n" } ]
C++
MIT License
vergecurrency/verge
Update go.sh fix in case you redo go.sh multiple times. remove old snapshot.
714,116
01.12.2021 22:06:59
-3,600
3bca41037a157b7d51f08d4ac97c0e802942690f
nodes offline
[ { "change_type": "MODIFY", "old_path": "src/chainparams.cpp", "new_path": "src/chainparams.cpp", "diff": "@@ -159,11 +159,6 @@ public:\nvSeeds.emplace_back(\"u7ikxx5hloxuvyr53mwqdzgxr5cjpabqruzqrx5qfcvuv6kpa22gsjid.onion\"); //v6 SUNEROK\nvSeeds.emplace_back(\"jno3zpfsdgrtdaxlyuowipokbumoidyecmczrjru7tjfovfjkztl2pad.onion\"); //v7 Swat\nvSeeds.emplace_back(\"atzbdtcerateg5qybprv7edubuh35gywu3hkjvj4ks7s2whxyje2hzyd.onion\"); //v7 Swat\n- vSeeds.emplace_back(\"yvvioyzj3w5k6z64urv55xuh65oftcy5wts4tgwpi6hxdeixamsn63qd.onion\"); //v6 Marplez SGP\n- vSeeds.emplace_back(\"zwvqhwne3mlefxd52q35cckzdo46uhvcuvl7qdzqlatgpfqe4r43suid.onion\"); //v6 Marplez AMS\n- vSeeds.emplace_back(\"ojmwnkopgmpotm2byx7vsm7xplqxhctutw3d3ve7k5mbybsuydfk46qd.onion\"); //v6 Marplez NYC\n- vSeeds.emplace_back(\"g7cbcrcxdy7kszjmvw62bfm5douesjtkioqycc6m4gpomybcsohba7ad.onion\"); //v6 2lazy2debug DE\n- vSeeds.emplace_back(\"2zju2kcvt55h3v5dnghtduw5hrqqlt6nggngtyjnrjgybu7tqz4wvdad.onion\"); //v6 2lazy2debug NL\nvSeeds.emplace_back(\"3zal3m6ixo3vhvaeihybqi4r7vs33l2a4x7qce2gb6seqog2sk67lkyd.onion\");\nvSeeds.emplace_back(\"jcq2di2z5t2x6xibjuak4syslkx46rkid6vpuzys3rnn65vhwfywhrid.onion\");\nvSeeds.emplace_back(\"urtf7ovgjnxilnbxppmhvjebxcwk4ofo36mgz4kmwr7i4aqimdknf7ad.onion\");\n" } ]
C++
MIT License
vergecurrency/verge
nodes offline
714,139
10.12.2021 09:01:55
28,800
6bc0a627fd467ae8c4395a26cf81f57ab7e4ad29
adds additional new dedicated testnet node
[ { "change_type": "MODIFY", "old_path": "src/chainparams.cpp", "new_path": "src/chainparams.cpp", "diff": "@@ -338,6 +338,7 @@ public:\nvFixedSeeds.clear();\nvSeeds.clear();\n// nodes with support for servicebits filtering should be at the top\n+ vSeeds.emplace_back(\"uacxdw34wnfybshfjs6hxdfzwkqxs765peu4iyyakqnz2mqyvspubeqd.onion\"); // dedicated testnet server\nvSeeds.emplace_back(\"2l7hxpeyhmy4c2tnlmgf7rgcn6epsaaspv7473f3r5uncqzs6pnltqqd.onion\");\nvSeeds.emplace_back(\"qwwqi7h6bkkcw6clp34ttg5mxmcwerkot2hepfhi6g4yclvlhsv2kxid.onion\");\nvSeeds.emplace_back(\"2l7hxpeyhmy4c2tnlmgf7rgcn6epsaaspv7473f3r5uncqzs6pnltqqd.onion\");\n" } ]
C++
MIT License
vergecurrency/verge
adds additional new dedicated testnet node
714,139
10.12.2021 14:32:40
28,800
efdf3c6ae8dad439846edafdc882f54438a74e87
updates README.md to include new dedicated testnet server
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -264,7 +264,8 @@ algo=blake\n## TestNet\nHere is a list of active testnet nodes:\n-ddvnucmtvyiemiuk.onion (sunerok)\n+* ddvnucmtvyiemiuk.onion (sunerok)\n+* uacxdw34wnfybshfjs6hxdfzwkqxs765peu4iyyakqnz2mqyvspubeqd.onion (dedicated testnet)\n## Donations\n" } ]
C++
MIT License
vergecurrency/verge
updates README.md to include new dedicated testnet server
714,116
22.12.2021 23:27:09
-3,600
ccbf1bd6e21ff9e1f4bbb89e68d1b823c47d3121
compile libboost 1.74+ without errors
[ { "change_type": "MODIFY", "old_path": "src/validation.cpp", "new_path": "src/validation.cpp", "diff": "#include <boost/algorithm/string/replace.hpp>\n#include <boost/algorithm/string/join.hpp>\n#include <boost/thread.hpp>\n+#include <boost/bind.hpp>\n#if defined(NDEBUG)\n# error \"VERGE cannot be compiled without assertions.\"\n" }, { "change_type": "MODIFY", "old_path": "src/validationinterface.cpp", "new_path": "src/validationinterface.cpp", "diff": "#include <unordered_map>\n#include <boost/signals2/signal.hpp>\n+#include <boost/bind.hpp>\nstruct MainSignalsInstance {\nboost::signals2::signal<void (const CBlockIndex *, const CBlockIndex *, bool fInitialDownload)> UpdatedBlockTip;\n" } ]
C++
MIT License
vergecurrency/verge
compile libboost 1.74+ without errors
714,116
14.01.2022 12:47:30
-3,600
037253ff1e6713ec469568f331bdf685e4a4df3a
add node testnet
[ { "change_type": "MODIFY", "old_path": "src/chainparams.cpp", "new_path": "src/chainparams.cpp", "diff": "@@ -315,6 +315,7 @@ public:\nvSeeds.clear();\n// nodes with support for servicebits filtering should be at the top\nvSeeds.emplace_back(\"uacxdw34wnfybshfjs6hxdfzwkqxs765peu4iyyakqnz2mqyvspubeqd.onion\"); // dedicated testnet server\n+ vSeeds.emplace_back(\"bp2m36a7b7t4yyciawcqoi2x2iuizrnnagb4nkm7gozo7yd2sjbdr6ad.onion\"); // testnet blockchain explorer\nvSeeds.emplace_back(\"2l7hxpeyhmy4c2tnlmgf7rgcn6epsaaspv7473f3r5uncqzs6pnltqqd.onion\");\nvSeeds.emplace_back(\"qwwqi7h6bkkcw6clp34ttg5mxmcwerkot2hepfhi6g4yclvlhsv2kxid.onion\");\nvSeeds.emplace_back(\"2l7hxpeyhmy4c2tnlmgf7rgcn6epsaaspv7473f3r5uncqzs6pnltqqd.onion\");\n" } ]
C++
MIT License
vergecurrency/verge
add node testnet
714,108
21.05.2022 07:01:38
14,400
a66beeaab6b03087e8f4c5fe4d7a8a9fe8721508
Update go.sh blockchain download site, now hide download link for robots with a script strange, fixed the grab file. made ubuntu 22.04 work
[ { "change_type": "MODIFY", "old_path": "go.sh", "new_path": "go.sh", "diff": "@@ -124,6 +124,10 @@ echo \"${green}BerkeleyDb already present...$(grep --include *.h -r '/usr/' -e 'D\nelse\nwget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz\ntar -xzvf db-4.8.30.NC.tar.gz\n+result8=$(cat /etc/issue | grep -Po '22.04')\n+if [ $result8= \"22.04\"]\n+then\n+sed -i 's/__atomic_compare_exchange/__db_atomic_compare_exchange/g' ~/db-4.8.30.NC/dbinc/atomic.h\nresult7=$(cat /etc/issue | grep -Po 'GNU/Linux')\nif [ $result7 = \"GNU/Linux\" ]\nthen\n@@ -323,8 +327,8 @@ cd ~\necho -n \"Success....Blockchain is now downloading press Ctrl-C to cancel but it will take longer to sync from 0. And you will have to start verge manual\"\nsudo rm QT-Wallet*.zip\n-echo \"wget --no-check-certificate \" $(lynx --dump --listonly https://verge-blockchain.com/ | grep -o \"https://verge-blockchain*.*zip\" | head -1 ) > link.sh\n-sh link.sh\n+# echo \"wget --no-check-certificate \" $(lynx --dump --listonly https://verge-blockchain.com/ | grep -o \"https://verge-blockchain*.*zip\" | head -1 ) > link.sh\n+echo \"wget --no-check-certificate https://verge-blockchain.com/download/\"$(lynx --source https://verge-blockchain.com/ | grep -o \"**QT-Wallet**_.*zip\" | head -1 ) > link.sh\nsudo rm -Rf ~/.VERGE/blocks\nsudo rm -Rf ~/.VERGE/chainstate\nsudo rm -Rf ~/.VERGE/tor\n" } ]
C++
MIT License
vergecurrency/verge
Update go.sh blockchain download site, now hide download link for robots with a script strange, fixed the grab file. made ubuntu 22.04 work
714,116
04.10.2022 11:26:13
-7,200
fcf68154068630861f17c6a6083b79504c264ba8
seeds offline, remove
[ { "change_type": "MODIFY", "old_path": "src/chainparams.cpp", "new_path": "src/chainparams.cpp", "diff": "@@ -138,16 +138,10 @@ public:\n// Adding some nodes in case it works\nif (!gArgs.IsArgSet(\"-without-tor\") || gArgs.GetBoolArg(\"-dynamic-network\", false)) {\n// protocol-90009 with proper TOR v3 support\n- vSeeds.emplace_back(\"f3cy2jkmfl3qzqpk4srruhpefkunq3rj6wi7z57yzinyxpk3rmbluoad.onion\"); //v7 SUNEROK\n- vSeeds.emplace_back(\"3czrw4cxofudpyhl46whvcyzgmkciaai2uw7s6motxejb3fijdkgmuqd.onion\"); //v7 SUNEROK\n- vSeeds.emplace_back(\"7yiwfnm5xkmhsw5duuvkbwrmrtctmdnq6qbmlkfroth5wspyx7oig7id.onion\"); //v7 SUNEROK\nvSeeds.emplace_back(\"xuet3co7iz2qcojnc6peuvm5gqkvn6gn6dzbvhsljurtbt2kpokxqbad.onion\"); //v7 Swat\nvSeeds.emplace_back(\"rg26lmazggizrw7hhesrav2mvzkvuftyaqpkpldxl6ywuscuhh3lrsyd.onion\"); //v7 Swat\n- vSeeds.emplace_back(\"qswnv5grptfwfbhm6y56b5vbjr4b7pyhsuhq5gaynjs632qgot5so5qd.onion\"); //v7\nvSeeds.emplace_back(\"kb2bgqdwmxwxekxkc6g2s7diramjhdbiqhyxoesbzvlqsbqo7ws5l2qd.onion\"); //v7\n- vSeeds.emplace_back(\"3czrw4cxofudpyhl46whvcyzgmkciaai2uw7s6motxejb3fijdkgmuqd.onion\"); //v7\nvSeeds.emplace_back(\"shtsxnyxjjplkfifdwoz22u7xef7os2fhaq3j7bkk5md37wj7ors4yqd.onion\"); //v7\n- vSeeds.emplace_back(\"6k7grjy6laipvkqopiueicjlfulj2wzw3pfhtynnc7jggnunkpo4w7id.onion\"); //v7\nvSeeds.emplace_back(\"afppaj6ugeskfyjo2z24sjo37572ln7ggfkcuk3a5lkhznpqsfgxw6qd.onion\"); //v7\nvSeeds.emplace_back(\"urtf7ovgjnxilnbxppmhvjebxcwk4ofo36mgz4kmwr7i4aqimdknf7ad.onion\"); //v7\nvSeeds.emplace_back(\"4omta4xmldql2xqv5ji2rjplejqrd56yst6jlsork43ayb3rbhkpywyd.onion\"); //v7\n@@ -159,9 +153,7 @@ public:\nvSeeds.emplace_back(\"xcb4tbu5vywfbiehqj5p56wlpoq4nd4e62ujfhsydbvvrjn6mev2juad.onion\"); //v7\nvSeeds.emplace_back(\"ractae3zucrklqxwpcu66ujbssfnrewzwdjzd5r3f3prapnpt2a2pzqd.onion\"); //v7\nvSeeds.emplace_back(\"myg3o4o5xe2d4ht2hsguxwbbvkbv5wbthkzztc243oycstapsyldcdqd.onion\"); //v7\n- vSeeds.emplace_back(\"ve7loixakguboazsfhwiutinappw4ix344tv2bieuz3pj4flgjxur6qd.onion\"); //v7\nvSeeds.emplace_back(\"accu36f6dg5e54axjcytitblk4r736uenuvs6fzbp77m3akfxztpeqqd.onion\"); //v7\n- vSeeds.emplace_back(\"oduosqof5sbkjkqcv72eudjt5bgp7towqodtjo767xelc4qcmlibpjad.onion\"); //v7\nvSeeds.emplace_back(\"dzp3twhnyccmyv2mchkhcihgvobgbhwj23bum7esdtg3ajyaheaxswyd.onion\"); //v7\n}\n" } ]
C++
MIT License
vergecurrency/verge
seeds offline, remove
714,116
02.11.2022 09:38:53
-3,600
44bebd524de6783efc33becda96ae69dcc590b72
unstoppable domains, https request
[ { "change_type": "MODIFY", "old_path": "src/qt/guiconstants.h", "new_path": "src/qt/guiconstants.h", "diff": "@@ -55,7 +55,7 @@ static const int MAX_URI_LENGTH = 255;\n#define QAPP_APP_NAME_TESTNET \"verge-qt-testnet\"\n#define UNS_API_KEY \"Bearer e2bec832-7a87-41cc-bc67-1aac72e2e033\"\n-#define UNS_API \"http://resolve.unstoppabledomains.com/domains/\"\n+#define UNS_API \"https://resolve.unstoppabledomains.com/domains/\"\n#define UNS_XVG_RECORD \"crypto.XVG.address\"\n#endif // VERGE_QT_GUICONSTANTS_H\n" } ]
C++
MIT License
vergecurrency/verge
unstoppable domains, https request
714,116
02.11.2022 09:44:29
-3,600
8bd4d1035aa7cebcc5bbcd3d145ce920d93141ba
add URL explorer testnet
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -49,6 +49,7 @@ Block Number Range | Reward\n## Resources\n* [Blockchain Explorer](https://verge-blockchain.info/)\n+* [Blockchain Explorer Testnet](https://testnet.verge-blockchain.info/)\n* [Mining Pool List](https://vergecurrency.com/community/xvg-mining-pools/)\n* [Black Paper](https://vergecurrency.com/static/blackpaper/Verge-Anonymity-Centric-CryptoCurrency.pdf)\n" } ]
C++
MIT License
vergecurrency/verge
add URL explorer testnet
714,098
11.11.2022 00:50:38
18,000
d2e0a255f0502ec85bfaaf7c7237000a2e4b4199
update boost ver in depends
[ { "change_type": "MODIFY", "old_path": "depends/packages/boost.mk", "new_path": "depends/packages/boost.mk", "diff": "package=boost\n-$(package)_version=1_64_0\n-$(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/\n-$(package)_file_name=$(package)_$($(package)_version).tar.bz2\n-$(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332\n+$(package)_version=1_71_0\n+$(package)_download_path=https://boostorg.jfrog.io/artifactory/main/release/$(subst _,.,$($(package)_version))/source/\n+$(package)_file_name=boost_$($(package)_version).tar.bz2\n+$(package)_sha256_hash=d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee\n+$(package)_dependencies=native_b2\ndefine $(package)_set_vars\n$(package)_config_opts_release=variant=release\n$(package)_config_opts_debug=variant=debug\n$(package)_config_opts=--layout=tagged --build-type=complete --user-config=user-config.jam\n-$(package)_config_opts+=threading=multi link=static -sNO_BZIP2=1 -sNO_ZLIB=1\n-$(package)_config_opts_linux=threadapi=pthread runtime-link=shared\n-$(package)_config_opts_darwin=--toolset=darwin-4.2.1 runtime-link=shared\n-$(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win32 runtime-link=static\n-$(package)_config_opts_x86_64_mingw32=address-model=64\n-$(package)_config_opts_i686_mingw32=address-model=32\n-$(package)_config_opts_i686_linux=address-model=32 architecture=x86\n+$(package)_config_opts+=threading=multi link=static -sNO_COMPRESSION=1\n+$(package)_config_opts_linux=target-os=linux threadapi=pthread runtime-link=shared\n+$(package)_config_opts_darwin=target-os=darwin runtime-link=shared\n+$(package)_config_opts_mingw32=target-os=windows binary-format=pe threadapi=win32 runtime-link=static\n+$(package)_config_opts_x86_64=architecture=x86 address-model=64\n+$(package)_config_opts_i686=architecture=x86 address-model=32\n+$(package)_config_opts_aarch64=address-model=64\n+$(package)_config_opts_armv7a=address-model=32\n+ifneq (,$(findstring clang,$($(package)_cxx)))\n+$(package)_toolset_$(host_os)=clang\n+else\n$(package)_toolset_$(host_os)=gcc\n-$(package)_archiver_$(host_os)=$($(package)_ar)\n-$(package)_toolset_darwin=darwin\n-$(package)_archiver_darwin=$($(package)_libtool)\n-$(package)_config_libraries=chrono,filesystem,program_options,system,thread,test\n-$(package)_cxxflags=-std=c++11 -fvisibility=hidden\n+endif\n+$(package)_config_libraries=filesystem,system,test\n+$(package)_cxxflags=-std=c++17 -fvisibility=hidden\n$(package)_cxxflags_linux=-fPIC\n+$(package)_cxxflags_android=-fPIC\n+$(package)_cxxflags_x86_64_darwin=-fcf-protection=full\nendef\ndefine $(package)_preprocess_cmds\n- echo \"using $(boost_toolset_$(host_os)) : : $($(package)_cxx) : <cxxflags>\\\"$($(package)_cxxflags) $($(package)_cppflags)\\\" <linkflags>\\\"$($(package)_ldflags)\\\" <archiver>\\\"$(boost_archiver_$(host_os))\\\" <striper>\\\"$(host_STRIP)\\\" <ranlib>\\\"$(host_RANLIB)\\\" <rc>\\\"$(host_WINDRES)\\\" : ;\" > user-config.jam\n+ echo \"using $($(package)_toolset_$(host_os)) : : $($(package)_cxx) : <cflags>\\\"$($(package)_cflags)\\\" <cxxflags>\\\"$($(package)_cxxflags)\\\" <compileflags>\\\"$($(package)_cppflags)\\\" <linkflags>\\\"$($(package)_ldflags)\\\" <archiver>\\\"$($(package)_ar)\\\" <striper>\\\"$(host_STRIP)\\\" <ranlib>\\\"$(host_RANLIB)\\\" <rc>\\\"$(host_WINDRES)\\\" : ;\" > user-config.jam\nendef\ndefine $(package)_config_cmds\n- ./bootstrap.sh --without-icu --with-libraries=$(boost_config_libraries)\n+ ./bootstrap.sh --without-icu --with-libraries=$($(package)_config_libraries) --with-toolset=$($(package)_toolset_$(host_os)) --with-bjam=b2\nendef\ndefine $(package)_build_cmds\n- ./b2 -d2 -j2 -d1 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) stage\n+ b2 -d2 -j2 -d1 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) toolset=$($(package)_toolset_$(host_os)) stage\nendef\ndefine $(package)_stage_cmds\n- ./b2 -d0 -j4 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) install\n+ b2 -d0 -j4 --prefix=$($(package)_staging_prefix_dir) $($(package)_config_opts) toolset=$($(package)_toolset_$(host_os)) install\nendef\n" } ]
C++
MIT License
vergecurrency/verge
update boost ver in depends
714,116
01.12.2022 22:38:23
-3,600
1395e69ff619dbf6ef4839740967082cf67dda88
seeds offline, delete
[ { "change_type": "MODIFY", "old_path": "src/chainparams.cpp", "new_path": "src/chainparams.cpp", "diff": "@@ -143,11 +143,9 @@ public:\nvSeeds.emplace_back(\"kb2bgqdwmxwxekxkc6g2s7diramjhdbiqhyxoesbzvlqsbqo7ws5l2qd.onion\"); //v7\nvSeeds.emplace_back(\"shtsxnyxjjplkfifdwoz22u7xef7os2fhaq3j7bkk5md37wj7ors4yqd.onion\"); //v7\nvSeeds.emplace_back(\"afppaj6ugeskfyjo2z24sjo37572ln7ggfkcuk3a5lkhznpqsfgxw6qd.onion\"); //v7\n- vSeeds.emplace_back(\"urtf7ovgjnxilnbxppmhvjebxcwk4ofo36mgz4kmwr7i4aqimdknf7ad.onion\"); //v7\nvSeeds.emplace_back(\"4omta4xmldql2xqv5ji2rjplejqrd56yst6jlsork43ayb3rbhkpywyd.onion\"); //v7\nvSeeds.emplace_back(\"7q6c6glv5hp5humq3wh5qzlt7jp3s3cacpznjzu2jehkmf7fivy2jmid.onion\"); //v7\nvSeeds.emplace_back(\"ka2e2kaw5oxsyykw3ykdvba43eya6cotzm2huvvtrt7fw3dm62ztqfid.onion\"); //v7\n- vSeeds.emplace_back(\"tvrceykeeaxtxcj77qm2ekgqvtc5kmxrlkrorlz542kiie5wzec5pqad.onion\"); //v7\nvSeeds.emplace_back(\"xzpuglxfng6lypn2ggnqeiwpo5uyzbnrlwmutgoboeji6aru7oxqjeid.onion\"); //v7\nvSeeds.emplace_back(\"4wqkmkldxngbemhlebywhsjzmlqwbveksqbadcjj7ga6ctbrrcs6q3id.onion\"); //v7\nvSeeds.emplace_back(\"xcb4tbu5vywfbiehqj5p56wlpoq4nd4e62ujfhsydbvvrjn6mev2juad.onion\"); //v7\n" } ]
C++
MIT License
vergecurrency/verge
seeds offline, delete
428,986
28.06.2019 21:10:39
21,600
5b46ab99497ec97419eb087fb3e92ae9312c1b83
first pass adding DPL to downloader
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -60,6 +60,7 @@ Docs: [docs.moov.io](https://docs.moov.io/ofac/) | [api docs](https://api.moov.i\n|-----|-----|-----|\n| `OFAC_DATA_REFRESH` | Interval for OFAC data redownload and reparse. | 12h |\n| `OFAC_DOWNLOAD_TEMPLATE` | HTTP address for downloading raw OFAC files. | (OFAC website) |\n+| `DPL_DOWNLOAD_TEMPLATE` | HTTP address for downloading the DPL | (BIS website) |\n| `SQLITE_DB_PATH`| Local filepath location for the paygate SQLite database. | `ofac.db` |\n| `WEBHOOK_BATCH_SIZE` | How many watches to read from database per batch of async searches. | 100 |\n| `LOG_FORMAT` | Format for logging lines to be written as. | Options: `json`, `plain` - Default: `plain` |\n" }, { "change_type": "MODIFY", "old_path": "download.go", "new_path": "download.go", "diff": "@@ -22,12 +22,20 @@ var (\n\"sdn_comments.csv\", // Specially Designated National Comments\n}\nofacURLTemplate = \"https://www.treasury.gov/ofac/downloads/%s\"\n+\n+ dplFilenames = []string{\n+ \"dpl.txt\", // Denied Persons List (tab separated)\n+ }\n+ dplURLTemplate = \"https://www.bis.doc.gov/dpl/%s\"\n)\nfunc init() {\nif v := os.Getenv(\"OFAC_DOWNLOAD_TEMPLATE\"); v != \"\" {\nofacURLTemplate = v\n}\n+ if w := os.Getenv(\"DPL_DOWNLOAD_TEMPLATE\"); w != \"\" {\n+ dplURLTemplate = w\n+ }\n}\n// Downloader will download and cache OFAC files in a temp directory.\n@@ -39,7 +47,7 @@ type Downloader struct {\nHTTP *http.Client\n}\n-// getFiles will download all OFAC related files and store them in a temporary directory\n+// GetFiles will download all OFAC related files and store them in a temporary directory\n// returned and an error otherwise.\n//\n// Callers are expected to cleanup the temp directory.\n@@ -48,21 +56,27 @@ func (dl *Downloader) GetFiles() (string, error) {\ndl.HTTP = http.DefaultClient\n}\n- dir, err := ioutil.TempDir(\"\", \"ofac-downloader\")\n+ dir, err := ioutil.TempDir(\"\", \"blacklist-downloader\")\nif err != nil {\nreturn \"\", fmt.Errorf(\"OFAC: unable to make temp dir: %v\", err)\n}\n- wg := sync.WaitGroup{}\n- wg.Add(len(ofacFilenames))\n-\n- for i := range ofacFilenames {\n- name := ofacFilenames[i]\n+ // create a single list containing all filenames and source URLs\n+ namesAndSources := make(map[string]string)\n+ for _, fname := range ofacFilenames {\n+ namesAndSources[fname] = fmt.Sprintf(ofacURLTemplate, fname)\n+ }\n+ for _, fname := range dplFilenames {\n+ namesAndSources[fname] = fmt.Sprintf(dplURLTemplate, fname)\n+ }\n- go func(wg *sync.WaitGroup, filename string) {\n+ wg := sync.WaitGroup{}\n+ wg.Add(len(namesAndSources))\n+ for name, source := range namesAndSources {\n+ go func(wg *sync.WaitGroup, filename, downloadURL string) {\ndefer wg.Done()\n- resp, err := dl.HTTP.Get(fmt.Sprintf(ofacURLTemplate, filename))\n+ resp, err := dl.HTTP.Get(downloadURL)\nif err != nil {\nreturn\n}\n@@ -76,15 +90,15 @@ func (dl *Downloader) GetFiles() (string, error) {\ndefer fd.Close()\nio.Copy(fd, resp.Body) // copy contents\n- }(&wg, name)\n+ }(&wg, name, source)\n}\nwg.Wait()\n// count files and error if the count isn't what we expected\nfds, err := ioutil.ReadDir(dir)\n- if err != nil || len(fds) != len(ofacFilenames) {\n- return \"\", fmt.Errorf(\"OFAC: problem downloading (found=%d, expected=%d): err=%v\", len(fds), len(ofacFilenames), err)\n+ if err != nil || len(fds) != len(namesAndSources) {\n+ return \"\", fmt.Errorf(\"OFAC: problem downloading (found=%d, expected=%d): err=%v\", len(fds), len(namesAndSources), err)\n}\nreturn dir, nil\n" }, { "change_type": "MODIFY", "old_path": "download_test.go", "new_path": "download_test.go", "diff": "@@ -23,13 +23,15 @@ func TestDownloader(t *testing.T) {\nif err != nil {\nt.Fatal(err)\n}\n- if len(fds) != len(ofacFilenames) {\n- t.Errorf(\"OAFC: expected %d files but found %d\", len(fds), len(ofacFilenames))\n+\n+ numFiles := len(ofacFilenames) + len(dplFilenames)\n+ if len(fds) != numFiles {\n+ t.Errorf(\"OAFC: expected %d files but found %d\", len(fds), numFiles)\n}\nfor i := range fds {\nname := fds[i].Name()\nswitch name {\n- case \"add.csv\", \"alt.csv\", \"sdn.csv\", \"sdn_comments.csv\":\n+ case \"add.csv\", \"alt.csv\", \"sdn.csv\", \"sdn_comments.csv\", \"dpl.txt\":\ncontinue\ndefault:\nt.Errorf(\"unknown file %s\", name)\n" } ]
Go
Apache License 2.0
moov-io/watchman
first pass adding DPL to downloader
428,986
28.06.2019 23:17:38
21,600
a10ac437094e8275f6363a1188330096a6ce8b99
add model and parsing for DPL
[ { "change_type": "MODIFY", "old_path": "ofac.go", "new_path": "ofac.go", "diff": "@@ -72,3 +72,31 @@ type SDNComments struct {\n// RemarksExtended is remarks extended on a Specially Designated National\nRemarksExtended string `json:\"remarksExtended\"`\n}\n+\n+// DPL is the BIS Denied Persons List\n+type DPL struct {\n+ // Name is the name of the Denied Person\n+ Name string `json:\"name\"`\n+ // StreetAddress is the Denied Person's street address\n+ StreetAddress string `json:\"streetAddress\"`\n+ // City is the Denied Person's city\n+ City string `json:\"city\"`\n+ // State is the Denied Person's state\n+ State string `json:\"state\"`\n+ // Country is the Denied Person's country\n+ Country string `json:\"country\"`\n+ // PostalCode is the Denied Person's postal code\n+ PostalCode string `json:\"postalCode\"`\n+ // EffectiveDate is the date the denial came into effect\n+ EffectiveDate string `json:\"effectiveDate\"`\n+ // ExpirationDate is the date the denial expires. If blank, the denial has no expiration\n+ ExpirationDate string `json:\"expirationDate\"`\n+ // StandardOrder denotes whether or not the Person was added to the list by a \"standard\" order\n+ StandardOrder string `json:\"standardOrder\"`\n+ // LastUpdate is the date of the most recent change to the denial\n+ LastUpdate string `json:\"lastUpdate\"`\n+ // Action is the most recent action taken regarding the denial\n+ Action string `json:\"action\"`\n+ // FRCitation is the reference to the order's citation in the Federal Register\n+ FRCitation string `json:\"frCitation\"`\n+}\n" }, { "change_type": "MODIFY", "old_path": "reader.go", "new_path": "reader.go", "diff": "@@ -20,6 +20,11 @@ const (\n// csvFile is an OFAC CSVfile\ncsvFile = \".csv\"\n+ // txtFile is a DPL tab-delimited file\n+ // it should be a \".tsv\" file, but BIS named it \".txt\"...\n+ txtFile = \".txt\"\n+ txtDelim = '\\n'\n+\n// addressFile is an OFAC Specially Designated National (SDN) address File\naddressFile = \"add.csv\"\n// alternateIDFile is an OFAC Specially Designated National (SDN) alternate ID File\n@@ -28,6 +33,9 @@ const (\nspeciallyDesignatedNationalFile = \"sdn.csv\"\n// speciallyDesignatedNationalCommentsFile is an OFAC Specially Designated National (SDN) Comments File\nspeciallyDesignatedNationalCommentsFile = \"sdn_comments.csv\"\n+\n+ // deniedPersonsListFile is the Denied Persons List provided by the Bureau of Industry and Security, US Department of Commerce\n+ deniedPersonsListFile = \"dpl.txt\"\n)\n// Error strings specific to parsing/reading an OFAC file\n@@ -63,6 +71,8 @@ type Reader struct {\nSDNs []*SDN `json:\"sdn\"`\n// SDNComments returns an array of OFAC Specially Designated National Comments\nSDNComments []*SDNComments `json:\"sdnComments\"`\n+ // DPL returns an array of BIS Denied Persons\n+ DeniedPersons []*DPL\n// errors holds each error encountered when attempting to parse the file\nerrors base.ErrorList\n}\n@@ -76,6 +86,10 @@ func (r *Reader) Read() error {\nif err := r.csvFile(); err != nil {\nreturn err\n}\n+ case txtFile:\n+ if err := r.txtFile(); err != nil {\n+ return err\n+ }\ndefault:\nmsg := fmt.Sprintf(msgFileExtension, ext)\nr.errors.Add(r.parseError(errors.New(msg)))\n@@ -247,6 +261,52 @@ func (r *Reader) csvSDNCommentsFile() error {\nreturn nil\n}\n+func (r *Reader) txtFile() error {\n+ if strings.Contains(r.FileName, deniedPersonsListFile) {\n+ if err := r.txtDeniedPersonsFile(); err != nil {\n+ return err\n+ }\n+ }\n+ return nil\n+}\n+\n+func (r *Reader) txtDeniedPersonsFile() error {\n+ // open txt file\n+ f, err := os.Open(r.FileName)\n+ if err != nil {\n+ return err\n+ }\n+ defer f.Close()\n+\n+ // create a new csv.Reader and set the delim char to txtDelim char\n+ reader := csv.NewReader(f)\n+ reader.Comma = txtDelim\n+ // Read File into a Variable\n+ lines, err := reader.ReadAll()\n+ if err != nil {\n+ return err\n+ }\n+\n+ for _, txtLine := range lines {\n+ deniedPerson := &DPL{\n+ Name: txtLine[0],\n+ StreetAddress: txtLine[1],\n+ City: txtLine[2],\n+ State: txtLine[3],\n+ Country: txtLine[4],\n+ PostalCode: txtLine[5],\n+ EffectiveDate: txtLine[6],\n+ ExpirationDate: txtLine[7],\n+ StandardOrder: txtLine[8],\n+ LastUpdate: txtLine[9],\n+ Action: txtLine[10],\n+ FRCitation: txtLine[11],\n+ }\n+ r.DeniedPersons = append(r.DeniedPersons, deniedPerson)\n+ }\n+ return nil\n+}\n+\n// replaceNull replaces a CSV field that contain -0- with \"\". Null values for all four formats consist of \"-0-\"\n// (ASCII characters 45, 48, 45).\nfunc replaceNull(s []string) []string {\n" } ]
Go
Apache License 2.0
moov-io/watchman
add model and parsing for DPL
428,986
01.07.2019 09:53:23
21,600
e443f0b2dd170830f91fdc862b7fa09b6630de40
add dpl to download and precompute
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -13,8 +13,8 @@ import (\n\"path/filepath\"\n\"time\"\n- moovhttp \"github.com/moov-io/base/http\"\n\"github.com/cardonator/ofac\"\n+ moovhttp \"github.com/moov-io/base/http\"\n\"github.com/go-kit/kit/log\"\n\"github.com/gorilla/mux\"\n@@ -32,19 +32,21 @@ func init() {\nprometheus.MustRegister(lastOFACDataRefreshSuccess)\n}\n-// Download holds counts for each type of OFAC data parsed from files and a\n+// Download holds counts for each type of OFAC and BIS data parsed from files and a\n// timestamp of when the download happened.\ntype Download struct {\nTimestamp time.Time `json:\"timestamp\"`\nSDNs int `json:\"SDNs\"`\nAlts int `json:\"altNames\"`\nAddresses int `json:\"addresses\"`\n+ DeniedPersons int `json:\"deniedPersons\"`\n}\ntype downloadStats struct {\nSDNs int `json:\"SDNs\"`\nAlts int `json:\"altNames\"`\nAddresses int `json:\"addresses\"`\n+ DeniedPersons int `json:\"deniedPersons\"`\n}\n// periodicDataRefresh will forever block for interval's duration and then download and reparse the OFAC data.\n@@ -55,32 +57,32 @@ func (s *searcher) periodicDataRefresh(interval time.Duration, downloadRepo down\nstats, err := s.refreshData()\nif err != nil {\nif s.logger != nil {\n- s.logger.Log(\"main\", fmt.Sprintf(\"ERROR: refreshing OFAC data: %v\", err))\n+ s.logger.Log(\"main\", fmt.Sprintf(\"ERROR: refreshing blacklist data: %v\", err))\n}\n} else {\ndownloadRepo.recordStats(stats)\nif s.logger != nil {\n- s.logger.Log(\"main\", fmt.Sprintf(\"OFAC data refreshed - Addresses=%d AltNames=%d SDNs=%d\", stats.Addresses, stats.Alts, stats.SDNs))\n+ s.logger.Log(\"main\", fmt.Sprintf(\"Blacklist data refreshed - Addresses=%d AltNames=%d SDNs=%d DPL=%d\", stats.Addresses, stats.Alts, stats.SDNs, stats.DeniedPersons))\n}\nupdates <- stats // send stats for re-search and watch notifications\n}\n}\n}\n-// refreshData reaches out to the OFAC website to download the latest files and then runs ofac.Reader to\n+// refreshData reaches out to the OFAC and BIS websites to download the latest files and then runs ofac.Reader to\n// parse and index data for searches.\nfunc (s *searcher) refreshData() (*downloadStats, error) {\nif s.logger != nil {\n- s.logger.Log(\"download\", \"Starting refresh of OFAC data\")\n+ s.logger.Log(\"download\", \"Starting refresh of blacklist data\")\n}\n// Download files\ndir, err := (&ofac.Downloader{}).GetFiles()\nif err != nil {\n- return nil, fmt.Errorf(\"ERROR: downloading OFAC data: %v\", err)\n+ return nil, fmt.Errorf(\"ERROR: downloading blacklist data: %v\", err)\n}\n- // Parse each OFAC file\n+ // Parse each file\nr := &ofac.Reader{}\nr.FileName = filepath.Join(dir, \"add.csv\")\nif err := r.Read(); err != nil {\n@@ -94,16 +96,22 @@ func (s *searcher) refreshData() (*downloadStats, error) {\nif err := r.Read(); err != nil {\nreturn nil, fmt.Errorf(\"ERROR: reading sdn.csv: %v\", err)\n}\n+ r.FileName = filepath.Join(dir, \"dpl.txt\")\n+ if err := r.Read(); err != nil {\n+ return nil, fmt.Errorf(\"ERROR: reading dpl.txt: %v\", err)\n+ }\n// Precompute new data once for slight performance win\nsdns := precomputeSDNs(r.SDNs)\nadds := precomputeAddresses(r.Addresses)\nalts := precomputeAlts(r.AlternateIdentities)\n+ dps := precomputeDPs(r.DeniedPersons)\nstats := &downloadStats{\nSDNs: len(sdns),\nAlts: len(alts),\nAddresses: len(adds),\n+ DeniedPersons: len(dps),\n}\n// Set new records after precomputation (to minimize lock contention)\n@@ -111,10 +119,11 @@ func (s *searcher) refreshData() (*downloadStats, error) {\ns.SDNs = sdns\ns.Addresses = adds\ns.Alts = alts\n+ s.DPs = dps\ns.Unlock()\nif s.logger != nil {\n- s.logger.Log(\"download\", \"Finished refresh of OFAC data\")\n+ s.logger.Log(\"download\", \"Finished refresh of blacklist data\")\n}\n// record successful data refresh\n@@ -165,19 +174,19 @@ func (r *sqliteDownloadRepository) recordStats(stats *downloadStats) error {\nreturn errors.New(\"recordStats: nil downloadStats\")\n}\n- query := `insert into ofac_download_stats (downloaded_at, sdns, alt_names, addresses) values (?, ?, ?, ?);`\n+ query := `insert into ofac_download_stats (downloaded_at, sdns, alt_names, addresses, denied_persons) values (?, ?, ?, ?, ?);`\nstmt, err := r.db.Prepare(query)\nif err != nil {\nreturn err\n}\ndefer stmt.Close()\n- _, err = stmt.Exec(time.Now(), stats.SDNs, stats.Alts, stats.Addresses)\n+ _, err = stmt.Exec(time.Now(), stats.SDNs, stats.Alts, stats.Addresses, stats.DeniedPersons)\nreturn err\n}\nfunc (r *sqliteDownloadRepository) latestDownloads(limit int) ([]Download, error) {\n- query := `select downloaded_at, sdns, alt_names, addresses from ofac_download_stats order by downloaded_at desc limit ?;`\n+ query := `select downloaded_at, sdns, alt_names, addresses, denied_persons from ofac_download_stats order by downloaded_at desc limit ?;`\nstmt, err := r.db.Prepare(query)\nif err != nil {\nreturn nil, err\n@@ -193,7 +202,7 @@ func (r *sqliteDownloadRepository) latestDownloads(limit int) ([]Download, error\nvar downloads []Download\nfor rows.Next() {\nvar dl Download\n- if err := rows.Scan(&dl.Timestamp, &dl.SDNs, &dl.Alts, &dl.Addresses); err == nil {\n+ if err := rows.Scan(&dl.Timestamp, &dl.SDNs, &dl.Alts, &dl.Addresses, &dl.DeniedPersons); err == nil {\ndownloads = append(downloads, dl)\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search.go", "new_path": "cmd/server/search.go", "diff": "@@ -33,6 +33,7 @@ type searcher struct {\nSDNs []*SDN\nAddresses []*Address\nAlts []*Alt\n+ DPs []*DP\nsync.RWMutex // protects all above fields\nlogger log.Logger\n@@ -356,6 +357,35 @@ func precomputeAlts(alts []*ofac.AlternateIdentity) []*Alt {\nreturn out\n}\n+// DP is a BIS Denied Person wrapped with precomputed search metadata\n+type DP struct {\n+ DeniedPerson *ofac.DPL\n+ match float64\n+ name string\n+}\n+\n+// MarshalJSON is a custom method for marshalling a BIS Denied Person (DP)\n+func (d DP) MarshalJSON() ([]byte, error) {\n+ return json.Marshal(struct {\n+ *ofac.DPL\n+ Match float64 `json:\"match\"`\n+ }{\n+ d.DeniedPerson,\n+ d.match,\n+ })\n+}\n+\n+func precomputeDPs(persons []*ofac.DPL) []*DP {\n+ out := make([]*DP, len(persons))\n+ for i := range persons {\n+ out[i] = &DP{\n+ DeniedPerson: persons[i],\n+ name: precompute(persons[i].Name),\n+ }\n+ }\n+ return out\n+}\n+\nvar (\npunctuationReplacer = strings.NewReplacer(\".\", \"\", \",\", \"\", \"-\", \"\", \" \", \" \")\n)\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/sqlite.go", "new_path": "cmd/server/sqlite.go", "diff": "@@ -28,7 +28,7 @@ var (\n`create table if not exists company_watches(id primary key, company_id, webhook, auth_token, created_at datetime, deleted_at datetime);`,\n// OFAC download stats\n- `create table if not exists ofac_download_stats(downloaded_at datetime, sdns, alt_names, addresses);`,\n+ `create table if not exists ofac_download_stats(downloaded_at datetime, sdns, alt_names, addresses, denied_persons);`,\n// Webhook stats\n`create table if not exists webhook_stats(watch_id string, attempted_at datetime, status);`,\n" } ]
Go
Apache License 2.0
moov-io/watchman
add dpl to download and precompute
428,986
01.07.2019 10:09:37
21,600
b31c3ec3e5324b22a6b8373956436b05175bca9e
fix download_test for DPL
[ { "change_type": "MODIFY", "old_path": "cmd/server/download_test.go", "new_path": "cmd/server/download_test.go", "diff": "@@ -60,7 +60,7 @@ func TestDownload_record(t *testing.T) {\nrepo := createTestDownloadRepository(t)\ndefer repo.close()\n- stats := &downloadStats{1, 12, 42}\n+ stats := &downloadStats{1, 12, 42, 13}\nif err := repo.recordStats(stats); err != nil {\nt.Fatal(err)\n}\n@@ -93,7 +93,7 @@ func TestDownload_route(t *testing.T) {\ndefer repo.close()\n// save a record\n- repo.recordStats(&downloadStats{1, 421, 1511})\n+ repo.recordStats(&downloadStats{1, 421, 1511, 731})\nrouter := mux.NewRouter()\naddDownloadRoutes(nil, router, repo)\n" } ]
Go
Apache License 2.0
moov-io/watchman
fix download_test for DPL
428,986
01.07.2019 10:55:17
21,600
76a1783b2723c5737599c4049fabdb365b08091a
add Top* search function for DPL, added test
[ { "change_type": "MODIFY", "old_path": "cmd/server/search.go", "new_path": "cmd/server/search.go", "diff": "@@ -239,6 +239,39 @@ func (s *searcher) TopSDNs(limit int, name string) []SDN {\nreturn out\n}\n+func (s *searcher) TopDPs(limit int, name string) []DP {\n+ name = precompute(name)\n+\n+ s.RLock()\n+ defer s.RUnlock()\n+\n+ if len(s.DPs) == 0 {\n+ return nil\n+ }\n+ xs := newLargest(limit)\n+\n+ for _, dp := range s.DPs {\n+ xs.add(&item{\n+ value: dp,\n+ weight: jaroWrinkler(dp.name, name),\n+ })\n+ }\n+\n+ out := make([]DP, 0)\n+ for _, thisItem := range xs.items {\n+ if v := thisItem; v != nil {\n+ ss, ok := v.value.(*DP)\n+ if !ok {\n+ continue\n+ }\n+ dp := *ss\n+ dp.match = v.weight\n+ out = append(out, dp)\n+ }\n+ }\n+ return out\n+}\n+\n// SDN is ofac.SDN wrapped with precomputed search metadata\ntype SDN struct {\n*ofac.SDN\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_test.go", "new_path": "cmd/server/search_test.go", "diff": "@@ -71,6 +71,38 @@ var (\n},\n}),\n}\n+ dplSearcher = &searcher{\n+ DPs: precomputeDPs([]*ofac.DPL{\n+ {\n+ Name: \"AL NASER WINGS AIRLINES\",\n+ StreetAddress: \"P.O. BOX 28360\",\n+ City: \"DUBAI\",\n+ State: \"\",\n+ Country: \"AE\",\n+ PostalCode: \"\",\n+ EffectiveDate: \"06/05/2019\",\n+ ExpirationDate: \"12/03/2019\",\n+ StandardOrder: \"Y\",\n+ LastUpdate: \"2019-06-12\",\n+ Action: \"FR NOTICE ADDED, TDO RENEWAL, F.R. NOTICE ADDED, TDO RENEWAL ADDED, TDO RENEWAL ADDED, F.R. NOTICE ADDED\",\n+ FRCitation: \"82 F.R. 61745 12/29/2017, 83F.R. 28801 6/21/2018, 84 F.R. 27233 6/12/2019\",\n+ },\n+ {\n+ Name: \"PRESTON JOHN ENGEBRETSON\",\n+ StreetAddress: \"12725 ROYAL DRIVE\",\n+ City: \"STAFFORD\",\n+ State: \"TX\",\n+ Country: \"US\",\n+ PostalCode: \"77477\",\n+ EffectiveDate: \"01/24/2002\",\n+ ExpirationDate: \"01/24/2027\",\n+ StandardOrder: \"Y\",\n+ LastUpdate: \"2002-01-28\",\n+ Action: \"STANDARD ORDER\",\n+ FRCitation: \"67 F.R. 7354 2/19/02 66 F.R. 48998 9/25/01 62 F.R. 26471 5/14/97 62 F.R. 34688 6/27/97 62 F.R. 60063 11/6/97 63 F.R. 25817 5/11/98 63 F.R. 58707 11/2/98 64 F.R. 23049 4/29/99\",\n+ },\n+ }),\n+ }\n)\nfunc TestJaroWrinkler(t *testing.T) {\n@@ -335,3 +367,15 @@ func TestSearch__TopSDNs(t *testing.T) {\nt.Errorf(\"%#v\", sdns[0].SDN)\n}\n}\n+\n+func TestSearch__TopDPs(t *testing.T) {\n+ dps := dplSearcher.TopDPs(1, \"NASER AIRLINES\")\n+ if len(dps) == 0 {\n+ t.Fatal(\"empty DPs\")\n+ }\n+ t.Logf(\"%+v\\n\", dps[0])\n+ // DPL doesn't have any entity IDs. Comparing expected address components instead\n+ if dps[0].DeniedPerson.StreetAddress != \"P.O. BOX 28360\" || dps[0].DeniedPerson.City != \"DUBAI\" {\n+ t.Errorf(\"%#v\", dps[0].DeniedPerson)\n+ }\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
add Top* search function for DPL, added test
428,986
01.07.2019 13:48:48
21,600
b17926534b262568204e97664c5d7f83e49dd75f
add search handler and update test
[ { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -95,6 +95,7 @@ type searchResponse struct {\nSDNs []SDN `json:\"SDNs\"`\nAltNames []Alt `json:\"altNames\"`\nAddresses []Address `json:\"addresses\"`\n+ DeniedPersons []DP `json:\"deniedPersons\"`\n}\nfunc searchByAddress(logger log.Logger, searcher *searcher, req addressSearchRequest) http.HandlerFunc {\n@@ -153,6 +154,7 @@ func searchViaQ(logger log.Logger, searcher *searcher, name string) http.Handler\nSDNs: searcher.TopSDNs(limit, name),\nAltNames: searcher.TopAltNames(limit, name),\nAddresses: searcher.TopAddresses(limit, name),\n+ DeniedPersons: searcher.TopDPs(limit, name),\n}\nw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\nw.WriteHeader(http.StatusOK)\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers_test.go", "new_path": "cmd/server/search_handlers_test.go", "diff": "@@ -152,6 +152,7 @@ func TestSearch__NameAndAltName(t *testing.T) {\nAlts: altSearcher.Alts,\nSDNs: sdnSearcher.SDNs,\nAddresses: addressSearcher.Addresses,\n+ DPs: dplSearcher.DPs,\n}\nrouter := mux.NewRouter()\n@@ -168,6 +169,7 @@ func TestSearch__NameAndAltName(t *testing.T) {\nSDNs []*ofac.SDN `json:\"SDNs\"`\nAltNames []*ofac.AlternateIdentity `json:\"altNames\"`\nAddresses []*ofac.Address `json:\"addresses\"`\n+ DeniedPersons []*ofac.DPL `json:\"deniedPersons\"`\n}\nif err := json.NewDecoder(w.Body).Decode(&wrapper); err != nil {\nt.Fatal(err)\n@@ -181,6 +183,9 @@ func TestSearch__NameAndAltName(t *testing.T) {\nif wrapper.Addresses[0].EntityID != \"735\" {\nt.Errorf(\"%#v\", wrapper.Addresses[0].EntityID)\n}\n+ if wrapper.DeniedPersons[0].StreetAddress != \"P.O. BOX 28360\" {\n+ t.Errorf(\"%#v\", wrapper.DeniedPersons[0].StreetAddress)\n+ }\n}\nfunc TestSearch__Name(t *testing.T) {\n" } ]
Go
Apache License 2.0
moov-io/watchman
add search handler and update test
428,986
01.07.2019 14:10:39
21,600
86567cfbfdeca01e5cf26adcfb355fd9640e411d
Add DPL download stats to startup
[ { "change_type": "MODIFY", "old_path": "cmd/server/main.go", "new_path": "cmd/server/main.go", "diff": "@@ -16,10 +16,10 @@ import (\n\"syscall\"\n\"time\"\n+ \"github.com/cardonator/ofac\"\n\"github.com/moov-io/base/admin\"\nmoovhttp \"github.com/moov-io/base/http\"\n\"github.com/moov-io/base/http/bind\"\n- \"github.com/cardonator/ofac\"\n\"github.com/go-kit/kit/log\"\n\"github.com/gorilla/mux\"\n@@ -143,7 +143,7 @@ func main() {\nos.Exit(1)\n} else {\ndownloadRepo.recordStats(stats)\n- logger.Log(\"main\", fmt.Sprintf(\"OFAC data refreshed - Addresses=%d AltNames=%d SDNs=%d\", stats.Addresses, stats.Alts, stats.SDNs))\n+ logger.Log(\"main\", fmt.Sprintf(\"OFAC data refreshed - Addresses=%d AltNames=%d SDNs=%d DeniedPersons=%d\", stats.Addresses, stats.Alts, stats.SDNs, stats.DeniedPersons))\n}\n// Setup Watch and Webhook database wrapper\n" } ]
Go
Apache License 2.0
moov-io/watchman
Add DPL download stats to startup
428,986
01.07.2019 14:12:44
21,600
ce0773916dcf84f7b2b40609a9f609a52b08189b
added DPL stat to another log
[ { "change_type": "MODIFY", "old_path": "cmd/server/download_handler.go", "new_path": "cmd/server/download_handler.go", "diff": "@@ -27,7 +27,7 @@ func manualRefreshHandler(logger log.Logger, searcher *searcher, downloadRepo do\nw.WriteHeader(http.StatusInternalServerError)\n} else {\nif logger != nil {\n- logger.Log(\"main\", fmt.Sprintf(\"admin: finished OFAC data refresh - Addresses=%d AltNames=%d SDNs=%d\", stats.Addresses, stats.Alts, stats.SDNs))\n+ logger.Log(\"main\", fmt.Sprintf(\"admin: finished OFAC data refresh - Addresses=%d AltNames=%d SDNs=%d DeniedPersons=%d\", stats.Addresses, stats.Alts, stats.SDNs, stats.DeniedPersons))\n}\ndownloadRepo.recordStats(stats)\n" } ]
Go
Apache License 2.0
moov-io/watchman
added DPL stat to another log
428,979
31.07.2019 21:22:56
25,200
a4d89887ad7acbb5039da26c9bf0149cfeba7580
Update README.md to fox port Port was wrong
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -64,8 +64,8 @@ Docs: [docs.moov.io](https://docs.moov.io/ofac/) | [api docs](https://api.moov.i\n| `DPL_DOWNLOAD_TEMPLATE` | HTTP address for downloading the DPL | (BIS website) |\n| `WEBHOOK_BATCH_SIZE` | How many watches to read from database per batch of async searches. | 100 |\n| `LOG_FORMAT` | Format for logging lines to be written as. | Options: `json`, `plain` - Default: `plain` |\n-| `HTTP_BIND_ADDRESS` | Address for OFAC to bind its HTTP server on. This overrides the command-line flag `-http.addr`. | Default: `:8080` |\n-| `HTTP_ADMIN_BIND_ADDRESS` | Address for OFAC to bind its admin HTTP server on. This overrides the command-line flag `-admin.addr`. | Default: `:9090` |\n+| `HTTP_BIND_ADDRESS` | Address for OFAC to bind its HTTP server on. This overrides the command-line flag `-http.addr`. | Default: `:8084` |\n+| `HTTP_ADMIN_BIND_ADDRESS` | Address for OFAC to bind its admin HTTP server on. This overrides the command-line flag `-admin.addr`. | Default: `:9094` |\n| `HTTPS_CERT_FILE` | Filepath containing a certificate (or intermediate chain) to be served by the HTTP server. Requires all traffic be over secure HTTP. | Empty |\n| `HTTPS_KEY_FILE` | Filepath of a private key matching the leaf certificate from `HTTPS_CERT_FILE`. | Empty |\n| `DATABASE_TYPE` | Which database option to use (Options: `sqlite`, `mysql`) | Default: `sqlite` |\n" } ]
Go
Apache License 2.0
moov-io/watchman
Update README.md to fox port Port was wrong
428,984
06.09.2019 16:00:03
25,200
f93daea0a56b760dc108a2eca90370f4cdf7c888
add headers to results
[ { "change_type": "MODIFY", "old_path": "examples/ofac-search-ui/src/Components.js", "new_path": "examples/ofac-search-ui/src/Components.js", "diff": "@@ -18,3 +18,10 @@ export const SectionTitle = styled.div`\nexport const Unknown = styled.span`\ncolor: #666;\n`;\n+\n+export const ResultHeader = styled.div`\n+ text-transform: uppercase;\n+ font-size: 0.8em;\n+ padding-bottom: 0.5em;\n+ border-bottom: 1px solid #eee;\n+`;\n" }, { "change_type": "MODIFY", "old_path": "examples/ofac-search-ui/src/Results/Addresses.js", "new_path": "examples/ofac-search-ui/src/Results/Addresses.js", "diff": "@@ -5,18 +5,41 @@ import { matchToPercent } from \"../utils\";\nimport { Remarks } from \"./Remarks\";\nimport * as C from \"Components\";\n+export const Header = ({ withMatch = true }) => (\n+ <div\n+ css={`\n+ margin-top: 1em;\n+ width: 100%;\n+ `}\n+ >\n+ <div\n+ css={`\n+ width: 100%;\n+ display: grid;\n+ grid-template-columns: ${withMatch ? `4em 2fr 1fr 1fr 4em` : `4em 2fr 1fr 1fr`};\n+ `}\n+ >\n+ <C.ResultHeader>ID</C.ResultHeader>\n+ <C.ResultHeader>Address</C.ResultHeader>\n+ <C.ResultHeader>City</C.ResultHeader>\n+ <C.ResultHeader>Country</C.ResultHeader>\n+ {withMatch && <C.ResultHeader>Match</C.ResultHeader>}\n+ </div>\n+ </div>\n+);\n+\nexport const Addresses = ({ data }) => {\nif (!data) return null;\nreturn (\n<C.Section>\n<C.SectionTitle>Addresses</C.SectionTitle>\n+ <Header />\n{data.length > 0 && data.map(s => <Address key={`${s.entityID}-${s.addressID}`} data={s} />)}\n</C.Section>\n);\n};\nexport const Address = ({ data }) => {\n- // console.log(\"address: \", data);\nreturn (\n<div\ncss={`\n@@ -33,7 +56,7 @@ export const Address = ({ data }) => {\n<div\ncss={`\ndisplay: grid;\n- grid-template-columns: 4em 2fr 1fr 1fr 4em;\n+ grid-template-columns: ${data.match ? `4em 2fr 1fr 1fr 4em` : `4em 2fr 1fr 1fr`};\npadding-top: 1em;\n& > div {\nmargin-right: 1em;\n@@ -45,7 +68,7 @@ export const Address = ({ data }) => {\n<div>{R.toLower(data.address)}</div>\n<div>{R.toLower(data.cityStateProvincePostalCode)}</div>\n<div>{R.toLower(data.country)}</div>\n- <div>{data.match && matchToPercent(data.match)}</div>\n+ {data.match && <div>{matchToPercent(data.match)}</div>}\n</div>\n<Remarks remarks={data.remarks} />\n</div>\n" }, { "change_type": "MODIFY", "old_path": "examples/ofac-search-ui/src/Results/AltNames.js", "new_path": "examples/ofac-search-ui/src/Results/AltNames.js", "diff": "@@ -4,11 +4,28 @@ import { matchToPercent } from \"../utils\";\nimport { Remarks } from \"./Remarks\";\nimport * as C from \"Components\";\n+export const Header = ({ withMatch = true }) => (\n+ <div\n+ css={`\n+ margin-top: 1em;\n+ width: 100%;\n+ display: grid;\n+ grid-template-columns: ${withMatch ? `4em 3fr 1fr 4em` : `4em 4fr 1fr`};\n+ `}\n+ >\n+ <C.ResultHeader>ID</C.ResultHeader>\n+ <C.ResultHeader>Alternate Name</C.ResultHeader>\n+ <C.ResultHeader>Type</C.ResultHeader>\n+ {withMatch && <C.ResultHeader>Match</C.ResultHeader>}\n+ </div>\n+);\n+\nexport const AltNames = ({ data }) => {\nif (!data) return null;\nreturn (\n<C.Section>\n<C.SectionTitle>Alternate Names</C.SectionTitle>\n+ <Header />\n{data.length > 0 &&\ndata.map(s => <AltName key={`${s.entityID}-${s.alternateID}`} data={s} />)}\n</C.Section>\n@@ -32,7 +49,7 @@ export const AltName = ({ data }) => {\n<div\ncss={`\ndisplay: grid;\n- grid-template-columns: 4em 2fr 1fr 1fr 4em;\n+ grid-template-columns: ${data.match ? `4em 3fr 1fr 4em` : `4em 4fr 1fr`};\npadding-top: 1em;\n& > div {\nmargin-right: 1em;\n@@ -41,7 +58,6 @@ export const AltName = ({ data }) => {\n>\n<div>{data.entityID}</div>\n<div>{data.alternateName}</div>\n- <div />\n<div\ncss={`\ntext-transform: uppercase;\n@@ -49,7 +65,7 @@ export const AltName = ({ data }) => {\n>\n{data.alternateType}\n</div>\n- <div>{data.match && matchToPercent(data.match)}</div>\n+ {data.match && <div>{matchToPercent(data.match)}</div>}\n</div>\n<Remarks remarks={data.remarks} />\n</div>\n" }, { "change_type": "MODIFY", "old_path": "examples/ofac-search-ui/src/Results/DeniedPersons.js", "new_path": "examples/ofac-search-ui/src/Results/DeniedPersons.js", "diff": "@@ -7,11 +7,28 @@ import * as C from \"../Components\";\nconst l = R.toLower;\n+const Header = () => (\n+ <div\n+ css={`\n+ display: grid;\n+ grid-template-columns: 2fr 2fr 1fr 1fr 4em;\n+ margin-top: 1em;\n+ `}\n+ >\n+ <C.ResultHeader>Name</C.ResultHeader>\n+ <C.ResultHeader>Action</C.ResultHeader>\n+ <C.ResultHeader>Effective</C.ResultHeader>\n+ <C.ResultHeader>Expiration</C.ResultHeader>\n+ <C.ResultHeader>Match</C.ResultHeader>\n+ </div>\n+);\n+\nexport const DeniedPersons = ({ data }) => {\nif (!data) return null;\nreturn (\n<C.Section>\n<C.SectionTitle>Denied Persons</C.SectionTitle>\n+ <Header />\n{data.length > 0 &&\ndata.map(s => <DeniedPerson key={`${s.name}-${s.streetAddress}`} data={s} />)}\n</C.Section>\n" }, { "change_type": "MODIFY", "old_path": "examples/ofac-search-ui/src/Results/SDN.js", "new_path": "examples/ofac-search-ui/src/Results/SDN.js", "diff": "@@ -12,11 +12,36 @@ import MExpansionPanelSummary from \"@material-ui/core/ExpansionPanelSummary\";\nimport MExpansionPanelDetails from \"@material-ui/core/ExpansionPanelDetails\";\nimport ExpandMoreIcon from \"@material-ui/icons/ExpandMore\";\n+const Header = () => (\n+ <div\n+ css={`\n+ margin-top: 1em;\n+ width: 100%;\n+ `}\n+ >\n+ <div\n+ css={`\n+ width: 100%;\n+ display: grid;\n+ grid-template-columns: 4em 1fr 1fr 1fr 4em 36px;\n+ `}\n+ >\n+ <C.ResultHeader>ID</C.ResultHeader>\n+ <C.ResultHeader>Name</C.ResultHeader>\n+ <C.ResultHeader>Type</C.ResultHeader>\n+ <C.ResultHeader>Program</C.ResultHeader>\n+ <C.ResultHeader>Match</C.ResultHeader>\n+ <C.ResultHeader />\n+ </div>\n+ </div>\n+);\n+\nexport const SDNS = ({ data }) => {\nif (!data) return null;\nreturn (\n<C.Section>\n<C.SectionTitle>Specially Designated Nationals</C.SectionTitle>\n+ <Header />\n{data && data.length > 0 && data.map(s => <SDN key={s.entityID} data={s} />)}\n</C.Section>\n);\n" }, { "change_type": "MODIFY", "old_path": "examples/ofac-search-ui/src/Results/SDNDetails.js", "new_path": "examples/ofac-search-ui/src/Results/SDNDetails.js", "diff": "@@ -3,8 +3,8 @@ import * as R from \"ramda\";\nimport styled, { css } from \"styled-components/macro\"; // eslint-disable-line no-unused-vars\nimport CircularProgress from \"@material-ui/core/CircularProgress\";\nimport * as C from \"Components\";\n-import { Address } from \"./Addresses\";\n-import { AltName } from \"./AltNames\";\n+import { Header as AddressHeader, Address } from \"./Addresses\";\n+import { Header as AlternatesHeader, AltName } from \"./AltNames\";\nconst Addresses = ({ data }) => {\nif (!data) return <CircularProgress size=\"1em\" />;\n@@ -16,6 +16,7 @@ const Addresses = ({ data }) => {\n`}\n>\n<C.SectionTitle>Addresses</C.SectionTitle>\n+ <AddressHeader withMatch={false} />\n{data.map(a => (\n<Address key={a.addressID} data={a} />\n))}\n@@ -33,6 +34,7 @@ const Alternates = ({ data }) => {\n`}\n>\n<C.SectionTitle>Alternate Names</C.SectionTitle>\n+ <AlternatesHeader withMatch={false} />\n{data.map(a => (\n<AltName key={a.alternateID} data={a} />\n))}\n@@ -44,6 +46,12 @@ export const SDNExpandDetails = ({ data }) => (\n<div\ncss={`\nwidth: 100%;\n+ & > * {\n+ margin-bottom: 1.5em;\n+ }\n+ & > *:last-child {\n+ margin-bottom: 0;\n+ }\n`}\n>\n<Addresses data={R.path([\"ADDS\", \"data\"])(data)} />\n" } ]
Go
Apache License 2.0
moov-io/watchman
add headers to results
428,984
27.09.2019 08:13:47
25,200
b13fc77138a9fcb0fcfa739cd93f174d8667cfc5
setup proxy for devmode; update client api calls
[ { "change_type": "MODIFY", "old_path": "examples/ofac-search-ui/src/api.js", "new_path": "examples/ofac-search-ui/src/api.js", "diff": "export const search = async qs => {\n- const r = await fetch(`/search?${qs}`);\n+ const r = await fetch(`/api/search?${qs}`);\nreturn await r.json();\n};\nexport const getSDNAlts = async sdnId => {\n- const r = await fetch(`/sdn/${sdnId}/alts`);\n+ const r = await fetch(`/api/sdn/${sdnId}/alts`);\nreturn await r.json();\n};\nexport const getSDNAddresses = async sdnId => {\n- const r = await fetch(`/sdn/${sdnId}/addresses`);\n+ const r = await fetch(`/api/sdn/${sdnId}/addresses`);\nreturn await r.json();\n};\n" }, { "change_type": "ADD", "old_path": null, "new_path": "examples/ofac-search-ui/src/setupProxy.js", "diff": "+const proxy = require(\"http-proxy-middleware\");\n+\n+module.exports = function(app) {\n+ app.use(\n+ \"/api\",\n+ proxy({\n+ target: process.env.OFAC_ENDPOINT || \"http://localhost:8084\",\n+ pathRewrite: { \"^/api\": \"\" },\n+ changeOrigin: true\n+ })\n+ );\n+};\n" } ]
Go
Apache License 2.0
moov-io/watchman
setup proxy for devmode; update client api calls
428,984
27.09.2019 08:14:11
25,200
fb858f5f670f6c7871266f87080b778f8809b41e
update README with env var documentation
[ { "change_type": "MODIFY", "old_path": "examples/ofac-search-ui/README.md", "new_path": "examples/ofac-search-ui/README.md", "diff": "## examples / ofac-search-ui\n-This project provides an interface to retrieve results from the OFAC service' search endpoint.\n+This project provides an interface to retrieve results from an OFAC service search endpoint.\n### Available Scripts\n@@ -8,19 +8,27 @@ This project was bootstrapped with [Create React App](https://github.com/faceboo\n#### `npm start`\n-Runs the app in the development mode.<br>\n-Open [http://localhost:3000](http://localhost:3000) to view it in the browser.\n+Runs the app in the development mode. Open [http://localhost:3000](http://localhost:3000) to view it in the browser.\n-The page will reload if you make edits.<br>\n-You will also see any lint errors in the console.\n+The page will reload if you make edits. You will also see any lint errors in the console.\n+\n+#### `npm run build`\n+\n+Builds the application, producing bundles of the frontend assets, making the application ready to serve in a production environment.\n+\n+#### `npm run server`\n+\n+Serves the bundled application and proxies api requests to the OFAC search endpoint.\n+\n+By default, the server will start on port `3000`. Setting the `HTTP_BIND_ADDRESS` environment variable will override this value.\n#### `npm run ofac-server`\nRuns the latest docker image of the OFAC server as recommended in the main README. This is a convenience script and is not required if the server is already running.\n-### Connecting the UI to the server\n+### Connecting the UI to the OFAC search endpoint\n-When started with `npm start`, Create React App will proxy OFAC server requests to a local running server. If using a port other than `8084` for the server, edit the package.json file, updating the port specified in the `proxy` key to match.\n+By default, the api proxy will forward requests to [http://localhost:8084](http://localhost:8084). Setting the `OFAC_ENDPOINT` environment variable will override this value.\n### Learn More\n" } ]
Go
Apache License 2.0
moov-io/watchman
update README with env var documentation
428,984
27.09.2019 17:20:36
25,200
b02ed6b46314af9835ca1e5b65e4deeb9909a248
simplify webui local dev proxy
[ { "change_type": "MODIFY", "old_path": "webui/package.json", "new_path": "webui/package.json", "diff": "\"last 1 safari version\"\n]\n},\n+ \"proxy\": \"http://localhost:8084\",\n\"devDependencies\": {\n\"@material-ui/core\": \"^4.3.1\",\n\"@material-ui/icons\": \"^4.2.1\",\n" }, { "change_type": "DELETE", "old_path": "webui/src/setupProxy.js", "new_path": null, "diff": "-const proxy = require(\"http-proxy-middleware\");\n-\n-module.exports = function(app) {\n- app.use(\n- \"/api\",\n- proxy({\n- target: process.env.OFAC_ENDPOINT || \"http://localhost:8084\",\n- pathRewrite: { \"^/api\": \"\" },\n- changeOrigin: true\n- })\n- );\n-};\n" } ]
Go
Apache License 2.0
moov-io/watchman
simplify webui local dev proxy
428,984
30.09.2019 17:01:55
25,200
e91d0a5feeba50c999bb1058988845231823a181
sync url and search state
[ { "change_type": "MODIFY", "old_path": "webui/package.json", "new_path": "webui/package.json", "diff": "\"dependencies\": {\n\"express\": \"4.17.1\",\n\"express-winston\": \"3.3.0\",\n+ \"history\": \"^4.10.1\",\n\"http-proxy-middleware\": \"0.20.0\",\n\"react\": \"16.10.1\",\n\"react-dom\": \"16.10.1\",\n" }, { "change_type": "MODIFY", "old_path": "webui/src/App.js", "new_path": "webui/src/App.js", "diff": "@@ -4,8 +4,11 @@ import styled from \"styled-components/macro\"; // eslint-disable-line no-unused-v\nimport Form from \"Form\";\nimport Results from \"Results\";\nimport { Container } from \"Components\";\n-import { isNilOrEmpty } from \"utils\";\n+import { buildQueryString, isNilOrEmpty } from \"utils\";\nimport { search } from \"api\";\n+import { createBrowserHistory } from \"history\";\n+\n+const history = createBrowserHistory();\nconst reducer = (state, action) => {\nswitch (action.type) {\n@@ -21,28 +24,24 @@ const initialState = {\nresults: []\n};\n+const valuesOnlyContainLimit = R.pipe(\n+ R.filter(R.complement(isNilOrEmpty)),\n+ R.omit([\"limit\"]),\n+ R.isEmpty\n+);\n+\nfunction App() {\nconst [state, dispatch] = useReducer(reducer, initialState);\nconst handleReset = () => {\ndispatch({ type: \"SEARCH_RESET\" });\n+ history.push({ ...history.location, search: \"\" });\n};\nconst handleSubmit = values => {\n- const onlyLimit = R.pipe(\n- R.filter(R.complement(isNilOrEmpty)),\n- R.omit([\"limit\"]),\n- R.isEmpty\n- )(values);\n- if (onlyLimit) return;\n-\n- const qs = R.pipe(\n- R.filter(R.complement(isNilOrEmpty)),\n- R.mapObjIndexed((val, key) => `${key}=${val}`),\n- R.values,\n- R.join(\"&\")\n- )(values);\n- // console.log(\"qs: \", qs);\n+ if (valuesOnlyContainLimit(values)) return;\n+ const qs = buildQueryString(values);\n+ history.push({ ...history.location, search: qs });\nsearch(qs).then(payload => dispatch({ type: \"SEARCH_SUCCESS\", payload }));\n};\n" }, { "change_type": "MODIFY", "old_path": "webui/src/Form/index.js", "new_path": "webui/src/Form/index.js", "diff": "-import React from \"react\";\n+import React, { useCallback, useEffect } from \"react\";\nimport * as R from \"ramda\";\nimport styled from \"styled-components/macro\"; // eslint-disable-line no-unused-vars\nimport MButton from \"@material-ui/core/Button\";\n@@ -8,6 +8,7 @@ import Select from \"./Select\";\nimport TextInput from \"./TextInput\";\nimport Slider from \"./Slider\";\nimport { countryOptionData, listOptionData, typeOptionData, programOptionData } from \"../data\";\n+import { parseQueryString } from \"utils\";\nconst Button = styled(MButton)`\nmargin: 1em;\n@@ -44,13 +45,13 @@ const initialValues = {\ncountry: \"\",\nzip: \"\",\nlimit: 10,\n- q: \"\",\n+ q: \"\"\n// disabled ///////////\n- idNumber: \"\",\n- type: \"All\",\n- program: [\"All\"],\n- list: \"All\",\n- score: 100\n+ // idNumber: \"\",\n+ // type: \"All\",\n+ // program: [\"All\"],\n+ // list: \"All\",\n+ // score: 100\n};\nexport default ({ onSubmit, onReset }) => {\n@@ -66,7 +67,6 @@ export default ({ onSubmit, onReset }) => {\nconst handleSearchClick = () => {\nconst activeValues = R.omit([\"idNumber\", \"type\", \"program\", \"list\", \"score\"])(values);\n- // TODO: validate input for sanity\nonSubmit(activeValues);\n};\n@@ -75,6 +75,19 @@ export default ({ onSubmit, onReset }) => {\nonReset();\n};\n+ const submit = useCallback(onSubmit, []);\n+ useEffect(() => {\n+ const { search } = window.location;\n+ if (!search) {\n+ return;\n+ }\n+ setValues(values => {\n+ const newValues = R.mergeDeepRight(values, parseQueryString(search));\n+ submit(newValues);\n+ return newValues;\n+ });\n+ }, [submit]);\n+\nreturn (\n<Container>\n<form\n" }, { "change_type": "MODIFY", "old_path": "webui/src/utils.js", "new_path": "webui/src/utils.js", "diff": "-import * as R from 'ramda';\n+import * as R from \"ramda\";\nexport const matchToPercent = match => `${(match * 100).toFixed(1)}%`;\nexport const isNilOrEmpty = R.anyPass([R.isNil, R.isEmpty]);\n+export const buildQueryString = R.pipe(\n+ R.filter(R.complement(isNilOrEmpty)),\n+ R.mapObjIndexed((val, key) => `${key}=${val}`),\n+ R.values,\n+ R.join(\"&\")\n+);\n+\n+export const parseQueryString = R.pipe(\n+ R.tail,\n+ R.split(\"&\"),\n+ R.map(R.split(\"=\")),\n+ R.fromPairs\n+);\n" } ]
Go
Apache License 2.0
moov-io/watchman
sync url and search state
428,984
01.10.2019 16:46:15
25,200
428a29a3e741d06cbd14b6c2e86bd1f7e2d3f95e
add type and program to webui
[ { "change_type": "MODIFY", "old_path": "webui/src/Form/index.js", "new_path": "webui/src/Form/index.js", "diff": "@@ -7,8 +7,9 @@ import * as C from \"../Components\";\nimport Select from \"./Select\";\nimport TextInput from \"./TextInput\";\nimport Slider from \"./Slider\";\n-import { countryOptionData, listOptionData, typeOptionData, programOptionData } from \"../data\";\n+import { countryOptionData, listOptionData, programOptionData } from \"../data\";\nimport { parseQueryString } from \"utils\";\n+import { useTypeOptions, useProgramOptions } from \"./options\";\nconst Button = styled(MButton)`\nmargin: 1em;\n@@ -45,11 +46,11 @@ const initialValues = {\ncountry: \"\",\nzip: \"\",\nlimit: 10,\n- q: \"\"\n+ q: \"\",\n+ type: \"\",\n+ program: \"\"\n// disabled ///////////\n// idNumber: \"\",\n- // type: \"All\",\n- // program: [\"All\"],\n// list: \"All\",\n// score: 100\n};\n@@ -57,16 +58,20 @@ const initialValues = {\nexport default ({ onSubmit, onReset }) => {\nconst [values, setValues] = React.useState(initialValues);\n+ const { values: typeOptionValues } = useTypeOptions();\n+ const { values: programOptionValues } = useProgramOptions();\n+\nconst handleChange = name => e => {\nconst value = R.path([\"target\", \"value\"], e);\nsetValues(values => R.assoc(name, value, values));\n};\n+\nconst handleChangeSlider = name => (e, value) => {\nsetValues(values => R.assoc(name, value, values));\n};\nconst handleSearchClick = () => {\n- const activeValues = R.omit([\"idNumber\", \"type\", \"program\", \"list\", \"score\"])(values);\n+ const activeValues = R.omit([\"idNumber\", \"list\", \"score\"])(values);\nonSubmit(activeValues);\n};\n@@ -124,6 +129,24 @@ export default ({ onSubmit, onReset }) => {\nonChange={handleChange(\"altName\")}\n/>\n</Cell>\n+ <Cell>\n+ <Select\n+ label=\"Type\"\n+ id=\"type\"\n+ value={values[\"type\"]}\n+ onChange={handleChange(\"type\")}\n+ options={typeOptionValues}\n+ />\n+ </Cell>\n+ <Cell>\n+ <Select\n+ label=\"Program\"\n+ id=\"program\"\n+ value={values[\"program\"]}\n+ onChange={handleChange(\"program\")}\n+ options={programOptionValues}\n+ />\n+ </Cell>\n<Cell>\n<TextInput\ntype=\"number\"\n@@ -216,7 +239,7 @@ export default ({ onSubmit, onReset }) => {\nid=\"type\"\nvalue={values[\"type\"]}\nonChange={handleChange(\"type\")}\n- options={typeOptionData}\n+ options={typeOptionValues}\n/>\n</Cell>\n" }, { "change_type": "ADD", "old_path": null, "new_path": "webui/src/Form/options.js", "diff": "+import { useEffect, useReducer } from \"react\";\n+import * as R from \"ramda\";\n+import { getSDNTypes, getPrograms } from \"api\";\n+import { makeOptionData } from \"utils\";\n+\n+const allOption = { val: \"\", name: \"All\" };\n+\n+const buildUseOptions = api => () => {\n+ const initialState = { loading: false, values: [] };\n+ const reducer = (state, action) => {\n+ switch (action.type) {\n+ case \"INIT\":\n+ return R.assoc(\"loading\", true)(state);\n+ case \"SUCCESS\":\n+ return R.assoc(\"values\", action.payload)(state);\n+ default:\n+ return state;\n+ }\n+ };\n+ const [state, dispatch] = useReducer(reducer, initialState);\n+ useEffect(() => {\n+ dispatch({ type: \"INIT\" });\n+ api().then(payload => {\n+ dispatch({ type: \"SUCCESS\", payload: [allOption, ...makeOptionData(payload)] });\n+ });\n+ }, []);\n+ return state;\n+};\n+\n+export const useTypeOptions = buildUseOptions(getSDNTypes);\n+export const useProgramOptions = buildUseOptions(getPrograms);\n" }, { "change_type": "MODIFY", "old_path": "webui/src/api.js", "new_path": "webui/src/api.js", "diff": "@@ -12,3 +12,13 @@ export const getSDNAddresses = async sdnId => {\nconst r = await fetch(`/sdn/${sdnId}/addresses`);\nreturn await r.json();\n};\n+\n+export const getSDNTypes = async qs => {\n+ const r = await fetch(`/ui/values/sdnType`);\n+ return await r.json();\n+};\n+\n+export const getPrograms = async qs => {\n+ const r = await fetch(`/ui/values/program`);\n+ return await r.json();\n+};\n" }, { "change_type": "MODIFY", "old_path": "webui/src/data.js", "new_path": "webui/src/data.js", "diff": "-import * as R from \"ramda\";\n-\n-const makeOption = v => ({ val: v, name: v });\n-const makeOptionData = R.map(makeOption);\n+import { makeOptionData } from \"utils\";\nexport const types = [\"All\", \"Aircraft\", \"Entity\", \"Individual\", \"Vessel\"];\nexport const typeOptionData = makeOptionData(types);\n" }, { "change_type": "MODIFY", "old_path": "webui/src/utils.js", "new_path": "webui/src/utils.js", "diff": "import * as R from \"ramda\";\n+const capitalize = R.replace(/^./, R.toUpper);\n+\n+const makeOption = v => ({ val: v, name: capitalize(v) });\n+export const makeOptionData = R.map(makeOption);\n+\nexport const matchToPercent = match => `${(match * 100).toFixed(1)}%`;\nexport const isNilOrEmpty = R.anyPass([R.isNil, R.isEmpty]);\n" } ]
Go
Apache License 2.0
moov-io/watchman
add type and program to webui
428,984
02.10.2019 16:49:33
25,200
0871a524262ccacc402e7559b3b9573f1a3bbe02
pass correct parameter sdnType to search endpoint
[ { "change_type": "MODIFY", "old_path": "webui/src/Form/index.js", "new_path": "webui/src/Form/index.js", "diff": "@@ -47,7 +47,7 @@ const initialValues = {\nzip: \"\",\nlimit: 10,\nq: \"\",\n- type: \"\",\n+ sdnType: \"\",\nprogram: \"\"\n// disabled ///////////\n// idNumber: \"\",\n@@ -132,9 +132,9 @@ export default ({ onSubmit, onReset }) => {\n<Cell>\n<Select\nlabel=\"Type\"\n- id=\"type\"\n- value={values[\"type\"]}\n- onChange={handleChange(\"type\")}\n+ id=\"sdnType\"\n+ value={values[\"sdnType\"]}\n+ onChange={handleChange(\"sdnType\")}\noptions={typeOptionValues}\n/>\n</Cell>\n@@ -221,28 +221,6 @@ export default ({ onSubmit, onReset }) => {\n</Cell>\n{false && (\n<>\n- <Cell>\n- <Select\n- disabled={true}\n- label=\"Program\"\n- id=\"program\"\n- multiple\n- value={values[\"program\"]}\n- onChange={handleChange(\"program\")}\n- options={programOptionData}\n- />\n- </Cell>\n- <Cell>\n- <Select\n- disabled={true}\n- label=\"Type\"\n- id=\"type\"\n- value={values[\"type\"]}\n- onChange={handleChange(\"type\")}\n- options={typeOptionValues}\n- />\n- </Cell>\n-\n<Cell>\n<Select\ndisabled={true}\n" } ]
Go
Apache License 2.0
moov-io/watchman
pass correct parameter sdnType to search endpoint
428,984
02.10.2019 17:05:21
25,200
c5e089e5ef1d1b6097cfb31423dcddcb14e5377f
handle error and loading state during search
[ { "change_type": "MODIFY", "old_path": "webui/src/App.js", "new_path": "webui/src/App.js", "diff": "@@ -12,8 +12,24 @@ const history = createBrowserHistory();\nconst reducer = (state, action) => {\nswitch (action.type) {\n+ case \"SEARCH_INIT\":\n+ return R.pipe(\n+ R.assoc(\"results\", null),\n+ R.assoc(\"loading\", true),\n+ R.assoc(\"error\", null)\n+ )(state);\ncase \"SEARCH_SUCCESS\":\n- return R.assoc(\"results\", action.payload)(state);\n+ return R.pipe(\n+ R.assoc(\"results\", action.payload),\n+ R.assoc(\"loading\", false),\n+ R.assoc(\"error\", null)\n+ )(state);\n+ case \"SEARCH_ERROR\":\n+ return R.pipe(\n+ R.assoc(\"results\", null),\n+ R.assoc(\"loading\", false),\n+ R.assoc(\"error\", action.payload)\n+ )(state);\ncase \"SEARCH_RESET\":\nreturn initialState;\ndefault:\n@@ -21,7 +37,9 @@ const reducer = (state, action) => {\n}\n};\nconst initialState = {\n- results: []\n+ error: null,\n+ loading: false,\n+ results: null\n};\nconst valuesOnlyContainLimit = R.pipe(\n@@ -32,6 +50,15 @@ const valuesOnlyContainLimit = R.pipe(\nfunction App() {\nconst [state, dispatch] = useReducer(reducer, initialState);\n+ const executeSearch = async qs => {\n+ dispatch({ type: \"SEARCH_INIT\" });\n+ try {\n+ const payload = await search(qs);\n+ dispatch({ type: \"SEARCH_SUCCESS\", payload });\n+ } catch (err) {\n+ dispatch({ type: \"SEARCH_ERROR\", payload: err });\n+ }\n+ };\nconst handleReset = () => {\ndispatch({ type: \"SEARCH_RESET\" });\n@@ -42,7 +69,7 @@ function App() {\nif (valuesOnlyContainLimit(values)) return;\nconst qs = buildQueryString(values);\nhistory.push({ ...history.location, search: qs });\n- search(qs).then(payload => dispatch({ type: \"SEARCH_SUCCESS\", payload }));\n+ executeSearch(qs);\n};\nreturn (\n@@ -56,7 +83,7 @@ function App() {\n<h1>OFAC Search</h1>\n</Container>\n<Form onSubmit={handleSubmit} onReset={handleReset} />\n- <Results data={state.results} />\n+ <Results data={state} />\n</div>\n);\n}\n" }, { "change_type": "MODIFY", "old_path": "webui/src/Components.js", "new_path": "webui/src/Components.js", "diff": "// import React from \"react\";\nimport styled from \"styled-components/macro\"; // eslint-disable-line no-unused-vars\nimport MContainer from \"@material-ui/core/Container\";\n+import MCircularProgress from \"@material-ui/core/CircularProgress\";\n+export const Spinner = MCircularProgress;\nexport const Container = styled(MContainer)``;\nexport const Section = styled.section`\nborder: 1px solid #eee;\n" }, { "change_type": "MODIFY", "old_path": "webui/src/Form/index.js", "new_path": "webui/src/Form/index.js", "diff": "@@ -7,7 +7,7 @@ import * as C from \"../Components\";\nimport Select from \"./Select\";\nimport TextInput from \"./TextInput\";\nimport Slider from \"./Slider\";\n-import { countryOptionData, listOptionData, programOptionData } from \"../data\";\n+import { countryOptionData, listOptionData } from \"../data\";\nimport { parseQueryString } from \"utils\";\nimport { useTypeOptions, useProgramOptions } from \"./options\";\n" }, { "change_type": "MODIFY", "old_path": "webui/src/Results/index.js", "new_path": "webui/src/Results/index.js", "diff": "@@ -7,16 +7,29 @@ import { Addresses } from \"./Addresses\";\nimport { DeniedPersons } from \"./DeniedPersons\";\nimport { isNilOrEmpty } from \"utils\";\n-const Results = ({ data }) => {\n- if (isNilOrEmpty(data)) return null;\n+export default ({ data }) => {\n+ const { loading, error, results } = data;\n+ if (loading)\nreturn (\n<C.Container>\n- <SDNS data={data.SDNs} />\n- <AltNames data={data.altNames} />\n- <Addresses data={data.addresses} />\n- <DeniedPersons data={data.deniedPersons} />\n+ <div\n+ css={`\n+ display: flex;\n+ justify-content: center;\n+ `}\n+ >\n+ <C.Spinner />\n+ </div>\n+ </C.Container>\n+ );\n+ if (error) return <C.Container>ERROR: {error.message}</C.Container>;\n+ if (isNilOrEmpty(results)) return null;\n+ return (\n+ <C.Container>\n+ <SDNS data={results.SDNs} />\n+ <AltNames data={results.altNames} />\n+ <Addresses data={results.addresses} />\n+ <DeniedPersons data={results.deniedPersons} />\n</C.Container>\n);\n};\n-\n-export default Results;\n" }, { "change_type": "MODIFY", "old_path": "webui/src/api.js", "new_path": "webui/src/api.js", "diff": "-export const search = async qs => {\n- const r = await fetch(`/search?${qs}`);\n- return await r.json();\n+const apiGet = async path => {\n+ const response = await fetch(path);\n+ const payload = await response.json();\n+ if (!response.ok) throw new Error(payload.error);\n+ return payload;\n};\n-export const getSDNAlts = async sdnId => {\n- const r = await fetch(`/sdn/${sdnId}/alts`);\n- return await r.json();\n-};\n-\n-export const getSDNAddresses = async sdnId => {\n- const r = await fetch(`/sdn/${sdnId}/addresses`);\n- return await r.json();\n-};\n+export const search = async qs => apiGet(`/search?${qs}`);\n-export const getSDNTypes = async qs => {\n- const r = await fetch(`/ui/values/sdnType`);\n- return await r.json();\n-};\n-\n-export const getPrograms = async qs => {\n- const r = await fetch(`/ui/values/program`);\n- return await r.json();\n-};\n+export const getSDNAlts = async sdnId => (await fetch(`/sdn/${sdnId}/alts`)).json();\n+export const getSDNAddresses = async sdnId => (await fetch(`/sdn/${sdnId}/addresses`)).json();\n+export const getSDNTypes = async qs => (await fetch(`/ui/values/sdnType`)).json();\n+export const getPrograms = async qs => (await fetch(`/ui/values/program`)).json();\n" } ]
Go
Apache License 2.0
moov-io/watchman
handle error and loading state during search
428,984
02.10.2019 17:07:15
25,200
7a18e8c74b5794556aa6dcd43aa8a3658a5c429a
show address/alt IDs when related to SDN rather than repeat entityID
[ { "change_type": "MODIFY", "old_path": "webui/src/Results/Addresses.js", "new_path": "webui/src/Results/Addresses.js", "diff": "@@ -39,7 +39,7 @@ export const Addresses = ({ data }) => {\n);\n};\n-export const Address = ({ data }) => {\n+export const Address = ({ data, displayId = \"entityID\" }) => {\nreturn (\n<div\ncss={`\n@@ -64,7 +64,7 @@ export const Address = ({ data }) => {\n}\n`}\n>\n- <div>{R.toLower(data.entityID)}</div>\n+ <div>{R.toLower(data[displayId])}</div>\n<div>{R.toLower(data.address)}</div>\n<div>{R.toLower(data.cityStateProvincePostalCode)}</div>\n<div>{R.toLower(data.country)}</div>\n" }, { "change_type": "MODIFY", "old_path": "webui/src/Results/AltNames.js", "new_path": "webui/src/Results/AltNames.js", "diff": "@@ -32,7 +32,7 @@ export const AltNames = ({ data }) => {\n);\n};\n-export const AltName = ({ data }) => {\n+export const AltName = ({ data, displayId = \"entityID\" }) => {\nreturn (\n<div\ncss={`\n@@ -56,7 +56,7 @@ export const AltName = ({ data }) => {\n}\n`}\n>\n- <div>{data.entityID}</div>\n+ <div>{data[displayId]}</div>\n<div>{data.alternateName}</div>\n<div\ncss={`\n" }, { "change_type": "MODIFY", "old_path": "webui/src/Results/SDNDetails.js", "new_path": "webui/src/Results/SDNDetails.js", "diff": "@@ -18,7 +18,7 @@ const Addresses = ({ data }) => {\n<C.SectionTitle>Addresses</C.SectionTitle>\n<AddressHeader withMatch={false} />\n{data.map(a => (\n- <Address key={a.addressID} data={a} />\n+ <Address key={a.addressID} data={a} displayId=\"addressID\" />\n))}\n</div>\n);\n@@ -36,7 +36,7 @@ const Alternates = ({ data }) => {\n<C.SectionTitle>Alternate Names</C.SectionTitle>\n<AlternatesHeader withMatch={false} />\n{data.map(a => (\n- <AltName key={a.alternateID} data={a} />\n+ <AltName key={a.alternateID} data={a} displayId=\"alternateID\" />\n))}\n</div>\n);\n" } ]
Go
Apache License 2.0
moov-io/watchman
show address/alt IDs when related to SDN rather than repeat entityID
428,986
02.12.2019 12:22:00
25,200
d4b89813a15be6a87b14310bd3aeea5440f4d1dc
remove ide files from repo
[ { "change_type": "DELETE", "old_path": ".idea/.gitignore", "new_path": null, "diff": "-# Default ignored files\n-/workspace.xml\n" }, { "change_type": "DELETE", "old_path": ".idea/misc.xml", "new_path": null, "diff": "-<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n-<project version=\"4\">\n- <component name=\"JavaScriptSettings\">\n- <option name=\"languageLevel\" value=\"ES6\" />\n- </component>\n-</project>\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": ".idea/modules.xml", "new_path": null, "diff": "-<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n-<project version=\"4\">\n- <component name=\"ProjectModuleManager\">\n- <modules>\n- <module fileurl=\"file://$PROJECT_DIR$/.idea/watchman.iml\" filepath=\"$PROJECT_DIR$/.idea/watchman.iml\" />\n- </modules>\n- </component>\n-</project>\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": ".idea/vcs.xml", "new_path": null, "diff": "-<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n-<project version=\"4\">\n- <component name=\"VcsDirectoryMappings\">\n- <mapping directory=\"$PROJECT_DIR$\" vcs=\"Git\" />\n- </component>\n-</project>\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": ".idea/watchman.iml", "new_path": null, "diff": "-<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n-<module type=\"WEB_MODULE\" version=\"4\">\n- <component name=\"Go\" enabled=\"true\" />\n- <component name=\"NewModuleRootManager\">\n- <content url=\"file://$MODULE_DIR$\" />\n- <orderEntry type=\"inheritedJdk\" />\n- <orderEntry type=\"sourceFolder\" forTests=\"false\" />\n- </component>\n-</module>\n\\ No newline at end of file\n" } ]
Go
Apache License 2.0
moov-io/watchman
remove ide files from repo
428,986
02.12.2019 14:49:31
25,200
68412f6bad689159091859ea73a21e3da2deef68
add IDE files to gitignore, fix typo in CONTRIBUTING
[ { "change_type": "MODIFY", "old_path": ".gitignore", "new_path": ".gitignore", "diff": "@@ -17,6 +17,7 @@ coverage.html\n# Generated files\n.tmp/\nopenapi-generator*jar\n+.idea\n*.db\n" }, { "change_type": "MODIFY", "old_path": "CONTRIBUTING.md", "new_path": "CONTRIBUTING.md", "diff": "@@ -36,7 +36,7 @@ $ go doc github.com/moov-io/watchman/pkg/ofac SDN\nYou can pull a working repository of our code code with git:\n```\n-$ midir -p moov/\n+$ mkdir -p moov/\n$ cd moov/\n$ git clone git@github.com:moov-io/watchman.git\n```\n" }, { "change_type": "MODIFY", "old_path": "go.mod", "new_path": "go.mod", "diff": "@@ -7,6 +7,8 @@ require (\ngithub.com/gorilla/mux v1.7.3\ngithub.com/lopezator/migrator v0.2.0\ngithub.com/mattn/go-sqlite3 v1.13.0\n+ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect\n+ github.com/modern-go/reflect2 v1.0.1 // indirect\ngithub.com/moov-io/base v0.11.0-rc1.0.20191121181647-cd3e7a9609db\ngithub.com/moov-io/ofac v0.12.0\ngithub.com/ory/dockertest/v3 v3.5.2\n" } ]
Go
Apache License 2.0
moov-io/watchman
add IDE files to gitignore, fix typo in CONTRIBUTING
428,986
03.12.2019 11:55:07
25,200
e270377ac237f5a36b5fa842ca355bdfe7780b30
add CSL Downloader
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -9,6 +9,7 @@ import (\n\"encoding/json\"\n\"errors\"\n\"fmt\"\n+ \"github.com/moov-io/watchman/pkg/csl\"\n\"io/ioutil\"\n\"net/http\"\n\"time\"\n@@ -115,6 +116,19 @@ func dplRecords(logger log.Logger, initialDir string) ([]*dpl.DPL, error) {\nreturn dpl.Read(file)\n}\n+func cslRecords(logger log.Logger, initialDir string) (*csl.CSL, error) {\n+ file, err := csl.Download(logger, initialDir)\n+ if err != nil {\n+ return nil, err\n+ }\n+ cslRecords, err := csl.Read(file)\n+ if err != nil {\n+ return nil, err\n+ }\n+\n+ return cslRecords, err\n+}\n+\n// refreshData reaches out to the various websites to download the latest\n// files, runs each list's parser, and index data for searches.\nfunc (s *searcher) refreshData(initialDir string) (*downloadStats, error) {\n" }, { "change_type": "MODIFY", "old_path": "go.sum", "new_path": "go.sum", "diff": "@@ -150,6 +150,7 @@ go4.org v0.0.0-20191010144846-132d2879e1e9 h1:zHLoVtbywceo2hE4Wqv8CmIufe7jDERQ2K\ngo4.org v0.0.0-20191010144846-132d2879e1e9/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=\ngolang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=\ngolang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=\n+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=\ngolang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=\ngolang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\ngolang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=\n" }, { "change_type": "ADD", "old_path": null, "new_path": "pkg/csl/download.go", "diff": "+// Copyright 2018 The Moov Authors\n+// Use of this source code is governed by an Apache License\n+// license that can be found in the LICENSE file.\n+\n+package csl\n+\n+import (\n+ \"fmt\"\n+ \"github.com/go-kit/kit/log\"\n+ \"github.com/moov-io/watchman/pkg/download\"\n+ \"net/url\"\n+ \"os\"\n+ \"strings\"\n+)\n+\n+var (\n+ cslDownloadTemplate = func() string {\n+ if w := os.Getenv(\"CSL_DOWNLOAD_TEMPLATE\"); w != \"\" {\n+ return w\n+ }\n+ return \"https://api.trade.gov/consolidated_screening_list/%s\"\n+ }()\n+)\n+\n+func Download(logger log.Logger, initialDir string) (string, error) {\n+ dl := download.New(logger, download.HTTPClient)\n+\n+ cslURL, err := buildDownloadURL()\n+ if err != nil {\n+ return \"\", err\n+ }\n+\n+ cslNameAndSource := make(map[string]string)\n+ cslNameAndSource[\"csl.csv\"] = cslURL\n+\n+ file, err := dl.GetFiles(initialDir, cslNameAndSource)\n+ if len(file) == 0 || err != nil {\n+ return \"\", fmt.Errorf(\"csl download: %v\", err)\n+ }\n+ return file[0], nil\n+}\n+\n+func buildDownloadURL() (string, error) {\n+ cslURL, err := url.Parse(fmt.Sprintf(cslDownloadTemplate, \"search.csv\"))\n+ if err != nil {\n+ return \"\", err\n+ }\n+\n+ if strings.EqualFold(cslURL.Host, \"api.trade.gov\") { // only require api key if source is api.trade.gov\n+ q := cslURL.Query()\n+ keyOverride := os.Getenv(\"TRADEGOV_API_KEY\")\n+ if keyOverride == \"\" && q.Get(\"api_key\") == \"\" {\n+ return \"\", fmt.Errorf(\"csl download: missing api key\")\n+ }\n+\n+ if q.Get(\"api_key\") == \"\" { // download template did not include api key\n+ q.Set(\"api_key\", keyOverride)\n+ }\n+\n+ cslURL.RawQuery = q.Encode()\n+ }\n+\n+ return cslURL.String(), nil\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "pkg/csl/download_test.go", "diff": "+// Copyright 2018 The Moov Authors\n+// Use of this source code is governed by an Apache License\n+// license that can be found in the LICENSE file.\n+\n+package csl\n+\n+import (\n+ \"github.com/go-kit/kit/log\"\n+ \"io/ioutil\"\n+ \"os\"\n+ \"path/filepath\"\n+ \"strings\"\n+ \"testing\"\n+)\n+\n+func TestDownload(t *testing.T) {\n+ if testing.Short() || os.Getenv(\"TRADEGOV_API_KEY\") == \"\" {\n+ return\n+ }\n+\n+ file, err := Download(log.NewNopLogger(), \"\")\n+ if err != nil {\n+ t.Fatal(err)\n+ }\n+ if file == \"\" {\n+ t.Fatal(\"no CSL file\")\n+ }\n+ defer os.RemoveAll(filepath.Dir(file))\n+\n+ if !strings.EqualFold(\"csl.csv\", filepath.Base(file)) {\n+ t.Errorf(\"unknown file %s\", file)\n+ }\n+}\n+\n+func TestDownload_initialDir(t *testing.T) {\n+ dir, err := ioutil.TempDir(\"\", \"iniital-dir\")\n+ if err != nil {\n+ t.Fatal(err)\n+ }\n+ defer os.RemoveAll(dir)\n+\n+ mk := func(t *testing.T, name string, body string) {\n+ path := filepath.Join(dir, name)\n+ if err := ioutil.WriteFile(path, []byte(body), 0644); err != nil {\n+ t.Fatalf(\"writing %s: %v\", path, err)\n+ }\n+ }\n+\n+ // create each file\n+ mk(t, \"sdn.csv\", \"file=sdn.csv\")\n+ mk(t, \"csl.csv\", \"file=csl.csv\")\n+ mk(t, \"csl.csv\", \"file=csl.csv\")\n+\n+ file, err := Download(log.NewNopLogger(), dir)\n+ if err != nil {\n+ t.Fatal(err)\n+ }\n+ if file == \"\" {\n+ t.Fatal(\"no CSL file\")\n+ }\n+\n+ if strings.EqualFold(\"csl.csv\", filepath.Base(file)) {\n+ bs, err := ioutil.ReadFile(file)\n+ if err != nil {\n+ t.Fatal(err)\n+ }\n+ if v := string(bs); v != \"file=csl.csv\" {\n+ t.Errorf(\"csl.csv: %v\", v)\n+ }\n+ } else {\n+ t.Fatalf(\"unknown file: %v\", file)\n+ }\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "pkg/csl/reader.go", "diff": "+package csl\n+\n+import (\n+ \"encoding/csv\"\n+ \"io\"\n+ \"os\"\n+ \"strings\"\n+)\n+\n+func Read(path string) (*CSL, error) {\n+ f, err := os.Open(path)\n+ if err != nil {\n+ return nil, err\n+ }\n+ defer f.Close()\n+\n+ reader := csv.NewReader(f)\n+\n+ _, err = reader.Read() // read and discard the header row\n+ if err != nil {\n+ return nil, err\n+ }\n+\n+ var out *CSL\n+ for {\n+ _, err := reader.Read()\n+ if err == io.EOF {\n+ break\n+ }\n+ if err != nil {\n+ continue\n+ }\n+\n+ }\n+ return out, nil\n+}\n+\n+// Some columns in a CSL row are actually lists delimited by ';'.\n+// These helper methods split these fields out and clean up the results.\n+\n+func expandField(addrs string) []string {\n+ var result []string\n+ for _, a := range strings.Split(addrs, \";\") {\n+ result = append(result, strings.TrimSpace(a))\n+ }\n+ return result\n+}\n+\n+var prgmReplacer = strings.NewReplacer(\"]\", \"\", \"[\", \"\")\n+\n+func expandProgramsList(prgms string) []string {\n+ prgms = strings.ReplaceAll(prgms, \"] [\", \";\")\n+ prgms = prgmReplacer.Replace(prgms)\n+ return expandField(prgms)\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
add CSL Downloader
428,986
03.12.2019 16:27:02
25,200
a9f8fa3441f033bfc1a2a06f29d4d4335f06446f
add SSI and integrate into searches
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -9,12 +9,12 @@ import (\n\"encoding/json\"\n\"errors\"\n\"fmt\"\n- \"github.com/moov-io/watchman/pkg/csl\"\n\"io/ioutil\"\n\"net/http\"\n\"time\"\nmoovhttp \"github.com/moov-io/base/http\"\n+ \"github.com/moov-io/watchman/pkg/csl\"\n\"github.com/moov-io/watchman/pkg/dpl\"\n\"github.com/moov-io/watchman/pkg/ofac\"\n@@ -42,6 +42,7 @@ type Download struct {\nAlts int `json:\"altNames\"`\nAddresses int `json:\"addresses\"`\nDeniedPersons int `json:\"deniedPersons\"`\n+ SectoralSanctions int `json:\"sectoralSanctions\"`\n}\ntype downloadStats struct {\n@@ -49,6 +50,7 @@ type downloadStats struct {\nAlts int `json:\"altNames\"`\nAddresses int `json:\"addresses\"`\nDeniedPersons int `json:\"deniedPersons\"`\n+ SectoralSanctions int `json:\"sectoralSanctions\"`\nRefreshedAt time.Time `json:\"timestamp\"`\n}\n@@ -69,7 +71,8 @@ func (s *searcher) periodicDataRefresh(interval time.Duration, downloadRepo down\n} else {\ndownloadRepo.recordStats(stats)\nif s.logger != nil {\n- s.logger.Log(\"main\", fmt.Sprintf(\"data refreshed - Addresses=%d AltNames=%d SDNs=%d DPL=%d\", stats.Addresses, stats.Alts, stats.SDNs, stats.DeniedPersons))\n+ s.logger.Log(\"main\", fmt.Sprintf(\"data refreshed - Addresses=%d AltNames=%d SDNs=%d DPL=%d SSI=%d\",\n+ stats.Addresses, stats.Alts, stats.SDNs, stats.DeniedPersons, stats.SectoralSanctions))\n}\nupdates <- stats // send stats for re-search and watch notifications\n}\n@@ -145,16 +148,24 @@ func (s *searcher) refreshData(initialDir string) (*downloadStats, error) {\nadds := precomputeAddresses(results.Addresses)\nalts := precomputeAlts(results.AlternateIdentities)\n- dps, err := dplRecords(s.logger, initialDir)\n+ deniedPersons, err := dplRecords(s.logger, initialDir)\n+ if err != nil {\n+ return nil, err\n+ }\n+ dps := precomputeDPs(deniedPersons)\n+\n+ csl, err := cslRecords(s.logger, initialDir)\nif err != nil {\nreturn nil, err\n}\n+ ssis := precomputeSSIs(csl.SSIs)\nstats := &downloadStats{\nSDNs: len(sdns),\nAlts: len(alts),\nAddresses: len(adds),\nDeniedPersons: len(dps),\n+ SectoralSanctions: len(csl.SSIs),\n}\nstats.RefreshedAt = lastRefresh(initialDir)\n@@ -163,7 +174,8 @@ func (s *searcher) refreshData(initialDir string) (*downloadStats, error) {\ns.SDNs = sdns\ns.Addresses = adds\ns.Alts = alts\n- s.DPs = precomputeDPs(dps)\n+ s.DPs = dps\n+ s.SSIs = ssis\ns.lastRefreshedAt = stats.RefreshedAt\ns.Unlock()\n@@ -245,19 +257,19 @@ func (r *sqliteDownloadRepository) recordStats(stats *downloadStats) error {\nreturn errors.New(\"recordStats: nil downloadStats\")\n}\n- query := `insert into download_stats (downloaded_at, sdns, alt_names, addresses, denied_persons) values (?, ?, ?, ?, ?);`\n+ query := `insert into download_stats (downloaded_at, sdns, alt_names, addresses, denied_persons, sectoral_sanctions) values (?, ?, ?, ?, ?, ?);`\nstmt, err := r.db.Prepare(query)\nif err != nil {\nreturn err\n}\ndefer stmt.Close()\n- _, err = stmt.Exec(stats.RefreshedAt, stats.SDNs, stats.Alts, stats.Addresses, stats.DeniedPersons)\n+ _, err = stmt.Exec(stats.RefreshedAt, stats.SDNs, stats.Alts, stats.Addresses, stats.DeniedPersons, stats.SectoralSanctions)\nreturn err\n}\nfunc (r *sqliteDownloadRepository) latestDownloads(limit int) ([]Download, error) {\n- query := `select downloaded_at, sdns, alt_names, addresses, denied_persons from download_stats order by downloaded_at desc limit ?;`\n+ query := `select downloaded_at, sdns, alt_names, addresses, denied_persons, sectoral_sanctions from download_stats order by downloaded_at desc limit ?;`\nstmt, err := r.db.Prepare(query)\nif err != nil {\nreturn nil, err\n@@ -273,7 +285,7 @@ func (r *sqliteDownloadRepository) latestDownloads(limit int) ([]Download, error\nvar downloads []Download\nfor rows.Next() {\nvar dl Download\n- if err := rows.Scan(&dl.Timestamp, &dl.SDNs, &dl.Alts, &dl.Addresses, &dl.DeniedPersons); err == nil {\n+ if err := rows.Scan(&dl.Timestamp, &dl.SDNs, &dl.Alts, &dl.Addresses, &dl.DeniedPersons, &dl.SectoralSanctions); err == nil {\ndownloads = append(downloads, dl)\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/download_test.go", "new_path": "cmd/server/download_test.go", "diff": "@@ -57,13 +57,19 @@ func TestSearcher__refreshData(t *testing.T) {\nif len(s.SDNs) == 0 || stats.SDNs == 0 {\nt.Errorf(\"empty SDNs=%d or stats.SDNs=%d\", len(s.SDNs), stats.SDNs)\n}\n+ if len(s.DPs) == 0 || stats.DeniedPersons == 0 {\n+ t.Errorf(\"empty DPs=%d or stats.DeniedPersons=%d\", len(s.DPs), stats.DeniedPersons)\n+ }\n+ if len(s.SSIs) == 0 || stats.SectoralSanctions == 0 {\n+ t.Errorf(\"empty SSIs=%d or stats.SectoralSanctions=%d\", len(s.SSIs), stats.SectoralSanctions)\n+ }\n}\nfunc TestDownload_record(t *testing.T) {\nt.Parallel()\ncheck := func(t *testing.T, repo *sqliteDownloadRepository) {\n- stats := &downloadStats{SDNs: 1, Alts: 12, Addresses: 42, DeniedPersons: 13}\n+ stats := &downloadStats{SDNs: 1, Alts: 12, Addresses: 42, DeniedPersons: 13, SectoralSanctions: 39}\nif err := repo.recordStats(stats); err != nil {\nt.Fatal(err)\n}\n@@ -85,6 +91,12 @@ func TestDownload_record(t *testing.T) {\nif dl.Addresses != stats.Addresses {\nt.Errorf(\"dl.Addresses=%d stats.Addresses=%d\", dl.Addresses, stats.Addresses)\n}\n+ if dl.DeniedPersons != stats.DeniedPersons {\n+ t.Errorf(\"dl.DeniedPersons=%d stats.DeniedPersons=%d\", dl.DeniedPersons, stats.DeniedPersons)\n+ }\n+ if dl.SectoralSanctions != stats.SectoralSanctions {\n+ t.Errorf(\"dl.SectoralSanctions=%d stats.SectoralSanctions=%d\", dl.SectoralSanctions, stats.SectoralSanctions)\n+ }\n}\n// SQLite tests\n@@ -106,7 +118,7 @@ func TestDownload_route(t *testing.T) {\nreq := httptest.NewRequest(\"GET\", \"/downloads\", nil)\nreq.Header.Set(\"x-user-id\", \"test\")\n- repo.recordStats(&downloadStats{SDNs: 1, Alts: 421, Addresses: 1511, DeniedPersons: 731})\n+ repo.recordStats(&downloadStats{SDNs: 1, Alts: 421, Addresses: 1511, DeniedPersons: 731, SectoralSanctions: 289})\nrouter := mux.NewRouter()\naddDownloadRoutes(nil, router, repo)\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/main.go", "new_path": "cmd/server/main.go", "diff": "@@ -144,7 +144,8 @@ func main() {\nos.Exit(1)\n} else {\ndownloadRepo.recordStats(stats)\n- logger.Log(\"main\", fmt.Sprintf(\"data refreshed - Addresses=%d AltNames=%d SDNs=%d DeniedPersons=%d\", stats.Addresses, stats.Alts, stats.SDNs, stats.DeniedPersons))\n+ logger.Log(\"main\", fmt.Sprintf(\"data refreshed - Addresses=%d AltNames=%d SDNs=%d DeniedPersons=%d SectoralSanctions=%d\",\n+ stats.Addresses, stats.Alts, stats.SDNs, stats.DeniedPersons, stats.SectoralSanctions))\n}\n// Setup Watch and Webhook database wrapper\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search.go", "new_path": "cmd/server/search.go", "diff": "@@ -18,6 +18,7 @@ import (\n\"time\"\n\"unicode\"\n+ \"github.com/moov-io/watchman/pkg/csl\"\n\"github.com/moov-io/watchman/pkg/dpl\"\n\"github.com/moov-io/watchman/pkg/ofac\"\n@@ -41,6 +42,7 @@ type searcher struct {\nAddresses []*Address\nAlts []*Alt\nDPs []*DP\n+ SSIs []*SSI\nlastRefreshedAt time.Time\nsync.RWMutex // protects all above fields\n@@ -307,6 +309,50 @@ func (s *searcher) TopDPs(limit int, name string) []DP {\nreturn out\n}\n+// TopSSIs searches Sectoral Sanctions records by Name and Alias\n+func (s *searcher) TopSSIs(limit int, name string) []SSI {\n+ name = precompute(name)\n+\n+ s.RLock()\n+ defer s.RUnlock()\n+\n+ if len(s.SSIs) == 0 {\n+ return nil\n+ }\n+ xs := newLargest(limit)\n+\n+ for _, ssi := range s.SSIs {\n+ xs.add(&item{\n+ value: ssi,\n+ weight: jaroWinkler(ssi.name, name),\n+ })\n+ for _, alt := range ssi.SectoralSanction.AlternateNames {\n+ xs.add(&item{\n+ value: ssi,\n+ weight: jaroWinkler(alt, name),\n+ })\n+ }\n+ }\n+\n+ out := make([]SSI, 0)\n+ for _, thisItem := range xs.items {\n+ if v := thisItem; v != nil {\n+ ss, ok := v.value.(*SSI)\n+ if !ok {\n+ continue\n+ }\n+ ssi := *ss\n+ ssi.match = v.weight\n+ // Each SSI has been ranked based on Name AND AlternativeName, which means the same entry can appear more than once.\n+ if len(out) > 0 && out[len(out)-1].SectoralSanction.EntityID == ssi.SectoralSanction.EntityID {\n+ continue\n+ }\n+ out = append(out, ssi)\n+ }\n+ }\n+ return out\n+}\n+\n// SDN is ofac.SDN wrapped with precomputed search metadata\ntype SDN struct {\n*ofac.SDN\n@@ -465,6 +511,38 @@ func precomputeDPs(persons []*dpl.DPL) []*DP {\nreturn out\n}\n+type SSI struct {\n+ SectoralSanction *csl.SSI\n+ match float64\n+ name string\n+}\n+\n+func (s SSI) MarshalJSON() ([]byte, error) {\n+ return json.Marshal(struct {\n+ *csl.SSI\n+ Match float64 `json:\"match\"`\n+ }{\n+ s.SectoralSanction,\n+ s.match,\n+ })\n+}\n+\n+func precomputeSSIs(ssis []*csl.SSI) []*SSI {\n+ out := make([]*SSI, len(ssis))\n+ for i, ssi := range ssis {\n+ var normalizedAltNames []string\n+ for _, name := range ssi.AlternateNames {\n+ normalizedAltNames = append(normalizedAltNames, precompute(reorderSDNName(name, ssi.Type)))\n+ }\n+ ssi.AlternateNames = normalizedAltNames\n+ out[i] = &SSI{\n+ SectoralSanction: ssi,\n+ name: precompute(reorderSDNName(ssi.Name, ssi.Type)),\n+ }\n+ }\n+ return out\n+}\n+\nvar (\npunctuationReplacer = strings.NewReplacer(\".\", \"\", \",\", \"\", \"-\", \"\", \" \", \" \")\n)\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -114,6 +114,7 @@ type searchResponse struct {\nAltNames []Alt `json:\"altNames\"`\nAddresses []Address `json:\"addresses\"`\nDeniedPersons []DP `json:\"deniedPersons\"`\n+ SectoralSanctions []SSI `json:\"sectoralSanctions\"`\nRefreshedAt time.Time `json:\"refreshedAt\"`\n}\n@@ -204,6 +205,7 @@ func searchViaQ(logger log.Logger, searcher *searcher, name string) http.Handler\nAltNames: searcher.TopAltNames(limit, name),\nAddresses: searcher.TopAddresses(limit, name),\nDeniedPersons: searcher.TopDPs(limit, name),\n+ SectoralSanctions: searcher.TopSSIs(limit, name),\nRefreshedAt: searcher.lastRefreshedAt,\n})\n}\n@@ -285,8 +287,10 @@ func searchByName(logger log.Logger, searcher *searcher, nameSlug string) http.H\nreturn\n}\n+ limit := extractSearchLimit(r)\n+\n// Grab the SDN's and then filter any out based on query params\n- sdns := searcher.TopSDNs(extractSearchLimit(r), nameSlug)\n+ sdns := searcher.TopSDNs(limit, nameSlug)\nsdns = filterSDNs(sdns, buildFilterRequest(r.URL))\n// record Prometheus metrics\n@@ -300,6 +304,8 @@ func searchByName(logger log.Logger, searcher *searcher, nameSlug string) http.H\nw.WriteHeader(http.StatusOK)\njson.NewEncoder(w).Encode(&searchResponse{\nSDNs: sdns,\n+ DeniedPersons: searcher.TopDPs(limit, nameSlug),\n+ SectoralSanctions: searcher.TopSSIs(limit, nameSlug),\nRefreshedAt: searcher.lastRefreshedAt,\n})\n}\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers_test.go", "new_path": "cmd/server/search_handlers_test.go", "diff": "@@ -11,6 +11,7 @@ import (\n\"strings\"\n\"testing\"\n+ \"github.com/moov-io/watchman/pkg/csl\"\n\"github.com/moov-io/watchman/pkg/dpl\"\n\"github.com/moov-io/watchman/pkg/ofac\"\n@@ -228,6 +229,7 @@ func TestSearch__NameAndAltName(t *testing.T) {\nSDNs: sdnSearcher.SDNs,\nAddresses: addressSearcher.Addresses,\nDPs: dplSearcher.DPs,\n+ SSIs: ssiSearcher.SSIs,\n}\nrouter := mux.NewRouter()\n@@ -245,6 +247,7 @@ func TestSearch__NameAndAltName(t *testing.T) {\nAltNames []*ofac.AlternateIdentity `json:\"altNames\"`\nAddresses []*ofac.Address `json:\"addresses\"`\nDeniedPersons []*dpl.DPL `json:\"deniedPersons\"`\n+ SectoralSanctions []*csl.SSI `json:\"sectoralSanctions\"`\n}\nif err := json.NewDecoder(w.Body).Decode(&wrapper); err != nil {\nt.Fatal(err)\n@@ -261,6 +264,9 @@ func TestSearch__NameAndAltName(t *testing.T) {\nif wrapper.DeniedPersons[0].StreetAddress != \"P.O. BOX 28360\" {\nt.Errorf(\"%#v\", wrapper.DeniedPersons[0].StreetAddress)\n}\n+ if wrapper.SectoralSanctions[0].EntityID != \"18782\" {\n+ t.Errorf(\"%#v\", wrapper.SectoralSanctions[0].EntityID)\n+ }\n}\nfunc TestSearch__Name(t *testing.T) {\n@@ -268,7 +274,12 @@ func TestSearch__Name(t *testing.T) {\nreq := httptest.NewRequest(\"GET\", \"/search?name=Dr+AL+ZAWAHIRI&limit=1\", nil)\nrouter := mux.NewRouter()\n- addSearchRoutes(log.NewNopLogger(), router, sdnSearcher)\n+ combinedSearcher := &searcher{\n+ SDNs: sdnSearcher.SDNs,\n+ DPs: dplSearcher.DPs,\n+ SSIs: ssiSearcher.SSIs,\n+ }\n+ addSearchRoutes(log.NewNopLogger(), router, combinedSearcher)\nrouter.ServeHTTP(w, req)\nw.Flush()\n@@ -282,23 +293,24 @@ func TestSearch__Name(t *testing.T) {\nvar wrapper struct {\nSDNs []*ofac.SDN `json:\"SDNs\"`\n+ DPs []*dpl.DPL `json:\"deniedPersons\"`\n+ SSIs []*csl.SSI `json:\"sectoralSanctions\"`\n}\nif err := json.NewDecoder(w.Body).Decode(&wrapper); err != nil {\nt.Fatal(err)\n}\n+ if len(wrapper.SDNs) != 1 || len(wrapper.SSIs) != 1 || len(wrapper.DPs) != 1 {\n+ t.Fatalf(\"SDNs=%d SSIs=%d DPs=%d\", len(wrapper.SDNs), len(wrapper.SSIs), len(wrapper.DPs))\n+ }\nif wrapper.SDNs[0].EntityID != \"2676\" {\nt.Errorf(\"%#v\", wrapper.SDNs[0])\n}\n-\n- // directly check searcher.TopSDNs\n- sdns := sdnSearcher.TopSDNs(1, \"Dr AL ZAWAHIRI\")\n- if len(sdns) != 1 {\n- t.Errorf(\"got SDNs: %#v\", sdns)\n+ if wrapper.SSIs[0].EntityID != \"18782\" {\n+ t.Errorf(\"%#v\", wrapper.SSIs[0])\n}\n- if sdns[0].EntityID != \"2676\" {\n- t.Errorf(\"%#v\", sdns[0])\n+ if wrapper.DPs[0].Name != \"AL NASER WINGS AIRLINES\" {\n+ t.Errorf(\"%#v\", wrapper.DPs[0])\n}\n- eql(t, \"name match\", sdns[0].match, 1.0)\n}\nfunc TestSearch__AltName(t *testing.T) {\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_test.go", "new_path": "cmd/server/search_test.go", "diff": "@@ -12,6 +12,7 @@ import (\n\"strings\"\n\"testing\"\n+ \"github.com/moov-io/watchman/pkg/csl\"\n\"github.com/moov-io/watchman/pkg/dpl\"\n\"github.com/moov-io/watchman/pkg/ofac\"\n@@ -117,6 +118,34 @@ var (\n},\n}),\n}\n+ ssiSearcher = &searcher{\n+ SSIs: precomputeSSIs([]*csl.SSI{\n+ {\n+ EntityID: \"18782\",\n+ Type: \"Entity\",\n+ Programs: []string{\"SYRIA\", \"UKRAINE-EO13662\"},\n+ Name: \"ROSOBORONEKSPORT OAO\",\n+ Addresses: []string{\"27 Stromynka ul., Moscow, 107076, RU\"},\n+ Remarks: []string{\"For more information on directives, please visit the following link: http://www.treasury.gov/resource-center/sanctions/Programs/Pages/ukraine.aspx#directives\", \"(Linked To: ROSTEC)\"},\n+ AlternateNames: []string{\"RUSSIAN DEFENSE EXPORT ROSOBORONEXPORT\", \"KENKYUSHO\", \"ROSOBORONEXPORT JSC\", \"ROSOBORONEKSPORT OJSC\", \"OJSC ROSOBORONEXPORT\", \"ROSOBORONEXPORT\"},\n+ IDsOnRecord: []string{\"1117746521452, Registration ID\", \"56467052, Government Gazette Number\", \"7718852163, Tax ID No.\", \"Subject to Directive 3, Executive Order 13662 Directive Determination -\", \"www.roe.ru, Website\"},\n+ SourceListURL: \"http://bit.ly/1QWTIfE\",\n+ SourceInfoURL: \"http://bit.ly/1MLgou0\",\n+ },\n+ {\n+ EntityID: \"18736\",\n+ Type: \"Entity\",\n+ Programs: []string{\"UKRAINE-EO13662\"},\n+ Name: \"VTB SPECIALIZED DEPOSITORY, CJSC\",\n+ Addresses: []string{\"35 Myasnitskaya Street, Moscow, 101000, RU\"},\n+ Remarks: []string{\"For more information on directives, please visit the following link: http://www.treasury.gov/resource-center/sanctions/Programs/Pages/ukraine.aspx#directives\", \"(Linked To: ROSTEC)\"},\n+ AlternateNames: []string{\"CJS VTB SPECIALIZED DEPOSITORY\"},\n+ IDsOnRecord: []string{\"1117746521452, Registration ID\", \"56467052, Government Gazette Number\", \"7718852163, Tax ID No.\", \"Subject to Directive 3, Executive Order 13662 Directive Determination -\", \"www.roe.ru, Website\"},\n+ SourceListURL: \"http://bit.ly/1QWTIfE\",\n+ SourceInfoURL: \"http://bit.ly/1MLgou0\",\n+ },\n+ }),\n+ }\n)\nfunc TestJaroWinkler(t *testing.T) {\n@@ -426,6 +455,16 @@ func TestSearch__TopDPs(t *testing.T) {\n}\n}\n+func TestSearcher_TopSSIs(t *testing.T) {\n+ ssis := ssiSearcher.TopSSIs(1, \"ROSOBORONEKSPORT\")\n+ if len(ssis) == 0 {\n+ t.Fatal(\"empty SSIs\")\n+ }\n+ if ssis[0].SectoralSanction.EntityID != \"18782\" {\n+ t.Errorf(\"%#v\", ssis[0].SectoralSanction)\n+ }\n+}\n+\nfunc TestSearch__extractIDFromRemark(t *testing.T) {\ncases := []struct {\ninput, expected string\n" }, { "change_type": "MODIFY", "old_path": "internal/database/mysql.go", "new_path": "internal/database/mysql.go", "diff": "@@ -73,6 +73,10 @@ var (\n\"rename_ofac_download_stats\",\n\"rename table ofac_download_stats to download_stats\",\n),\n+ execsql(\n+ \"add_sectoral_sanctions_to_download_stats\",\n+ \"alter table download_stats add column sectoral_sanctions integer not null default 0;\",\n+ ),\n)\n)\n" }, { "change_type": "MODIFY", "old_path": "internal/database/sqlite.go", "new_path": "internal/database/sqlite.go", "diff": "@@ -71,6 +71,10 @@ var (\n\"rename_ofac_download_stats\",\n\"alter table ofac_download_stats rename to download_stats\",\n),\n+ execsql(\n+ \"add_sectoral_sanctions_to_download_stats\",\n+ \"alter table download_stats add column sectoral_sanctions default 0;\",\n+ ),\n)\n)\n" } ]
Go
Apache License 2.0
moov-io/watchman
add SSI and integrate into searches
428,986
03.12.2019 20:55:47
25,200
1fc80d93fda1ffba721fd08ae552cdee667798b6
update README to reflect addition of SSI
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -11,9 +11,12 @@ Moov Watchman is an HTTP API and Go library to download, parse and offer search\nLists included in search are:\n-- [Office of Foreign Asset Control](https://www.treasury.gov/about/organizational-structure/offices/Pages/Office-of-Foreign-Assets-Control.aspx) (OFAC)\n- - The US Treasury department offers a [search page for OFAC records](https://sanctionssearch.ofac.treas.gov/)\n-- [BIS Denied Person's List](https://bis.data.commerce.gov/dataset/Denied-Persons-List-with-Denied-US-Export-Privileg/xwtd-wd7a/data) (DPL)\n+- US Treasury - Office of Foreign Assets Control (OFAC)\n+ - [Specially Designated Nationals](https://www.treasury.gov/resource-center/sanctions/sdn-list/pages/default.aspx) (SDN)\n+ - Includes SDN, SDN Alternative Names, SDN Addresses\n+ - [Sectoral Sanctions Identifications](https://www.treasury.gov/resource-center/sanctions/SDN-List/Pages/ssi_list.aspx) (SSI)\n+- US Department of Commerce - Bureau of Industry and Security (BIS)\n+ - [Denied Persons List](https://bis.data.commerce.gov/dataset/Denied-Persons-List-with-Denied-US-Export-Privileg/xwtd-wd7a/data) (DPL)\nAll United States or European Union companies are required to comply with various regulations and sanction lists (such as the US Patriot Act requiring compliance with the BIS Denied Person's List). Moov's primary usage for this project is with ACH origination in our [paygate](https://github.com/moov-io/paygate) project.\n@@ -33,10 +36,9 @@ ts=2019-02-05T00:03:31.9583844Z caller=main.go:42 startup=\"Starting watchman ser\n...\n# Perform a basic search\n-$ curl -s localhost:8084/search?name=...\n-{\n- \"SDNs\": [\n+$ curl -s localhost:8084/search?q=...\n{\n+ \"SDNs\": [{\n\"entityID\": \"...\",\n\"sdnName\": \"...\",\n\"sdnType\": \"...\",\n@@ -48,12 +50,55 @@ $ curl -s localhost:8084/search?name=...\n\"grossRegisteredTonnage\": \"...\",\n\"vesselFlag\": \"...\",\n\"vesselOwner\": \"...\",\n- \"remarks\": \"...\"\n- }\n- ],\n- \"altNames\": null,\n- \"addresses\": null,\n- \"deniedPersons\": null\n+ \"remarks\": \"...\",\n+ \"match\": 1\n+ }],\n+ \"altNames\": [{\n+ \"entityID\": \"...\",\n+ \"alternateID\": \"...\",\n+ \"alternateType\": \"...\",\n+ \"alternateName\": \"...\",\n+ \"alternateRemarks\": \"...\",\n+ \"match\": 0.7999999999999999\n+ }],\n+ \"addresses\": [{\n+ \"entityID\": \"...\",\n+ \"addressID\": \"...\",\n+ \"address\": \"...\",\n+ \"cityStateProvincePostalCode\": \"...\",\n+ \"country\": \"...\",\n+ \"addressRemarks\": \"...\",\n+ \"match\": 0.7401785714285715\n+ }],\n+ \"deniedPersons\": [{\n+ \"name\": \"...\",\n+ \"streetAddress\": \"...\",\n+ \"city\": \"...\",\n+ \"state\": \"...\",\n+ \"country\": \"...\",\n+ \"postalCode\": \"...\",\n+ \"effectiveDate\": \"...\",\n+ \"expirationDate\": \"...\",\n+ \"standardOrder\": \"...\",\n+ \"lastUpdate\": \"...\",\n+ \"action\": \"...\",\n+ \"frCitation\": \"...\",\n+ \"match\": 0.7268518518518519\n+ }],\n+ \"sectoralSanctions\": [{\n+ \"entityID\": \"...\",\n+ \"type\": \"...\",\n+ \"programs\": [\"...\", \"...\"],\n+ \"name\": \"...\",\n+ \"addresses\": [\"...\", \"...\"],\n+ \"remarks\": [\"...\", \"...\"],\n+ \"alternateNames\": [\"...\", \"...\"],\n+ \"ids\": [\"...\", \"...\"],\n+ \"sourceListURL\": \"...\",\n+ \"sourceInfoURL\": \"...\",\n+ \"match\": 0.7428571428571429\n+ }],\n+ \"refreshedAt\": \"2019-12-03T15:31:41.81849-07:00\"\n}\n```\n@@ -99,8 +144,10 @@ $ go run ./cmd/server/ # Load http://localhost:8084 in a web browser\n| Environmental Variable | Description | Default |\n|-----|-----|-----|\n-| `OFAC_DOWNLOAD_TEMPLATE` | HTTP address for downloading raw OFAC files. | (OFAC website) |\n-| `DPL_DOWNLOAD_TEMPLATE` | HTTP address for downloading the DPL | (BIS website) |\n+| `OFAC_DOWNLOAD_TEMPLATE` | HTTP address for downloading raw OFAC files. | `https://www.treasury.gov/ofac/downloads/%s` |\n+| `DPL_DOWNLOAD_TEMPLATE` | HTTP address for downloading the DPL | `https://www.bis.doc.gov/dpl/%s` |\n+| `CSL_DOWNLOAD_TEMPLATE` | HTTP address for downloading the Consolidated Screening List (CSL), which is a collection of US government sanctions lists. | `https://api.trade.gov/consolidated_screening_list/%s` |\n+| `TRADEGOV_API_KEY` | REQUIRED for the CSL. API keys for api.trade.gov are free and can be obtained by [creating an account.](https://api.trade.gov/apps/store/) | N/A |\n#### Storage\n@@ -177,11 +224,11 @@ Note: This project uses Go Modules, which requires Go 1.11 or higher, but we shi\n## Links\n-- [Sanctions Search Page](https://sanctionssearch.ofac.treas.gov/)\n+- [OFAC Sanctions Search Page](https://sanctionssearch.ofac.treas.gov/)\n- [Subscribe for OFAC updates](https://service.govdelivery.com/accounts/USTREAS/subscriber/new)\n- [When should I call the OFAC Hotline?](https://www.treasury.gov/resource-center/faqs/Sanctions/Pages/directions.aspx)\n-- [BIS Denied Persons List with Denied US Export Privileges](https://bis.data.commerce.gov/dataset/Denied-Persons-List-with-Denied-US-Export-Privileg/xwtd-wd7a/data)\n-\n+- [BIS Denied Persons List with Denied US Export Privileges (DPL)](https://bis.data.commerce.gov/dataset/Denied-Persons-List-with-Denied-US-Export-Privileg/xwtd-wd7a/data)\n+- [Sectoral Sanctions Identifications (SSI)](https://www.treasury.gov/resource-center/sanctions/SDN-List/Pages/ssi_list.aspx)\n## License\nApache License 2.0 See [LICENSE](LICENSE) for details.\n" } ]
Go
Apache License 2.0
moov-io/watchman
update README to reflect addition of SSI
428,986
04.12.2019 09:53:27
25,200
555b5c320088779fa6a5de813d8e17ffedfd53f0
make CSL download optional
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -122,7 +122,8 @@ func dplRecords(logger log.Logger, initialDir string) ([]*dpl.DPL, error) {\nfunc cslRecords(logger log.Logger, initialDir string) (*csl.CSL, error) {\nfile, err := csl.Download(logger, initialDir)\nif err != nil {\n- return nil, err\n+ logger.Log(\"download\", \"WARN: skipping CSL download\", \"description\", err)\n+ return &csl.CSL{}, nil\n}\ncslRecords, err := csl.Read(file)\nif err != nil {\n" } ]
Go
Apache License 2.0
moov-io/watchman
make CSL download optional
428,986
04.12.2019 10:11:53
25,200
b3277d895b246569a9f1b37488f75a7c609ed3b8
re-rename variable cslRecords -> consolidatedLists
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -155,18 +155,18 @@ func (s *searcher) refreshData(initialDir string) (*downloadStats, error) {\n}\ndps := precomputeDPs(deniedPersons)\n- cslRecords, err := cslRecords(s.logger, initialDir)\n+ consolidatedLists, err := cslRecords(s.logger, initialDir)\nif err != nil {\nreturn nil, err\n}\n- ssis := precomputeSSIs(cslRecords.SSIs)\n+ ssis := precomputeSSIs(consolidatedLists.SSIs)\nstats := &downloadStats{\nSDNs: len(sdns),\nAlts: len(alts),\nAddresses: len(adds),\nDeniedPersons: len(dps),\n- SectoralSanctions: len(cslRecords.SSIs),\n+ SectoralSanctions: len(consolidatedLists.SSIs),\n}\nstats.RefreshedAt = lastRefresh(initialDir)\n" } ]
Go
Apache License 2.0
moov-io/watchman
re-rename variable cslRecords -> consolidatedLists
428,986
04.12.2019 10:56:33
25,200
a6b0b9960b50ec6bb24a8f3b491fb305058b68f6
fix my go installation, then cleanup go.mod
[ { "change_type": "MODIFY", "old_path": "go.mod", "new_path": "go.mod", "diff": "@@ -4,14 +4,11 @@ require (\ngithub.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6\ngithub.com/go-kit/kit v0.9.0\ngithub.com/go-sql-driver/mysql v1.4.1\n- github.com/go-stack/stack v1.8.0 // indirect\ngithub.com/google/go-cmp v0.3.1 // indirect\ngithub.com/gorilla/mux v1.7.3\ngithub.com/gotestyourself/gotestyourself v2.2.0+incompatible // indirect\ngithub.com/lopezator/migrator v0.2.0\ngithub.com/mattn/go-sqlite3 v1.13.0\n- github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect\n- github.com/modern-go/reflect2 v1.0.1 // indirect\ngithub.com/moov-io/base v0.11.0-rc1.0.20191121181647-cd3e7a9609db\ngithub.com/ory/dockertest/v3 v3.5.2\ngithub.com/prometheus/client_golang v1.2.1\n" } ]
Go
Apache License 2.0
moov-io/watchman
fix my go installation, then cleanup go.mod
428,986
04.12.2019 14:13:36
25,200
b7bcd100605f5b3b2c9b61c4cbfe26cbbf5887f9
update tests to work without trade.gov api key
[ { "change_type": "MODIFY", "old_path": "cmd/server/download_handler_test.go", "new_path": "cmd/server/download_handler_test.go", "diff": "@@ -23,7 +23,7 @@ func TestDownload__manualRefreshPath(t *testing.T) {\n}\ncheck := func(t *testing.T, repo *sqliteDownloadRepository) {\n- searcher := &searcher{}\n+ searcher := &searcher{logger: log.NewNopLogger()}\nw := httptest.NewRecorder()\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/download_test.go", "new_path": "cmd/server/download_test.go", "diff": "@@ -20,6 +20,12 @@ import (\n\"github.com/gorilla/mux\"\n)\n+var (\n+ includeCSLTests = func() bool {\n+ return os.Getenv(\"TRADEGOV_API_KEY\") != \"\"\n+ }()\n+)\n+\nfunc TestSearcher__refreshInterval(t *testing.T) {\nif v := getDataRefreshInterval(log.NewNopLogger(), \"\"); v.String() != \"12h0m0s\" {\nt.Errorf(\"Got %v\", v)\n@@ -43,7 +49,7 @@ func TestSearcher__refreshData(t *testing.T) {\nreturn\n}\n- s := &searcher{}\n+ s := &searcher{logger: log.NewNopLogger()}\nstats, err := s.refreshData(\"\")\nif err != nil {\nt.Fatal(err)\n@@ -60,10 +66,12 @@ func TestSearcher__refreshData(t *testing.T) {\nif len(s.DPs) == 0 || stats.DeniedPersons == 0 {\nt.Errorf(\"empty DPs=%d or stats.DeniedPersons=%d\", len(s.DPs), stats.DeniedPersons)\n}\n+ if includeCSLTests {\nif len(s.SSIs) == 0 || stats.SectoralSanctions == 0 {\nt.Errorf(\"empty SSIs=%d or stats.SectoralSanctions=%d\", len(s.SSIs), stats.SectoralSanctions)\n}\n}\n+}\nfunc TestDownload_record(t *testing.T) {\nt.Parallel()\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/download_test.go", "new_path": "pkg/csl/download_test.go", "diff": "@@ -33,6 +33,10 @@ func TestDownload(t *testing.T) {\n}\nfunc TestDownload_initialDir(t *testing.T) {\n+ if os.Getenv(\"TRADEGOV_API_KEY\") == \"\" {\n+ return\n+ }\n+\ndir, err := ioutil.TempDir(\"\", \"iniital-dir\")\nif err != nil {\nt.Fatal(err)\n" } ]
Go
Apache License 2.0
moov-io/watchman
update tests to work without trade.gov api key
428,986
04.12.2019 15:11:07
25,200
1ebb69cb9658185412956e99f2d8c92d9a6c5692
move csl test to separate file
[ { "change_type": "MODIFY", "old_path": "cmd/server/download_test.go", "new_path": "cmd/server/download_test.go", "diff": "@@ -20,12 +20,6 @@ import (\n\"github.com/gorilla/mux\"\n)\n-var (\n- includeCSLTests = func() bool {\n- return os.Getenv(\"TRADEGOV_API_KEY\") != \"\"\n- }()\n-)\n-\nfunc TestSearcher__refreshInterval(t *testing.T) {\nif v := getDataRefreshInterval(log.NewNopLogger(), \"\"); v.String() != \"12h0m0s\" {\nt.Errorf(\"Got %v\", v)\n@@ -44,7 +38,7 @@ func TestSearcher__refreshInterval(t *testing.T) {\ns.periodicDataRefresh(0*time.Second, nil, nil)\n}\n-func TestSearcher__refreshData(t *testing.T) {\n+func TestSearcher__refreshData_nonCSL(t *testing.T) {\nif testing.Short() {\nreturn\n}\n@@ -66,11 +60,6 @@ func TestSearcher__refreshData(t *testing.T) {\nif len(s.DPs) == 0 || stats.DeniedPersons == 0 {\nt.Errorf(\"empty DPs=%d or stats.DeniedPersons=%d\", len(s.DPs), stats.DeniedPersons)\n}\n- if includeCSLTests {\n- if len(s.SSIs) == 0 || stats.SectoralSanctions == 0 {\n- t.Errorf(\"empty SSIs=%d or stats.SectoralSanctions=%d\", len(s.SSIs), stats.SectoralSanctions)\n- }\n- }\n}\nfunc TestDownload_record(t *testing.T) {\n" }, { "change_type": "ADD", "old_path": null, "new_path": "cmd/server/search_csl_test.go", "diff": "+package main\n+\n+import (\n+ \"github.com/go-kit/kit/log\"\n+ \"os\"\n+ \"testing\"\n+)\n+\n+// This file is for tests that depend on having a trade.gov API Key.\n+// These tests should be skipped if the TRADEGOV_API_KEY environment variable is not set.\n+\n+func TestSearcher_refreshData_CSL(t *testing.T) {\n+ if os.Getenv(\"TRADEGOV_API_KEY\") == \"\" {\n+ return\n+ }\n+ s := &searcher{logger: log.NewNopLogger()}\n+ stats, err := s.refreshData(\"\")\n+ if err != nil {\n+ t.Fatal(err)\n+ }\n+ if len(s.SSIs) == 0 || stats.SectoralSanctions == 0 {\n+ t.Errorf(\"empty SSIs=%d or stats.SectoralSanctions=%d\", len(s.SSIs), stats.SectoralSanctions)\n+ }\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
move csl test to separate file
428,986
04.12.2019 15:47:41
25,200
1e123581d506c8e078139963dfde04d249eafdbd
don't insert duplicates in TopSSIs
[ { "change_type": "MODIFY", "old_path": "cmd/server/search.go", "new_path": "cmd/server/search.go", "diff": "@@ -322,16 +322,17 @@ func (s *searcher) TopSSIs(limit int, name string) []SSI {\nxs := newLargest(limit)\nfor _, ssi := range s.SSIs {\n- xs.add(&item{\n+ it := &item{\nvalue: ssi,\nweight: jaroWinkler(ssi.name, name),\n- })\n+ }\nfor _, alt := range ssi.SectoralSanction.AlternateNames {\n- xs.add(&item{\n- value: ssi,\n- weight: jaroWinkler(alt, name),\n- })\n+ currWeight := jaroWinkler(alt, name)\n+ if currWeight > it.weight {\n+ it.weight = currWeight\n+ }\n}\n+ xs.add(it)\n}\nout := make([]SSI, 0)\n@@ -343,10 +344,6 @@ func (s *searcher) TopSSIs(limit int, name string) []SSI {\n}\nssi := *ss\nssi.match = v.weight\n- // Each SSI has been ranked based on Name AND AlternativeName, which means the same entry can appear more than once.\n- if len(out) > 0 && out[len(out)-1].SectoralSanction.EntityID == ssi.SectoralSanction.EntityID {\n- continue\n- }\nout = append(out, ssi)\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_test.go", "new_path": "cmd/server/search_test.go", "diff": "@@ -465,6 +465,29 @@ func TestSearcher_TopSSIs(t *testing.T) {\n}\n}\n+func TestSearcher_TopSSIs_limit(t *testing.T) {\n+ ssis := ssiSearcher.TopSSIs(2, \"SPECIALIZED DEPOSITORY\")\n+ if len(ssis) != 2 {\n+ t.Fatalf(\"Expected 2 results, found %d\", len(ssis))\n+ }\n+ if ssis[0].SectoralSanction.EntityID != \"18736\" {\n+ t.Errorf(\"%#v\", ssis[0].SectoralSanction)\n+ }\n+}\n+\n+func TestSearcher_TopSSIs_reportAltNameWeight(t *testing.T) {\n+ ssis := ssiSearcher.TopSSIs(1, \"KENKYUSHO\")\n+ if len(ssis) == 0 {\n+ t.Fatal(\"empty SSIs\")\n+ }\n+ if ssis[0].SectoralSanction.EntityID != \"18782\" {\n+ t.Errorf(\"%f - %#v\", ssis[0].match, ssis[0].SectoralSanction)\n+ }\n+ if ssis[0].match != 1 {\n+ t.Errorf(\"Expected match=1 for alt names: %f - %#v\", ssis[0].match, ssis[0].SectoralSanction)\n+ }\n+}\n+\nfunc TestSearch__extractIDFromRemark(t *testing.T) {\ncases := []struct {\ninput, expected string\n" } ]
Go
Apache License 2.0
moov-io/watchman
don't insert duplicates in TopSSIs
428,986
04.12.2019 16:49:23
25,200
11ac87ab969529419aab8ebc534840a718566dcb
cleanup pkg/csl and add tests
[ { "change_type": "MODIFY", "old_path": "pkg/csl/reader.go", "new_path": "pkg/csl/reader.go", "diff": "@@ -2,7 +2,6 @@ package csl\nimport (\n\"encoding/csv\"\n- \"fmt\"\n\"io\"\n\"os\"\n\"strings\"\n@@ -17,11 +16,6 @@ func Read(path string) (*CSL, error) {\nreader := csv.NewReader(f)\n- _, err = reader.Read() // read and discard the header row\n- if err != nil {\n- return nil, err\n- }\n-\nvar ssis []*SSI\nfor {\nrecord, err := reader.Read()\n@@ -32,11 +26,6 @@ func Read(path string) (*CSL, error) {\ncontinue\n}\n- if len(record) != 28 {\n- fmt.Print(len(record))\n- continue\n- }\n-\nswitch record[0] {\ncase \"Sectoral Sanctions Identifications List (SSI) - Treasury Department\":\nssis = append(ssis, unmarshalSSI(record))\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader_test.go", "new_path": "pkg/csl/reader_test.go", "diff": "@@ -19,6 +19,19 @@ func TestRead(t *testing.T) {\n}\n}\n+func TestRead_invalidRow(t *testing.T) {\n+ csl, err := Read(filepath.Join(\"..\", \"..\", \"test\", \"testdata\", \"invalidFiles\", \"csl.csv\"))\n+ if err != nil {\n+ t.Fatal(err)\n+ }\n+ if csl == nil {\n+ t.Errorf(\"failed to parse csl.csv\")\n+ }\n+ if len(csl.SSIs) != 1 {\n+ t.Errorf(\"len(SSIs)=%d\", len(csl.SSIs))\n+ }\n+}\n+\nfunc Test_unmarshalSSI(t *testing.T) {\n// row from the live CSL\nrecord := []string{\"Sectoral Sanctions Identifications List (SSI) - Treasury Department\", \"17254\", \"Entity\", \"UKRAINE-EO13662]; SYRIA\", \"AK TRANSNEFT OAO\",\n@@ -52,6 +65,7 @@ func Test_expandField(t *testing.T) {\ninput string\nwant []string\n}{\n+ {\"\", []string{\"\"}},\n{\"1021100731190, Registration ID ; 00159025, Government Gazette Number; 1102024468, Tax ID No.; ukhta-tr.gazprom.ru, Website; azaharov@sgp.gazprom.ru, Email Address; Subject to Directive 4, Executive Order 13662 Directive Determination -\",\n[]string{\"1021100731190, Registration ID\", \"00159025, Government Gazette Number\", \"1102024468, Tax ID No.\", \"ukhta-tr.gazprom.ru, Website\",\n\"azaharov@sgp.gazprom.ru, Email Address\", \"Subject to Directive 4, Executive Order 13662 Directive Determination -\"}},\n@@ -70,6 +84,7 @@ func Test_expandProgramsList(t *testing.T) {\ninput string\nwant []string\n}{\n+ {\"\", []string{\"\"}},\n{\"IFSR] [SDGT\", []string{\"IFSR\", \"SDGT\"}}, // Sometimes the CSL \"programs\" column contains data like \"IFSR] [SDGT\" instead of \"IFSR; SDGT\"\n{\"IFSR; SDGT\", []string{\"IFSR\", \"SDGT\"}},\n{\"CYBER2; CAATSA - RUSSIA\", []string{\"CYBER2\", \"CAATSA - RUSSIA\"}},\n" }, { "change_type": "ADD", "old_path": null, "new_path": "test/testdata/invalidFiles/csl.csv", "diff": "+source,entity_number,type,programs,name,title,addresses,federal_register_notice,start_date,end_date,standard_order,license_requirement,license_policy,call_sign,vessel_type,gross_tonnage,gross_registered_tonnage,vessel_flag,vessel_owner,remarks,source_list_url,alt_names,citizenships,dates_of_birth,nationalities,places_of_birth,source_information_url,ids\n+/,1\n+Sectoral Sanctions Identifications List (SSI) - Treasury Department,20298,Entity,UKRAINE-EO13662,GAZPROMBANK UPRAVLENIE AKTIVAMI,,\"63 Novocheremushkinskaya Street, Moscow, 117418, RU; Koroviy val., building 7, Moscow, 119049, RU\",,,,,,,,,,,,,\"For more information on directives, please visit the following link: https://www.treasury.gov/resource-center/sanctions/Programs/Pages/ukraine.aspx#directives; (Linked To: GAZPROMBANK OAO)\",http://bit.ly/1QWTIfE,GAZPROMBANK ASSET MANAGEMENT ZAO; CLOSED JOINT-STOCK COMPANY GAZPROMBANK-UPRAVLENIE AKTIVAMI,\"\",\"\",\"\",\"\",http://bit.ly/1MLgou0,\"7722515837, Tax ID No.; 1047796382920, Registration ID; Subject to Directive 1, Executive Order 13662 Directive Determination -\"\n" } ]
Go
Apache License 2.0
moov-io/watchman
cleanup pkg/csl and add tests
428,986
05.12.2019 10:30:20
25,200
f5e64e37ae9e59253a50bdc0db0eacbb145400e4
TopSSIs skip empty alt names
[ { "change_type": "MODIFY", "old_path": "cmd/server/search.go", "new_path": "cmd/server/search.go", "diff": "@@ -327,6 +327,9 @@ func (s *searcher) TopSSIs(limit int, name string) []SSI {\nweight: jaroWinkler(ssi.name, name),\n}\nfor _, alt := range ssi.SectoralSanction.AlternateNames {\n+ if alt == \"\" {\n+ continue\n+ }\ncurrWeight := jaroWinkler(alt, name)\nif currWeight > it.weight {\nit.weight = currWeight\n" } ]
Go
Apache License 2.0
moov-io/watchman
TopSSIs skip empty alt names
428,986
05.12.2019 14:20:36
25,200
c59308e724aea7407d94e9d45a07f210b717ac81
update openapi.yml and regenerate client
[ { "change_type": "MODIFY", "old_path": "client/README.md", "new_path": "client/README.md", "diff": "@@ -58,6 +58,7 @@ Class | Method | HTTP request | Description\n- [Download](docs/Download.md)\n- [Dpl](docs/Dpl.md)\n+ - [El](docs/El.md)\n- [Error](docs/Error.md)\n- [OfacAlt](docs/OfacAlt.md)\n- [OfacCompany](docs/OfacCompany.md)\n" }, { "change_type": "MODIFY", "old_path": "client/api_watchman.go", "new_path": "client/api_watchman.go", "diff": "@@ -1581,8 +1581,8 @@ Search Search SDN names and metadata\n* @param optional nil or *SearchOpts - Optional Parameters:\n* @param \"XRequestID\" (optional.String) - Optional Request ID allows application developer to trace requests through the systems logs\n* @param \"XUserID\" (optional.String) - Optional User ID used to perform this search\n- * @param \"Q\" (optional.String) - Search across Name, Alt Names, and Address fields for all SDN entries. Entries may be returned in all response sub-objects.\n- * @param \"Name\" (optional.String) - Name which could correspond to a human on the SDN list. Only SDN results will be returned.\n+ * @param \"Q\" (optional.String) - Search across Name, Alt Names, and SDN Address fields for all available sanctions lists. Entries may be returned in all response sub-objects.\n+ * @param \"Name\" (optional.String) - Name which could correspond to an entry on the SDN, Denied Persons, Sectoral Sanctions Identifications, or BIS Entity List sanctions lists.\n* @param \"Address\" (optional.String) - Phsical address which could correspond to a human on the SDN list. Only Address results will be returned.\n* @param \"City\" (optional.String) - City name as desginated by SDN guidelines. Only Address results will be returned.\n* @param \"State\" (optional.String) - State name as desginated by SDN guidelines. Only Address results will be returned.\n" }, { "change_type": "MODIFY", "old_path": "client/docs/Download.md", "new_path": "client/docs/Download.md", "diff": "@@ -7,6 +7,8 @@ Name | Type | Description | Notes\n**SDNs** | **int32** | | [optional]\n**AltNames** | **int32** | | [optional]\n**Addresses** | **int32** | | [optional]\n+**SectoralSanctions** | **int32** | | [optional]\n+**EntityList** | **int32** | | [optional]\n**Timestamp** | [**time.Time**](time.Time.md) | | [optional]\n[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "client/docs/El.md", "diff": "+# El\n+\n+## Properties\n+\n+Name | Type | Description | Notes\n+------------ | ------------- | ------------- | -------------\n+**Name** | **string** | The name of the entity | [optional]\n+**Addresses** | **[]string** | Addresses associated with the entity | [optional]\n+**AlternateNames** | **[]string** | Known aliases associated with the entity | [optional]\n+**StartDate** | **string** | Date when the restriction came into effect | [optional]\n+**LicenseRequirement** | **string** | Specifies the license requirement imposed on the named entity | [optional]\n+**LicensePolicy** | **string** | Identifies the policy BIS uses to review the licenseRequirements | [optional]\n+**FrNotice** | **string** | Identifies the corresponding Notice in the Federal Register | [optional]\n+**SourceListURL** | **string** | The link to the official SSI list | [optional]\n+**SourceInfoURL** | **string** | The link for information regarding the source | [optional]\n+\n+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)\n+\n+\n" }, { "change_type": "MODIFY", "old_path": "client/docs/Search.md", "new_path": "client/docs/Search.md", "diff": "@@ -9,6 +9,7 @@ Name | Type | Description | Notes\n**Addresses** | [**[]OfacEntityAddress**](OfacEntityAddress.md) | | [optional]\n**DeniedPersons** | [**[]Dpl**](DPL.md) | | [optional]\n**SectoralSanctions** | [**[]Ssi**](SSI.md) | | [optional]\n+**EntityList** | [**[]El**](EL.md) | | [optional]\n**RefreshedAt** | [**time.Time**](time.Time.md) | | [optional]\n[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)\n" }, { "change_type": "MODIFY", "old_path": "client/docs/WatchmanApi.md", "new_path": "client/docs/WatchmanApi.md", "diff": "@@ -751,8 +751,8 @@ Name | Type | Description | Notes\n------------- | ------------- | ------------- | -------------\n**xRequestID** | **optional.String**| Optional Request ID allows application developer to trace requests through the systems logs |\n**xUserID** | **optional.String**| Optional User ID used to perform this search |\n- **q** | **optional.String**| Search across Name, Alt Names, and Address fields for all SDN entries. Entries may be returned in all response sub-objects. |\n- **name** | **optional.String**| Name which could correspond to a human on the SDN list. Only SDN results will be returned. |\n+ **q** | **optional.String**| Search across Name, Alt Names, and SDN Address fields for all available sanctions lists. Entries may be returned in all response sub-objects. |\n+ **name** | **optional.String**| Name which could correspond to an entry on the SDN, Denied Persons, Sectoral Sanctions Identifications, or BIS Entity List sanctions lists. |\n**address** | **optional.String**| Phsical address which could correspond to a human on the SDN list. Only Address results will be returned. |\n**city** | **optional.String**| City name as desginated by SDN guidelines. Only Address results will be returned. |\n**state** | **optional.String**| State name as desginated by SDN guidelines. Only Address results will be returned. |\n" }, { "change_type": "MODIFY", "old_path": "client/model_download.go", "new_path": "client/model_download.go", "diff": "@@ -18,5 +18,7 @@ type Download struct {\nSDNs int32 `json:\"SDNs,omitempty\"`\nAltNames int32 `json:\"altNames,omitempty\"`\nAddresses int32 `json:\"addresses,omitempty\"`\n+ SectoralSanctions int32 `json:\"sectoralSanctions,omitempty\"`\n+ EntityList int32 `json:\"entityList,omitempty\"`\nTimestamp time.Time `json:\"timestamp,omitempty\"`\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "client/model_el.go", "diff": "+/*\n+ * Watchman API\n+ *\n+ * Moov Watchman is an HTTP API and Go library to download, parse and offer search functions over numerous trade sanction lists from the United States, European Union governments, agencies, and non profits for complying with regional laws. Also included is a web UI and async webhook notification service to initiate processes on remote systems.\n+ *\n+ * API version: v1\n+ * Generated by: OpenAPI Generator (https://openapi-generator.tech)\n+ */\n+\n+package openapi\n+\n+// El Entity List (EL) - Bureau of Industry and Security\n+type El struct {\n+ // The name of the entity\n+ Name string `json:\"name,omitempty\"`\n+ // Addresses associated with the entity\n+ Addresses []string `json:\"addresses,omitempty\"`\n+ // Known aliases associated with the entity\n+ AlternateNames []string `json:\"alternateNames,omitempty\"`\n+ // Date when the restriction came into effect\n+ StartDate string `json:\"startDate,omitempty\"`\n+ // Specifies the license requirement imposed on the named entity\n+ LicenseRequirement string `json:\"licenseRequirement,omitempty\"`\n+ // Identifies the policy BIS uses to review the licenseRequirements\n+ LicensePolicy string `json:\"licensePolicy,omitempty\"`\n+ // Identifies the corresponding Notice in the Federal Register\n+ FrNotice string `json:\"frNotice,omitempty\"`\n+ // The link to the official SSI list\n+ SourceListURL string `json:\"sourceListURL,omitempty\"`\n+ // The link for information regarding the source\n+ SourceInfoURL string `json:\"sourceInfoURL,omitempty\"`\n+}\n" }, { "change_type": "MODIFY", "old_path": "client/model_search.go", "new_path": "client/model_search.go", "diff": "@@ -20,5 +20,6 @@ type Search struct {\nAddresses []OfacEntityAddress `json:\"addresses,omitempty\"`\nDeniedPersons []Dpl `json:\"deniedPersons,omitempty\"`\nSectoralSanctions []Ssi `json:\"sectoralSanctions,omitempty\"`\n+ EntityList []El `json:\"entityList,omitempty\"`\nRefreshedAt time.Time `json:\"refreshedAt,omitempty\"`\n}\n" }, { "change_type": "MODIFY", "old_path": "openapi.yaml", "new_path": "openapi.yaml", "diff": "@@ -561,13 +561,13 @@ paths:\nschema:\ntype: string\nexample: John Doe\n- description: Search across Name, Alt Names, and Address fields for all SDN entries. Entries may be returned in all response sub-objects.\n+ description: Search across Name, Alt Names, and SDN Address fields for all available sanctions lists. Entries may be returned in all response sub-objects.\n- name: name\nin: query\nschema:\ntype: string\nexample: Jane Smith\n- description: Name which could correspond to a human on the SDN list. Only SDN results will be returned.\n+ description: Name which could correspond to an entry on the SDN, Denied Persons, Sectoral Sanctions Identifications, or BIS Entity List sanctions lists.\n- name: address\nin: query\nschema:\n@@ -1074,6 +1074,10 @@ components:\ntype: array\nitems:\n$ref: '#/components/schemas/SSI'\n+ entityList:\n+ type: array\n+ items:\n+ $ref: '#/components/schemas/EL'\nrefreshedAt:\ntype: string\nformat: date-time\n@@ -1115,6 +1119,12 @@ components:\naddresses:\ntype: integer\nexample: 11747\n+ sectoralSanctions:\n+ type: integer\n+ example: 329\n+ entityList:\n+ type: integer\n+ example: 1391\ntimestamp:\ntype: string\nformat: date-time\n@@ -1123,4 +1133,4 @@ components:\ntype: array\nitems:\ntype: string\n- example: [\"aircraft\", \"individual\", \"vessel\"]\n+ example: [\"entity\", \"aircraft\", \"individual\", \"vessel\"]\n" } ]
Go
Apache License 2.0
moov-io/watchman
update openapi.yml and regenerate client
428,986
05.12.2019 14:57:44
25,200
48502ab261c2d1b10205042b2bae694bc4807bbc
fix typo (licence->license)
[ { "change_type": "MODIFY", "old_path": "pkg/csl/el.go", "new_path": "pkg/csl/el.go", "diff": "@@ -10,9 +10,9 @@ type EL struct {\nAddresses []string `json:\"addresses\"`\n// StartDate is the effective date\nStartDate string `json:\"startDate\"`\n- // LicenceRequirement specifies the license requirements that it imposes on each listed person\n- LicenceRequirement string `json:\"licenseRequirement\"`\n- // LicensePolicy is the policy with which BIS reviews the requirements set forth in Licence Requirements\n+ // LicenseRequirement specifies the license requirements that it imposes on each listed person\n+ LicenseRequirement string `json:\"licenseRequirement\"`\n+ // LicensePolicy is the policy with which BIS reviews the requirements set forth in License Requirements\nLicensePolicy string `json:\"licensePolicy\"`\n// FRNotice identifies the notice in the Federal Register\nFRNotice string `json:\"FRNotice\"`\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader.go", "new_path": "pkg/csl/reader.go", "diff": "@@ -64,7 +64,7 @@ func unmarshalEL(row []string) *EL {\nAddresses: expandField(row[AddressesIdx]),\nAlternateNames: expandField(row[AltNamesIdx]),\nStartDate: row[StartDateIdx],\n- LicenceRequirement: row[LicenseRequirementIdx],\n+ LicenseRequirement: row[LicenseRequirementIdx],\nLicensePolicy: row[LicensePolicyIdx],\nFRNotice: row[FRNoticeIdx],\nSourceListURL: row[SourceListURLIdx],\n" } ]
Go
Apache License 2.0
moov-io/watchman
fix typo (licence->license)
428,986
10.12.2019 10:19:37
25,200
92d1174d81d2596623e70dbfba51018785a5f257
pkg/ofac: clean up SDN programs when reading csv
[ { "change_type": "MODIFY", "old_path": "pkg/ofac/reader.go", "new_path": "pkg/ofac/reader.go", "diff": "@@ -144,7 +144,7 @@ func csvSDNFile(path string) (*Results, error) {\nEntityID: record[0],\nSDNName: record[1],\nSDNType: record[2],\n- Program: record[3],\n+ Program: cleanPrgmsList(record[3]),\nTitle: record[4],\nCallSign: record[5],\nVesselType: record[6],\n@@ -192,3 +192,12 @@ func replaceNull(s []string) []string {\n}\nreturn s\n}\n+\n+// Some entries in the SDN have a malformed programs list.\n+// Fields containing lists are supposed to be semicolon delimited, but the programs list doesn't always follow this convention.\n+// Ex: \"SDGT] [IFSR\" => \"SDGT; IFSR\", \"SDNTK] [FTO] [SDGT\" => \"SDNTK; FTO; SDGT\"\n+var prgmReplacer = strings.NewReplacer(\"] [\", \"; \", \"]\", \"\", \"[\", \"\")\n+\n+func cleanPrgmsList(s string) string {\n+ return strings.TrimSpace(prgmReplacer.Replace(s))\n+}\n" }, { "change_type": "MODIFY", "old_path": "pkg/ofac/reader_test.go", "new_path": "pkg/ofac/reader_test.go", "diff": "@@ -58,3 +58,22 @@ func TestReplaceNull(t *testing.T) {\nt.Errorf(\"Got %v\", ans)\n}\n}\n+\n+func TestCleanPrgmsList(t *testing.T) {\n+ tests := []struct {\n+ prgms string\n+ expected string\n+ }{\n+ {\"SDGT] \", \"SDGT\"},\n+ {\" SDGT] [IFSR\", \"SDGT; IFSR\"},\n+ {\"SDNTK] [FTO] [SDGT\", \"SDNTK; FTO; SDGT\"},\n+ {\"SDNTK] [FTO] [SDGT; IFSR]\", \"SDNTK; FTO; SDGT; IFSR\"},\n+ {\"[IFSR] [SDNTK] [FTO] [SDGT\", \"IFSR; SDNTK; FTO; SDGT\"},\n+ }\n+\n+ for _, test := range tests {\n+ if actual := cleanPrgmsList(test.prgms); actual != test.expected {\n+ t.Errorf(\"Wanted %q, got %q\", test.expected, actual)\n+ }\n+ }\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
pkg/ofac: clean up SDN programs when reading csv
428,986
13.12.2019 16:09:28
25,200
4f836c92b250293846b7e6a80ee1d68f58335cb8
cmd/server: add TopAltNames to searchByName
[ { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -350,6 +350,7 @@ func searchByName(logger log.Logger, searcher *searcher, nameSlug string) http.H\njson.NewEncoder(w).Encode(&searchResponse{\n// OFAC\nSDNs: sdns,\n+ AltNames: searcher.TopAltNames(limit, nameSlug),\nSectoralSanctions: searcher.TopSSIs(limit, nameSlug),\n// BIS\nDeniedPersons: searcher.TopDPs(limit, nameSlug),\n" } ]
Go
Apache License 2.0
moov-io/watchman
cmd/server: add TopAltNames to searchByName
428,986
13.12.2019 16:19:20
25,200
0b8af0bc50124066b11e23b4b39ac998b6f27844
cmd/server: include AltNames in TestSearch__Name
[ { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers_test.go", "new_path": "cmd/server/search_handlers_test.go", "diff": "@@ -288,6 +288,7 @@ func TestSearch__Name(t *testing.T) {\ncombinedSearcher := &searcher{\n// OFAC\nSDNs: sdnSearcher.SDNs,\n+ Alts: altSearcher.Alts,\nSSIs: ssiSearcher.SSIs,\n// BIS\nDPs: dplSearcher.DPs,\n@@ -308,6 +309,7 @@ func TestSearch__Name(t *testing.T) {\nvar wrapper struct {\n// OFAC\nSDNs []*ofac.SDN `json:\"SDNs\"`\n+ Alts []*ofac.AlternateIdentity `json:\"altNames\"`\nSSIs []*csl.SSI `json:\"sectoralSanctions\"`\n// BIS\nDPs []*dpl.DPL `json:\"deniedPersons\"`\n@@ -316,13 +318,16 @@ func TestSearch__Name(t *testing.T) {\nif err := json.NewDecoder(w.Body).Decode(&wrapper); err != nil {\nt.Fatal(err)\n}\n- if len(wrapper.SDNs) != 1 || len(wrapper.SSIs) != 1 || len(wrapper.DPs) != 1 || len(wrapper.ELs) != 1 {\n- t.Fatalf(\"SDNs=%d SSIs=%d DPs=%d ELs=%d\",\n- len(wrapper.SDNs), len(wrapper.SSIs), len(wrapper.DPs), len(wrapper.ELs))\n+ if len(wrapper.SDNs) != 1 || len(wrapper.Alts) != 1 || len(wrapper.SSIs) != 1 || len(wrapper.DPs) != 1 || len(wrapper.ELs) != 1 {\n+ t.Fatalf(\"SDNs=%d Alts=%d SSIs=%d DPs=%d ELs=%d\",\n+ len(wrapper.SDNs), len(wrapper.Alts), len(wrapper.SSIs), len(wrapper.DPs), len(wrapper.ELs))\n}\nif wrapper.SDNs[0].EntityID != \"2676\" {\nt.Errorf(\"%#v\", wrapper.SDNs[0])\n}\n+ if wrapper.Alts[0].EntityID != \"4691\" {\n+ t.Errorf(\"%#v\", wrapper.Alts[0])\n+ }\nif wrapper.SSIs[0].EntityID != \"18782\" {\nt.Errorf(\"%#v\", wrapper.SSIs[0])\n}\n" } ]
Go
Apache License 2.0
moov-io/watchman
cmd/server: include AltNames in TestSearch__Name
428,978
21.07.2021 12:12:32
21,600
7e452f881e1ed731b9bf67ac659b63db5f1edc2a
Add match to client entities
[ { "change_type": "MODIFY", "old_path": "api/client.yaml", "new_path": "api/client.yaml", "diff": "@@ -1052,6 +1052,10 @@ components:\ntype: string\ndescription: The link for information regarding the source\nexample: http://bit.ly/1MLgou0\n+ match:\n+ type: number\n+ description: Match percentage of search query\n+ example: 0.91\nBISEntities:\ndescription: Bureau of Industry and Security Entity List\nproperties:\n@@ -1095,6 +1099,10 @@ components:\ntype: string\ndescription: The link for information regarding the source\nexample: http://bit.ly/1MLgou0\n+ match:\n+ type: number\n+ description: Match percentage of search query\n+ example: 0.91\nUpdateOfacCompanyStatus:\ndescription: Request body to update a company status.\nproperties:\n" }, { "change_type": "MODIFY", "old_path": "client/docs/BisEntities.md", "new_path": "client/docs/BisEntities.md", "diff": "@@ -13,6 +13,7 @@ Name | Type | Description | Notes\n**FrNotice** | **string** | Identifies the corresponding Notice in the Federal Register | [optional]\n**SourceListURL** | **string** | The link to the official SSI list | [optional]\n**SourceInfoURL** | **string** | The link for information regarding the source | [optional]\n+**Match** | **float32** | Match percentage of search query | [optional]\n[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)\n" }, { "change_type": "MODIFY", "old_path": "client/docs/Ssi.md", "new_path": "client/docs/Ssi.md", "diff": "@@ -14,6 +14,7 @@ Name | Type | Description | Notes\n**Ids** | **[]string** | IDs on file for the entity | [optional]\n**SourceListURL** | **string** | The link to the official SSI list | [optional]\n**SourceInfoURL** | **string** | The link for information regarding the source | [optional]\n+**Match** | **float32** | Match percentage of search query | [optional]\n[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)\n" }, { "change_type": "MODIFY", "old_path": "client/model_bis_entities.go", "new_path": "client/model_bis_entities.go", "diff": "@@ -29,4 +29,6 @@ type BisEntities struct {\nSourceListURL string `json:\"sourceListURL,omitempty\"`\n// The link for information regarding the source\nSourceInfoURL string `json:\"sourceInfoURL,omitempty\"`\n+ // Match percentage of search query\n+ Match float32 `json:\"match,omitempty\"`\n}\n" }, { "change_type": "MODIFY", "old_path": "client/model_ssi.go", "new_path": "client/model_ssi.go", "diff": "@@ -30,4 +30,6 @@ type Ssi struct {\nSourceListURL string `json:\"sourceListURL,omitempty\"`\n// The link for information regarding the source\nSourceInfoURL string `json:\"sourceInfoURL,omitempty\"`\n+ // Match percentage of search query\n+ Match float32 `json:\"match,omitempty\"`\n}\n" } ]
Go
Apache License 2.0
moov-io/watchman
COR-462 Add match to client entities
428,978
29.09.2021 15:32:02
21,600
2fe94e8cc498ded127ab97a6ac6c7ebfba862320
more Unit tests for jaro winkler
[ { "change_type": "MODIFY", "old_path": "cmd/server/search_test.go", "new_path": "cmd/server/search_test.go", "diff": "@@ -248,16 +248,23 @@ func TestJaroWinkler(t *testing.T) {\n{\"africada financial services bureau change\", \"skylight financial services\", 0.887},\n{\"africada financial services bureau change\", \"skylight financial services inc\", 0.79},\n{\"the group for the preservation of the holy sites\", \"the bridgespan group\", 1.00},\n+ {\"the group for the preservation of the holy sites\", \"the logan group\", 1.00},\n+ {\"the group for the preservation of the holy sites\", \"the anything group\", 1.00},\n+ {\"the group for the preservation of the holy sites\", \"the hello world group\", 1.00},\n+ {\"the group for the preservation of the holy sites\", \"the group\", 0.67},\n+ {\"the group for the preservation of the holy sites\", \"The flibbity jibbity flobbity jobbity grobbity zobbity group\", 0.699},\n{\"the islamic army for the liberation of the holy places\", \"the bridgespan group\", 1.00},\n{\"the islamic army for the liberation of the holy places\", \"the logan group\", 1.00},\n{\"the islamic army for the liberation of the holy places\", \"the anything group\", 1.00},\n{\"the islamic army for the liberation of the holy places\", \"the hello world group\", 0.922},\n+ {\"the islamic army for the liberation of the holy places\", \"the group\", 0.551},\n+ {\"the islamic army for the liberation of the holy places\", \"The flibbity jibbity flobbity jobbity grobbity zobbity group\", 0.656},\n{\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the bridgespan group\", 1.00},\n{\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the logan group\", 1.00},\n{\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the anything group\", 1.00},\n{\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the hello world group\", 0.904},\n- {\"the group for the preservation of the holy sites\", \"the group\", 0.67},\n- {\"the group for the preservation of the holy sites\", \"The flibbity jibbity flobbity jobbity grobbity zobbity group\", 0.699},\n+ {\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the group\", 0.438},\n+ {\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the flibbity jibbity flobbity jobbity grobbity zobbity group\", 0.743},\n// stopwords\n{\"i c sogo kenkyusho\", precompute(\"A.I.C. SOGO KENKYUSHO\"), 0.667},\n{precompute(\"A.I.C. SOGO KENKYUSHO\"), \"sogo kenkyusho\", 0.667},\n" } ]
Go
Apache License 2.0
moov-io/watchman
COr-643 more Unit tests for jaro winkler
428,978
29.09.2021 15:49:21
21,600
c19390d2404c1877bc52091db832e32a0c8e108b
pre-compute on jaro winkler
[ { "change_type": "MODIFY", "old_path": "cmd/server/search_test.go", "new_path": "cmd/server/search_test.go", "diff": "@@ -248,11 +248,17 @@ func TestJaroWinkler(t *testing.T) {\n{\"africada financial services bureau change\", \"skylight financial services\", 0.887},\n{\"africada financial services bureau change\", \"skylight financial services inc\", 0.79},\n{\"the group for the preservation of the holy sites\", \"the bridgespan group\", 1.00},\n+ {precompute(\"the group for the preservation of the holy sites\"), precompute(\"the bridgespan group\"), 1.00},\n{\"the group for the preservation of the holy sites\", \"the logan group\", 1.00},\n+ {precompute(\"the group for the preservation of the holy sites\"), precompute(\"the logan group\"), 1.00},\n{\"the group for the preservation of the holy sites\", \"the anything group\", 1.00},\n+ {precompute(\"the group for the preservation of the holy sites\"), precompute(\"the anything group\"), 1.00},\n{\"the group for the preservation of the holy sites\", \"the hello world group\", 1.00},\n+ {precompute(\"the group for the preservation of the holy sites\"), precompute(\"the hello world group\"), 1.00},\n{\"the group for the preservation of the holy sites\", \"the group\", 0.67},\n+ {precompute(\"the group for the preservation of the holy sites\"), precompute(\"the group\"), 0.67},\n{\"the group for the preservation of the holy sites\", \"The flibbity jibbity flobbity jobbity grobbity zobbity group\", 0.699},\n+ {precompute(\"the group for the preservation of the holy sites\"), precompute(\"the flibbity jibbity flobbity jobbity grobbity zobbity group\"), .783},\n{\"the islamic army for the liberation of the holy places\", \"the bridgespan group\", 1.00},\n{\"the islamic army for the liberation of the holy places\", \"the logan group\", 1.00},\n{\"the islamic army for the liberation of the holy places\", \"the anything group\", 1.00},\n" } ]
Go
Apache License 2.0
moov-io/watchman
COr-643 pre-compute on jaro winkler
428,978
29.09.2021 16:24:47
21,600
023d6686ff238cb155397552f6c014ecd3d42358
pre-compute alt names
[ { "change_type": "MODIFY", "old_path": "cmd/server/companies_test.go", "new_path": "cmd/server/companies_test.go", "diff": "@@ -52,7 +52,7 @@ func init() {\nAlternateType: \"aka\",\nAlternateName: \"AL-HISN FIRM\",\n},\n- })\n+ }, noLogPipeliner)\n}\nfunc createTestCompanyRepository(t *testing.T) *sqliteCompanyRepository {\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/customers_test.go", "new_path": "cmd/server/customers_test.go", "diff": "@@ -54,7 +54,7 @@ func init() {\nAlternateType: \"aka\",\nAlternateName: \"NATIONAL BANK OF CUBA\",\n},\n- })\n+ }, noLogPipeliner)\n}\nfunc createTestCustomerRepository(t *testing.T) *sqliteCustomerRepository {\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -183,7 +183,7 @@ func (s *searcher) refreshData(initialDir string) (*downloadStats, error) {\nsdns := precomputeSDNs(results.SDNs, results.Addresses, s.pipe)\nadds := precomputeAddresses(results.Addresses)\n- alts := precomputeAlts(results.AlternateIdentities)\n+ alts := precomputeAlts(results.AlternateIdentities, s.pipe)\ndeniedPersons, err := dplRecords(s.logger, initialDir)\nif err != nil {\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/pipeline.go", "new_path": "cmd/server/pipeline.go", "diff": "@@ -41,6 +41,13 @@ func sdnName(sdn *ofac.SDN, addrs []*ofac.Address) *Name {\n}\n}\n+func altName(alt *ofac.AlternateIdentity) *Name {\n+ return &Name{\n+ Original: alt.AlternateName,\n+ Processed: alt.AlternateName,\n+ }\n+}\n+\nfunc ssiName(ssi *csl.SSI) *Name {\nreturn &Name{\nOriginal: ssi.Name,\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search.go", "new_path": "cmd/server/search.go", "diff": "@@ -648,12 +648,19 @@ func (a Alt) MarshalJSON() ([]byte, error) {\n})\n}\n-func precomputeAlts(alts []*ofac.AlternateIdentity) []*Alt {\n+func precomputeAlts(alts []*ofac.AlternateIdentity, pipe *pipeliner) []*Alt {\nout := make([]*Alt, len(alts))\nfor i := range alts {\n+ an := altName(alts[i])\n+\n+ if err := pipe.Do(an); err != nil {\n+ pipe.logger.Log(\"pipeline\", fmt.Sprintf(\"problem pipelining SDN: %v\", err))\n+ continue\n+ }\n+\nout[i] = &Alt{\nAlternateIdentity: alts[i],\n- name: precompute(alts[i].AlternateName),\n+ name: an.Processed,\n}\n}\nreturn out\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_test.go", "new_path": "cmd/server/search_test.go", "diff": "@@ -66,7 +66,7 @@ func init() {\nAlternateType: \"aka\",\nAlternateName: \"A.I.C. SOGO KENKYUSHO\",\n},\n- })\n+ }, noLogPipeliner)\nsdnSearcher.SDNs = precomputeSDNs([]*ofac.SDN{\n{\nEntityID: \"2676\",\n@@ -247,31 +247,28 @@ func TestJaroWinkler(t *testing.T) {\n{\"africada financial services bureau change\", \"skylight services inc\", 0.806},\n{\"africada financial services bureau change\", \"skylight financial services\", 0.887},\n{\"africada financial services bureau change\", \"skylight financial services inc\", 0.79},\n+\n+ // stopwords tests\n{\"the group for the preservation of the holy sites\", \"the bridgespan group\", 1.00},\n{precompute(\"the group for the preservation of the holy sites\"), precompute(\"the bridgespan group\"), 1.00},\n+ {\"group preservation holy sites\", \"bridgespan group\", 0.689},\n{\"the group for the preservation of the holy sites\", \"the logan group\", 1.00},\n{precompute(\"the group for the preservation of the holy sites\"), precompute(\"the logan group\"), 1.00},\n+ {\"group preservation holy sites\", \"logan group\", 0.478},\n{\"the group for the preservation of the holy sites\", \"the anything group\", 1.00},\n{precompute(\"the group for the preservation of the holy sites\"), precompute(\"the anything group\"), 1.00},\n+ {\"group preservation holy sites\", \"anything group\", 0.617},\n{\"the group for the preservation of the holy sites\", \"the hello world group\", 1.00},\n{precompute(\"the group for the preservation of the holy sites\"), precompute(\"the hello world group\"), 1.00},\n+ {\"group preservation holy sites\", \"hello world group\", 0.687},\n{\"the group for the preservation of the holy sites\", \"the group\", 0.67},\n{precompute(\"the group for the preservation of the holy sites\"), precompute(\"the group\"), 0.67},\n+ {\"group preservation holy sites\", \"group\", 0.460},\n{\"the group for the preservation of the holy sites\", \"The flibbity jibbity flobbity jobbity grobbity zobbity group\", 0.699},\n{precompute(\"the group for the preservation of the holy sites\"), precompute(\"the flibbity jibbity flobbity jobbity grobbity zobbity group\"), .783},\n- {\"the islamic army for the liberation of the holy places\", \"the bridgespan group\", 1.00},\n- {\"the islamic army for the liberation of the holy places\", \"the logan group\", 1.00},\n- {\"the islamic army for the liberation of the holy places\", \"the anything group\", 1.00},\n- {\"the islamic army for the liberation of the holy places\", \"the hello world group\", 0.922},\n- {\"the islamic army for the liberation of the holy places\", \"the group\", 0.551},\n- {\"the islamic army for the liberation of the holy places\", \"The flibbity jibbity flobbity jobbity grobbity zobbity group\", 0.656},\n- {\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the bridgespan group\", 1.00},\n- {\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the logan group\", 1.00},\n- {\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the anything group\", 1.00},\n- {\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the hello world group\", 0.904},\n- {\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the group\", 0.438},\n- {\"the sabotage and military surveillance group of the riydah al-salihin martyrs\", \"the flibbity jibbity flobbity jobbity grobbity zobbity group\", 0.743},\n- // stopwords\n+ {\"group preservation holy sites\", \"flibbity jibbity flobbity jobbity grobbity zobbity group\", 0.590},\n+\n+ // precompute\n{\"i c sogo kenkyusho\", precompute(\"A.I.C. SOGO KENKYUSHO\"), 0.667},\n{precompute(\"A.I.C. SOGO KENKYUSHO\"), \"sogo kenkyusho\", 0.667},\n}\n" } ]
Go
Apache License 2.0
moov-io/watchman
COr-643 pre-compute alt names
428,978
04.10.2021 14:35:09
21,600
d63517cddeb04a0f817828f2eb29ffffd1af65ad
Bugfix on alt names pre-compute
[ { "change_type": "MODIFY", "old_path": "CHANGELOG.md", "new_path": "CHANGELOG.md", "diff": "+## v0.21.1 (Released 2021-10-04)\n+\n+Release v0.21.1 applies bugfix to pre-computation steps to SDN alternate names.\n+\n+BUG FIXES\n+\n+- search: bugfix for pipeline steps to SDN alt names (#376)\n+\n## v0.21.0 (Released 2021-09-29)\nRelease v0.21.0 applies pre-computation steps to SDN alternate names which was previously missing. This impacts\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/pipeline.go", "new_path": "cmd/server/pipeline.go", "diff": "@@ -25,6 +25,7 @@ type Name struct {\nProcessed string\n// optional metadata of where a name came from\n+ alt *ofac.AlternateIdentity\nsdn *ofac.SDN\nssi *csl.SSI\ndp *dpl.DPL\n@@ -45,6 +46,7 @@ func altName(alt *ofac.AlternateIdentity) *Name {\nreturn &Name{\nOriginal: alt.AlternateName,\nProcessed: alt.AlternateName,\n+ alt: alt,\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/pipeline_stopwords.go", "new_path": "cmd/server/pipeline_stopwords.go", "diff": "@@ -33,12 +33,17 @@ var (\ntype stopwordsStep struct{}\nfunc (s *stopwordsStep) apply(in *Name) error {\n+ if in == nil {\n+ return nil\n+ }\n+\nswitch {\ncase in.sdn != nil && !strings.EqualFold(in.sdn.SDNType, \"individual\"):\nin.Processed = removeStopwords(in.Processed, detectLanguage(in.Processed, in.addrs))\n-\ncase in.ssi != nil && !strings.EqualFold(in.ssi.Type, \"individual\"):\nin.Processed = removeStopwords(in.Processed, detectLanguage(in.Processed, nil))\n+ case in.alt != nil:\n+ in.Processed = removeStopwords(in.Processed, detectLanguage(in.Processed, nil))\n}\nreturn nil\n}\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/pipeline_stopwords_test.go", "new_path": "cmd/server/pipeline_stopwords_test.go", "diff": "package main\nimport (\n+ \"github.com/moov-io/watchman/pkg/csl\"\n\"testing\"\n\"github.com/moov-io/watchman/pkg/ofac\"\n@@ -75,3 +76,56 @@ func TestStopwords__clean(t *testing.T) {\n}\n}\n}\n+\n+func TestStopwords__apply(t *testing.T) {\n+ cases := []struct {\n+ testName string\n+ in *Name\n+ expected string\n+ }{\n+ {\n+ testName: \"type missing\",\n+ in: &Name{Processed: \"Trees and Trucks\"},\n+ expected: \"Trees and Trucks\",\n+ },\n+ {\n+ testName: \"alt name\",\n+ in: &Name{Processed: \"Trees and Trucks\", alt: &ofac.AlternateIdentity{}},\n+ expected: \"trees trucks\",\n+ },\n+ {\n+ testName: \"sdn individual\",\n+ in: &Name{Processed: \"Trees and Trucks\", sdn: &ofac.SDN{SDNType: \"individual\"}},\n+ expected: \"Trees and Trucks\",\n+ },\n+ {\n+ testName: \"sdn business\",\n+ in: &Name{Processed: \"Trees and Trucks\", sdn: &ofac.SDN{SDNType: \"business\"}},\n+ expected: \"trees trucks\",\n+ },\n+ {\n+ testName: \"ssi individual\",\n+ in: &Name{Processed: \"Trees and Trucks\", ssi: &csl.SSI{Type: \"individual\"}},\n+ expected: \"Trees and Trucks\",\n+ },\n+ {\n+ testName: \"ssi business\",\n+ in: &Name{Processed: \"Trees and Trucks\", ssi: &csl.SSI{Type: \"business\"}},\n+ expected: \"trees trucks\",\n+ },\n+ }\n+\n+ for _, test := range cases {\n+ t.Run(test.testName, func(t *testing.T) {\n+ stopwords := stopwordsStep{}\n+ err := stopwords.apply(test.in)\n+ if err != nil {\n+ t.Errorf(\"\\n#%v in=%v err=%v\", test.testName, test.in, err)\n+ }\n+\n+ if test.in.Processed != test.expected {\n+ t.Errorf(\"\\n#%v expected=%v got=%v\", test.testName, test.expected, test.in.Processed)\n+ }\n+ })\n+ }\n+}\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers_test.go", "new_path": "cmd/server/search_handlers_test.go", "diff": "@@ -357,7 +357,7 @@ func TestSearch__AltName(t *testing.T) {\nt.Errorf(\"bogus status code: %d\", w.Code)\n}\n- if v := w.Body.String(); !strings.Contains(v, `\"match\":0.666`) {\n+ if v := w.Body.String(); !strings.Contains(v, `\"match\":0.5`) {\nt.Error(v)\n}\n" } ]
Go
Apache License 2.0
moov-io/watchman
Bugfix on alt names pre-compute (#376)
428,986
09.11.2021 15:48:20
25,200
c7f735450e5e0140ac6688e67231067c21a298a1
skip malformed rows in input files
[ { "change_type": "MODIFY", "old_path": "pkg/csl/reader.go", "new_path": "pkg/csl/reader.go", "diff": "@@ -2,6 +2,7 @@ package csl\nimport (\n\"encoding/csv\"\n+ \"errors\"\n\"io\"\n\"os\"\n\"strings\"\n@@ -20,12 +21,20 @@ func Read(path string) (*CSL, error) {\nvar els []*EL\nfor {\nrecord, err := reader.Read()\n- if err == io.EOF {\n+ if err != nil {\n+ // reached the last line\n+ if errors.Is(err, io.EOF) {\nbreak\n}\n- if err != nil {\n+ // malformed row\n+ if errors.Is(err, csv.ErrFieldCount) ||\n+ errors.Is(err, csv.ErrBareQuote) ||\n+ errors.Is(err, csv.ErrQuote) {\ncontinue\n}\n+ return nil, err\n+ }\n+\nif len(record) <= 1 {\ncontinue // skip empty records\n}\n" }, { "change_type": "MODIFY", "old_path": "pkg/dpl/reader.go", "new_path": "pkg/dpl/reader.go", "diff": "@@ -6,11 +6,12 @@ package dpl\nimport (\n\"encoding/csv\"\n+ \"errors\"\n\"io\"\n\"os\"\n)\n-// Reader parses DPL records from a TXT file and populates the associated arrays.\n+// Read parses DPL records from a TXT file and populates the associated arrays.\n//\n// For more details on the raw DPL files see https://moov-io.github.io/watchman/file-structure.html\nfunc Read(path string) ([]*DPL, error) {\n@@ -30,13 +31,19 @@ func Read(path string) ([]*DPL, error) {\nfor {\nline, err := reader.Read()\nif err != nil {\n- if err == io.EOF {\n+ if err != nil {\n+ // reached the last line\n+ if errors.Is(err, io.EOF) {\nbreak\n}\n- if err == csv.ErrFieldCount {\n+ // malformed row\n+ if errors.Is(err, csv.ErrFieldCount) ||\n+ errors.Is(err, csv.ErrBareQuote) ||\n+ errors.Is(err, csv.ErrQuote) {\ncontinue\n}\n- return out, err\n+ return nil, err\n+ }\n}\nif len(line) < 12 || (len(line) >= 2 && line[1] == \"Street_Address\") {\n" }, { "change_type": "MODIFY", "old_path": "pkg/dpl/reader_test.go", "new_path": "pkg/dpl/reader_test.go", "diff": "@@ -18,7 +18,12 @@ func TestDPL__read(t *testing.T) {\nt.Errorf(\"found %d DPL records\", len(dpls))\n}\n- if _, err := Read(filepath.Join(\"..\", \"..\", \"test\", \"testdata\", \"sdn.csv\")); err == nil {\n- t.Error(\"expected error\")\n+ // this file is formatted incorrectly for DPL, so we expect all rows to be skipped\n+ got, err := Read(filepath.Join(\"..\", \"..\", \"test\", \"testdata\", \"sdn.csv\"))\n+ if err != nil {\n+ t.Fatal(err)\n+ }\n+ if len(got) != 0 {\n+ t.Errorf(\"found %d DPL records, wanted 0\", len(got))\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "pkg/ofac/reader.go", "new_path": "pkg/ofac/reader.go", "diff": "@@ -6,6 +6,7 @@ package ofac\nimport (\n\"encoding/csv\"\n+ \"errors\"\n\"fmt\"\n\"io\"\n\"os\"\n@@ -77,11 +78,18 @@ func csvAddressFile(path string) (*Results, error) {\nreader := csv.NewReader(f)\nfor {\nrecord, err := reader.Read()\n- if err != nil && err == csv.ErrFieldCount {\n+ if err != nil {\n+ // reached the last line\n+ if errors.Is(err, io.EOF) {\n+ break\n+ }\n+ // malformed row\n+ if errors.Is(err, csv.ErrFieldCount) ||\n+ errors.Is(err, csv.ErrBareQuote) ||\n+ errors.Is(err, csv.ErrQuote) {\ncontinue\n}\n- if err == io.EOF { // TODO(Adam): add max line count break here also\n- break\n+ return nil, err\n}\nif len(record) != 6 {\ncontinue\n@@ -114,11 +122,18 @@ func csvAlternateIdentityFile(path string) (*Results, error) {\nreader := csv.NewReader(f)\nfor {\nrecord, err := reader.Read()\n- if err != nil && err == csv.ErrFieldCount {\n+ if err != nil {\n+ // reached the last line\n+ if errors.Is(err, io.EOF) {\n+ break\n+ }\n+ // malformed row\n+ if errors.Is(err, csv.ErrFieldCount) ||\n+ errors.Is(err, csv.ErrBareQuote) ||\n+ errors.Is(err, csv.ErrQuote) {\ncontinue\n}\n- if err == io.EOF { // TODO(adam)\n- break\n+ return nil, err\n}\nif len(record) != 5 {\ncontinue\n@@ -149,11 +164,18 @@ func csvSDNFile(path string) (*Results, error) {\nreader := csv.NewReader(f)\nfor {\nrecord, err := reader.Read()\n- if err != nil && err == csv.ErrFieldCount {\n+ if err != nil {\n+ // reached the last line\n+ if errors.Is(err, io.EOF) {\n+ break\n+ }\n+ // malformed row\n+ if errors.Is(err, csv.ErrFieldCount) ||\n+ errors.Is(err, csv.ErrBareQuote) ||\n+ errors.Is(err, csv.ErrQuote) {\ncontinue\n}\n- if err == io.EOF { // TODO(Adam): add max line count break here also\n- break\n+ return nil, err\n}\nif len(record) != 12 {\ncontinue\n@@ -194,13 +216,17 @@ func csvSDNCommentsFile(path string) (*Results, error) {\nfor {\nline, err := r.Read()\nif err != nil {\n- if err == io.EOF {\n+ // reached the last line\n+ if errors.Is(err, io.EOF) {\nbreak\n}\n- if err == csv.ErrFieldCount {\n+ // malformed row\n+ if errors.Is(err, csv.ErrFieldCount) ||\n+ errors.Is(err, csv.ErrBareQuote) ||\n+ errors.Is(err, csv.ErrQuote) {\ncontinue\n}\n- return &Results{SDNComments: out}, nil\n+ return nil, err\n}\nif len(line) != 2 {\ncontinue\n" } ]
Go
Apache License 2.0
moov-io/watchman
skip malformed rows in input files (#379)
428,970
17.12.2021 15:02:26
21,600
e501c0be724bb069cc832fbde3b5a111614cf9a1
Grammar and spelling updates 'pring' to 'print' communicated to communication ran to run intutive to intuitive
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -194,7 +194,7 @@ PONG\n| `DPL_DOWNLOAD_TEMPLATE` | HTTP address for downloading the DPL. | `https://www.bis.doc.gov/dpl/%s` |\n| `CSL_DOWNLOAD_TEMPLATE` | HTTP address for downloading the Consolidated Screening List (CSL), which is a collection of US government sanctions lists. | `https://api.trade.gov/consolidated_screening_list/%s` |\n| `KEEP_STOPWORDS` | Boolean to keep stopwords in names. | `false` |\n-| `DEBUG_NAME_PIPELINE` | Boolean to pring debug messages for each name (SDN, SSI) processing step. | `false` |\n+| `DEBUG_NAME_PIPELINE` | Boolean to print debug messages for each name (SDN, SSI) processing step. | `false` |\n#### Storage\n@@ -221,9 +221,9 @@ Refer to the SQLite driver documentation for [connection parameters](https://git\nWhen Watchman sends a [webhook](https://en.wikipedia.org/wiki/Webhook) to your application, the body will contain a JSON representation of the [Company](https://godoc.org/github.com/moov-io/watchman/client#OfacCompany) or [Customer](https://godoc.org/github.com/moov-io/watchman/client#OfacCustomer) model as the body to a POST request. You can see an [example in Go](examples/webhook/webhook.go).\n-An `Authorization` header will also be sent with the `authToken` provided when setting up the watch. Clients should verify this token to ensure authenticated communicated.\n+An `Authorization` header will also be sent with the `authToken` provided when setting up the watch. Clients should verify this token to ensure authenticated communication.\n-Webhook notifications are ran after the OFAC data is successfully refreshed, which is determined by the `DATA_REFRESH_INTERVAL` environmental variable.\n+Webhook notifications are run after the OFAC data is successfully refreshed, which is determined by the `DATA_REFRESH_INTERVAL` environmental variable.\n##### Watching a specific customer or company by ID\n@@ -262,7 +262,7 @@ $ go doc github.com/moov-io/watchman/client Search\n### In-browser Watchman search\n-Using our [in-browser utility](https://oss.moov.io/watchman/), you can instantly perform advanced Watchman searches. Simply fill search fields and generate a detailed report that includes match percentage, alternative names, effective/expiration dates, IDs, addresses, and other useful information. This tool is particularly useful for completing quick searches with the aid of a intutive interface.\n+Using our [in-browser utility](https://oss.moov.io/watchman/), you can instantly perform advanced Watchman searches. Simply fill search fields and generate a detailed report that includes match percentage, alternative names, effective/expiration dates, IDs, addresses, and other useful information. This tool is particularly useful for completing quick searches with the aid of a intuitive interface.\n## Reporting blocks to OFAC\n" } ]
Go
Apache License 2.0
moov-io/watchman
Grammar and spelling updates 'pring' to 'print' communicated to communication ran to run intutive to intuitive
428,981
17.08.2022 13:23:47
21,600
2c7f2dd0e1c768d477d6c5c68d287f8aa5da0152
WIP: Adding UVL data into the mix.
[ { "change_type": "MODIFY", "old_path": "cmd/server/search.go", "new_path": "cmd/server/search.go", "diff": "@@ -46,6 +46,7 @@ type searcher struct {\nBISEntities []*Result[csl.EL]\nMilitaryEndUsers []*Result[csl.MEU]\nSSIs []*Result[csl.SSI]\n+ UVLs []*Result[csl.UVL]\n// metadata\nlastRefreshedAt time.Time\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader.go", "new_path": "pkg/csl/reader.go", "diff": "@@ -56,7 +56,7 @@ func Parse(r io.Reader) (*CSL, error) {\nreport.SSIs = append(report.SSIs, unmarshalSSI(record, i))\ncase \"Unverified List (UVL) - Bureau of Industry and Security\":\n- // TODO(adam): https://github.com/moov-io/watchman/issues/403\n+ report.UVLs = append(report.UVLs, unmarshalUVL(record, i))\ncase \"Nonproliferation Sanctions (ISN) - State Department\":\n// TODO(adam): https://github.com/moov-io/watchman/issues/413\n@@ -137,6 +137,16 @@ func unmarshalSSI(record []string, offset int) *SSI {\n}\n}\n+func unmarshalUVL(record []string, offset int) *UVL {\n+ return &UVL{\n+ EntityID: record[EntityNumberIdx+offset],\n+ Name: record[NameIdx+offset],\n+ Addresses: expandField(record[AddressesIdx+offset]),\n+ SourceListURL: record[SourceListURLIdx+offset],\n+ SourceInfoURL: record[SourceInformationURLIdx+offset],\n+ }\n+}\n+\n// Some columns in a CSL row are actually lists delimited by ';'.\n// These helper methods split these fields out and clean up the results.\n" } ]
Go
Apache License 2.0
moov-io/watchman
WIP: Adding UVL data into the mix.
428,981
17.08.2022 13:33:55
21,600
345a0826cba6f1dea6ab328d23376e2a986ded59
Added TopUVLs function to search.
[ { "change_type": "MODIFY", "old_path": "cmd/server/search_us_csl.go", "new_path": "cmd/server/search_us_csl.go", "diff": "@@ -82,3 +82,14 @@ func (s *searcher) TopSSIs(limit int, minMatch float64, name string) []*Result[c\nreturn topResults[csl.SSI](limit, minMatch, name, s.SSIs)\n}\n+\n+// TopUVLs search Unverified Lists records by Name and Alias\n+func (s *searcher) TopUVLs(limit int, minMatch float64, name string) []*Result[csl.UVL] {\n+ s.RLock()\n+ defer s.RUnlock()\n+\n+ s.Gate.Start()\n+ defer s.Gate.Done()\n+\n+ return topResults[csl.UVL](limit, minMatch, name, s.UVLs)\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
Added TopUVLs function to search.
428,981
17.08.2022 14:16:00
21,600
f8ef2a3cfd68c86f915ee090ccc1c5a32f1d0cd4
Added handler for UVL data
[ { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -158,6 +158,7 @@ type searchResponse struct {\nBISEntities []*Result[csl.EL] `json:\"bisEntities\"`\nMilitaryEndUsers []*Result[csl.MEU] `json:\"militaryEndUsers\"`\nSectoralSanctions []*Result[csl.SSI] `json:\"sectoralSanctions\"`\n+ Unverified []*Result[csl.UVL] `json:\"unverified\"`\n// Metadata\nRefreshedAt time.Time `json:\"refreshedAt\"`\n@@ -285,6 +286,9 @@ var (\nfunc(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\nresp.SectoralSanctions = s.TopSSIs(limit, minMatch, name)\n},\n+ func(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n+ resp.Unverified = s.TopUVLs(limit, minMatch, name)\n+ },\n}\n)\n" } ]
Go
Apache License 2.0
moov-io/watchman
Added handler for UVL data
428,981
22.08.2022 11:16:11
21,600
baa2d242347064bcd96c9fa2a3921205ebbebdc2
Adding unit test and correcting bug.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/reader.go", "new_path": "pkg/csl/reader.go", "diff": "@@ -139,7 +139,7 @@ func unmarshalSSI(record []string, offset int) *SSI {\nfunc unmarshalUVL(record []string, offset int) *UVL {\nreturn &UVL{\n- EntityID: record[EntityNumberIdx+offset],\n+ EntityID: record[0],\nName: record[NameIdx+offset],\nAddresses: expandField(record[AddressesIdx+offset]),\nSourceListURL: record[SourceListURLIdx+offset],\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader_test.go", "new_path": "pkg/csl/reader_test.go", "diff": "@@ -157,6 +157,27 @@ func Test_unmarshalSSI(t *testing.T) {\n}\n}\n+func Test_unmarshalUVL(t *testing.T) {\n+ // Record from official CSV\n+ record := []string{\"f15fa805ff4ac5e09026f5e78011a1bb6b26dec2\", \"Unverified List (UVL) - Bureau of Industry and Security\", \"\", \"\", \"\",\n+ \"Atlas Sanatgaran\", \"\", \"Komitas 26/114, Yerevan, Armenia, AM\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"http://bit.ly/1iwwTSJ\", \"\", \"\", \"\", \"\", \"\",\n+ \"http://bit.ly/1Qi4R7Z\", \"\",\n+ }\n+ expectedUVL := &UVL{\n+ EntityID: \"f15fa805ff4ac5e09026f5e78011a1bb6b26dec2\",\n+ Name: \"Atlas Sanatgaran\",\n+ Addresses: []string{\"Komitas 26/114, Yerevan, Armenia, AM\"},\n+ SourceListURL: \"http://bit.ly/1iwwTSJ\",\n+ SourceInfoURL: \"http://bit.ly/1Qi4R7Z\",\n+ }\n+\n+ actualUVL := unmarshalUVL(record, 1)\n+\n+ if !reflect.DeepEqual(expectedUVL, actualUVL) {\n+ t.Errorf(\"Expected: %#v\\nFound: %#v\\n\", expectedUVL, actualUVL)\n+ }\n+}\n+\nfunc Test__Issue326EL(t *testing.T) {\nfd, err := ioutil.TempFile(\"\", \"csl*.csv\")\nif err != nil {\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding unit test and correcting bug.
428,981
23.08.2022 10:57:55
21,600
784b7cee506ef49b4e480446ea51cc6ec9edb15d
Updating JSON names for Unverified data.
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -62,7 +62,7 @@ type DownloadStats struct {\nBISEntities int `json:\"bisEntities\"`\nMilitaryEndUsers int `json:\"militaryEndUsers\"`\nSectoralSanctions int `json:\"sectoralSanctions\"`\n- Unverified int `json:\"Unverified\"`\n+ Unverified int `json:\"unverifiedCSL\"`\nErrors []error `json:\"-\"`\nRefreshedAt time.Time `json:\"timestamp\"`\n@@ -121,6 +121,7 @@ func (s *searcher) periodicDataRefresh(interval time.Duration, downloadRepo down\n\"BISEntities\": log.Int(stats.BISEntities),\n\"MilitaryEndUsers\": log.Int(stats.MilitaryEndUsers),\n\"SSI\": log.Int(stats.SectoralSanctions),\n+ \"UVL\": log.Int(stats.Unverified),\n}).Logf(\"data refreshed %v ago\", time.Since(stats.RefreshedAt))\n}\nupdates <- stats // send stats for re-search and watch notifications\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -158,7 +158,7 @@ type searchResponse struct {\nBISEntities []*Result[csl.EL] `json:\"bisEntities\"`\nMilitaryEndUsers []*Result[csl.MEU] `json:\"militaryEndUsers\"`\nSectoralSanctions []*Result[csl.SSI] `json:\"sectoralSanctions\"`\n- Unverified []*Result[csl.UVL] `json:\"unverified\"`\n+ Unverified []*Result[csl.UVL] `json:\"unverifiedCSL\"`\n// Metadata\nRefreshedAt time.Time `json:\"refreshedAt\"`\n" } ]
Go
Apache License 2.0
moov-io/watchman
Updating JSON names for Unverified data.
428,981
23.08.2022 11:42:06
21,600
f8390bddae4975d82172ff1f3d6136c61bffbd71
Adding model for ISN CSL records.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/reader.go", "new_path": "pkg/csl/reader.go", "diff": "@@ -137,6 +137,20 @@ func unmarshalSSI(record []string, offset int) *SSI {\n}\n}\n+func unmarshalISN(record []string, offset int) *ISN {\n+ return &ISN{\n+ EntityID: record[0],\n+ Programs: expandProgramsList(record[ProgramsIdx+offset]),\n+ Name: record[NameIdx+offset],\n+ FederalRegisterNotice: record[FRNoticeIdx+offset],\n+ StartDate: record[StartDateIdx+offset],\n+ Remarks: expandField(record[RemarksIdx+offset]),\n+ SourceListURL: record[SourceListURLIdx+offset],\n+ AlternateNames: expandField(record[AltNamesIdx+offset]),\n+ SourceInfoURL: record[SourceInformationURLIdx+offset],\n+ }\n+}\n+\n// Some columns in a CSL row are actually lists delimited by ';'.\n// These helper methods split these fields out and clean up the results.\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding model for ISN CSL records.
428,981
26.08.2022 13:56:28
21,600
4265eaeedbb02716af9000ecebd8434c918dd5bb
Adding model and implementation for ISN data.
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -63,6 +63,7 @@ type DownloadStats struct {\nMilitaryEndUsers int `json:\"militaryEndUsers\"`\nSectoralSanctions int `json:\"sectoralSanctions\"`\nUnverified int `json:\"unverifiedCSL\"`\n+ NonproliferationSanctions int `json:\"nonproliferationSanctions\"`\nErrors []error `json:\"-\"`\nRefreshedAt time.Time `json:\"timestamp\"`\n@@ -229,6 +230,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nmeus := precomputeCSLEntities[csl.MEU](consolidatedLists.MEUs, s.pipe)\nssis := precomputeCSLEntities[csl.SSI](consolidatedLists.SSIs, s.pipe)\nuvls := precomputeCSLEntities[csl.UVL](consolidatedLists.UVLs, s.pipe)\n+ isns := precomputeCSLEntities[csl.ISN](consolidatedLists.ISNs, s.pipe)\n// OFAC\nstats.SDNs = len(sdns)\n@@ -241,6 +243,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nstats.MilitaryEndUsers = len(meus)\nstats.SectoralSanctions = len(ssis)\nstats.Unverified = len(uvls)\n+ stats.NonproliferationSanctions = len(isns)\n// record prometheus metrics\nlastDataRefreshCount.WithLabelValues(\"SDNs\").Set(float64(len(sdns)))\n@@ -249,6 +252,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nlastDataRefreshCount.WithLabelValues(\"MilitaryEndUsers\").Set(float64(len(meus)))\nlastDataRefreshCount.WithLabelValues(\"DPs\").Set(float64(len(dps)))\nlastDataRefreshCount.WithLabelValues(\"UVLs\").Set(float64(len(uvls)))\n+ lastDataRefreshCount.WithLabelValues(\"ISNs\").Set(float64(len(isns)))\nif len(stats.Errors) > 0 {\nreturn stats, stats\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/pipeline.go", "new_path": "cmd/server/pipeline.go", "diff": "@@ -28,6 +28,7 @@ type Name struct {\nsdn *ofac.SDN\nssi *csl.SSI\nuvl *csl.UVL\n+ isn *csl.ISN\ndp *dpl.DPL\nel *csl.EL\naddrs []*ofac.Address\n@@ -86,6 +87,13 @@ func cslName(item interface{}) *Name {\nProcessed: v.Name,\nuvl: v,\n}\n+ case *csl.ISN:\n+ return &Name{\n+ Original: v.Name,\n+ Processed: v.Name,\n+ isn: v,\n+ altNames: v.AlternateNames,\n+ }\n}\nreturn &Name{}\n}\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search.go", "new_path": "cmd/server/search.go", "diff": "@@ -47,6 +47,7 @@ type searcher struct {\nMilitaryEndUsers []*Result[csl.MEU]\nSSIs []*Result[csl.SSI]\nUVLs []*Result[csl.UVL]\n+ ISNs []*Result[csl.ISN]\n// metadata\nlastRefreshedAt time.Time\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -159,6 +159,7 @@ type searchResponse struct {\nMilitaryEndUsers []*Result[csl.MEU] `json:\"militaryEndUsers\"`\nSectoralSanctions []*Result[csl.SSI] `json:\"sectoralSanctions\"`\nUnverified []*Result[csl.UVL] `json:\"unverifiedCSL\"`\n+ NonproliferationSanctions []*Result[csl.ISN] `json:\"nonproliferationSanctions\"`\n// Metadata\nRefreshedAt time.Time `json:\"refreshedAt\"`\n@@ -289,6 +290,9 @@ var (\nfunc(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\nresp.Unverified = s.TopUVLs(limit, minMatch, name)\n},\n+ func(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n+ resp.NonproliferationSanctions = s.TopISNs(limit, minMatch, name)\n+ },\n}\n)\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_us_csl.go", "new_path": "cmd/server/search_us_csl.go", "diff": "@@ -93,3 +93,14 @@ func (s *searcher) TopUVLs(limit int, minMatch float64, name string) []*Result[c\nreturn topResults[csl.UVL](limit, minMatch, name, s.UVLs)\n}\n+\n+// TopISNs searches Nonproliferation Sanctions records by Name and Alias\n+func (s *searcher) TopISNs(limit int, minMatch float64, name string) []*Result[csl.ISN] {\n+ s.RLock()\n+ defer s.RUnlock()\n+\n+ s.Gate.Start()\n+ defer s.Gate.Done()\n+\n+ return topResults[csl.ISN](limit, minMatch, name, s.ISNs)\n+}\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/csl.go", "new_path": "pkg/csl/csl.go", "diff": "@@ -114,6 +114,7 @@ type UVL struct {\nSourceListURL string `json:\"sourceListURL\"`\nSourceInfoURL string `json:\"sourceInfoURL\"`\n}\n+\ntype ISN struct {\nEntityID string `json:\"entityID\"`\nPrograms []string `json:\"programs\"`\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader.go", "new_path": "pkg/csl/reader.go", "diff": "@@ -59,7 +59,7 @@ func Parse(r io.Reader) (*CSL, error) {\nreport.UVLs = append(report.UVLs, unmarshalUVL(record, i))\ncase \"Nonproliferation Sanctions (ISN) - State Department\":\n- // TODO(adam): https://github.com/moov-io/watchman/issues/413\n+ report.ISNs = append(report.ISNs, unmarshalISN(record, i))\ncase \"AECA Debarred List\": // TODO: Not found\n// TODO(adam): https://github.com/moov-io/watchman/issues/414\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader_test.go", "new_path": "pkg/csl/reader_test.go", "diff": "@@ -177,6 +177,31 @@ func Test_unmarshalUVL(t *testing.T) {\n}\n}\n+func Test_unmarshalISN(t *testing.T) {\n+ // Record from official CSV\n+ record := []string{\"2d2db09c686e4829d0ef1b0b04145eec3d42cd88\", \"Nonproliferation Sanctions (ISN) - State Department\", \"\", \"\",\n+ \"E.O. 13382; Export-Import Bank Act; Nuclear Proliferation Prevention Act\", \"Abdul Qadeer Khan\", \"\", \"\", \"Vol. 74, No. 11, 01/16/09\", \"2009-01-09\",\n+ \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"Associated with the A.Q. Khan Network\", \"http://bit.ly/1NuVFxV\", \"ZAMAN; Haydar\", \"\", \"\", \"\", \"\", \"http://bit.ly/1NuVFxV\", \"\",\n+ }\n+ expectedISN := &ISN{\n+ EntityID: \"2d2db09c686e4829d0ef1b0b04145eec3d42cd88\",\n+ Programs: []string{\"E.O. 13382\", \"Export-Import Bank Act\", \"Nuclear Proliferation Prevention Act\"},\n+ Name: \"Abdul Qadeer Khan\",\n+ FederalRegisterNotice: \"Vol. 74, No. 11, 01/16/09\",\n+ StartDate: \"2009-01-09\",\n+ Remarks: []string{\"Associated with the A.Q. Khan Network\"},\n+ SourceListURL: \"http://bit.ly/1NuVFxV\",\n+ AlternateNames: []string{\"ZAMAN\", \"Haydar\"},\n+ SourceInfoURL: \"http://bit.ly/1NuVFxV\",\n+ }\n+\n+ actualISN := unmarshalISN(record, 1)\n+\n+ if !reflect.DeepEqual(expectedISN, actualISN) {\n+ t.Errorf(\"Expected: %#v\\nFound: %#v\\n\", expectedISN, actualISN)\n+ }\n+}\n+\nfunc Test__Issue326EL(t *testing.T) {\nfd, err := os.CreateTemp(\"\", \"csl*.csv\")\nif err != nil {\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding model and implementation for ISN data.
428,981
26.08.2022 15:42:59
21,600
d9da1bddb408148cec1a545c83f272b0f12e082d
Adding ISN data to searcher object as well as stats.
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -123,6 +123,7 @@ func (s *searcher) periodicDataRefresh(interval time.Duration, downloadRepo down\n\"MilitaryEndUsers\": log.Int(stats.MilitaryEndUsers),\n\"SSI\": log.Int(stats.SectoralSanctions),\n\"UVL\": log.Int(stats.Unverified),\n+ \"ISN\": log.Int(stats.NonproliferationSanctions),\n}).Logf(\"data refreshed %v ago\", time.Since(stats.RefreshedAt))\n}\nupdates <- stats // send stats for re-search and watch notifications\n@@ -271,6 +272,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\ns.MilitaryEndUsers = meus\ns.SSIs = ssis\ns.UVLs = uvls\n+ s.ISNs = isns\n// metadata\ns.lastRefreshedAt = stats.RefreshedAt\ns.Unlock()\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/main.go", "new_path": "cmd/server/main.go", "diff": "@@ -165,6 +165,8 @@ func main() {\n\"SSI\": log.Int(stats.SectoralSanctions),\n\"DPL\": log.Int(stats.DeniedPersons),\n\"BISEntities\": log.Int(stats.BISEntities),\n+ \"UVL\": log.Int(stats.Unverified),\n+ \"ISN\": log.Int(stats.NonproliferationSanctions),\n}).Logf(\"data refreshed %v ago\", time.Since(stats.RefreshedAt))\n}\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/csl.go", "new_path": "pkg/csl/csl.go", "diff": "@@ -121,8 +121,8 @@ type ISN struct {\nName string `json:\"name\"`\nFederalRegisterNotice string `json:\"federalRegisterNotice\"`\nStartDate string `json:\"startDate\"`\n- Remarks []string `json:\"remarks\"`\n+ Remarks []string `json:\"remarks,omitempty\"`\nSourceListURL string `json:\"sourceListURL\"`\n- AlternateNames []string `json:\"alternateNames\"`\n+ AlternateNames []string `json:\"alternateNames,omitempty\"`\nSourceInfoURL string `json:\"sourceInfoURL\"`\n}\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding ISN data to searcher object as well as stats.
428,981
29.08.2022 12:14:09
21,600
5a9ea8a767d2642f898baef948b0023c037ae5ae
Update cmd/server/download.go
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -63,7 +63,7 @@ type DownloadStats struct {\nMilitaryEndUsers int `json:\"militaryEndUsers\"`\nSectoralSanctions int `json:\"sectoralSanctions\"`\nUnverified int `json:\"unverifiedCSL\"`\n- NonproliferationSanctions int `json:\"nonproliferationSanctions\"`\n+ NonProliferationSanctions int `json:\"nonProliferationSanctions\"`\nErrors []error `json:\"-\"`\nRefreshedAt time.Time `json:\"timestamp\"`\n" } ]
Go
Apache License 2.0
moov-io/watchman
Update cmd/server/download.go Co-authored-by: Adam Shannon <adamkshannon@gmail.com>
428,981
29.08.2022 12:17:24
21,600
6407784e09517eb10e7d5c6a8d234e85ebde42ae
Updating field names.
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -123,7 +123,7 @@ func (s *searcher) periodicDataRefresh(interval time.Duration, downloadRepo down\n\"MilitaryEndUsers\": log.Int(stats.MilitaryEndUsers),\n\"SSI\": log.Int(stats.SectoralSanctions),\n\"UVL\": log.Int(stats.Unverified),\n- \"ISN\": log.Int(stats.NonproliferationSanctions),\n+ \"ISN\": log.Int(stats.NonProliferationSanctions),\n}).Logf(\"data refreshed %v ago\", time.Since(stats.RefreshedAt))\n}\nupdates <- stats // send stats for re-search and watch notifications\n@@ -244,7 +244,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nstats.MilitaryEndUsers = len(meus)\nstats.SectoralSanctions = len(ssis)\nstats.Unverified = len(uvls)\n- stats.NonproliferationSanctions = len(isns)\n+ stats.NonProliferationSanctions = len(isns)\n// record prometheus metrics\nlastDataRefreshCount.WithLabelValues(\"SDNs\").Set(float64(len(sdns)))\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/main.go", "new_path": "cmd/server/main.go", "diff": "@@ -166,7 +166,7 @@ func main() {\n\"DPL\": log.Int(stats.DeniedPersons),\n\"BISEntities\": log.Int(stats.BISEntities),\n\"UVL\": log.Int(stats.Unverified),\n- \"ISN\": log.Int(stats.NonproliferationSanctions),\n+ \"ISN\": log.Int(stats.NonProliferationSanctions),\n}).Logf(\"data refreshed %v ago\", time.Since(stats.RefreshedAt))\n}\n" } ]
Go
Apache License 2.0
moov-io/watchman
Updating field names.
428,981
30.08.2022 14:08:45
21,600
05a79d8a2074ef0f5df534b174a6ad4f4df30fd8
Adding CAP struct for US CSL data.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/csl.go", "new_path": "pkg/csl/csl.go", "diff": "@@ -13,7 +13,7 @@ type CSL struct {\nFSEs []*FSE // Foreign Sanctions Evaders (FSE) - Treasury Department\nISNs []*ISN // Nonproliferation Sanctions (ISN) - State Department\nPLCs []*PLC // Palestinian Legislative Council List (PLC) - Treasury Department\n- // []*CAPTA (CAPTA (formerly Foreign Financial Institutions Subject to Part 561 - Treasury Department))\n+ CAPs []*CAP // CAPTA (formerly Foreign Financial Institutions Subject to Part 561 - Treasury Department)\n// []*ADL (AECA Debarred List - State Department)\n}\n@@ -155,3 +155,17 @@ type PLC struct {\nPlacesOfBirth string `json:\"placesOfBirth,omitempty\"`\nSourceInfoURL string `json:\"sourceInfoURL\"`\n}\n+\n+type CAP struct {\n+ EntityID string `json:\"entityID\"`\n+ EntityNumber string `json:\"entityNumber\"`\n+ Type string `json:\"type\"`\n+ Programs []string `json:\"programs\"`\n+ Name string `json:\"name\"`\n+ Addresses []string `json:\"addresses\"`\n+ Remarks []string `json:\"remarks\"`\n+ SourceListURL string `json:\"sourceListURL,omitempty\"`\n+ AlternateNames []string `json:\"alternamteNames,omitempty\"`\n+ SourceInfoURL string `json:\"sourceInfoURL\"`\n+ IDs []string `json:\"IDs\"`\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding CAP struct for US CSL data.
428,981
01.09.2022 10:15:41
21,600
e8bbe0027681a421d8faa40f46c885ad973861af
Adding DPL struct to model data.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/csl.go", "new_path": "pkg/csl/csl.go", "diff": "@@ -14,6 +14,7 @@ type CSL struct {\nISNs []*ISN // Nonproliferation Sanctions (ISN) - State Department\nPLCs []*PLC // Palestinian Legislative Council List (PLC) - Treasury Department\nCAPs []*CAP // CAPTA (formerly Foreign Financial Institutions Subject to Part 561 - Treasury Department)\n+ DPLs []*DPL // Denied Persons List (DPL) - Bureau of Industry and Security\n// []*ADL (AECA Debarred List - State Department)\n}\n@@ -169,3 +170,16 @@ type CAP struct {\nSourceInfoURL string `json:\"sourceInfoURL\"`\nIDs []string `json:\"IDs\"`\n}\n+\n+type DPL struct {\n+ EntityID string `json:\"entityID\"`\n+ Name string `json:\"name\"`\n+ Addresses []string `json:\"addresses\"`\n+ FederalRegisterNotice string `json:\"federalRegisterNotice,omitempty\"`\n+ StartDate string `json:\"startDate\"`\n+ EndDate string `json:\"endDate,omitempty\"`\n+ StandardOrder string `json:\"standardOrder\"`\n+ Remarks []string `json:\"remarks,omitempty\"`\n+ SourceListURL string `json:\"sourceListURL\"`\n+ SourceInfoURL string `json:\"sourceInfoURL\"`\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding DPL struct to model data.
428,981
01.09.2022 10:28:32
21,600
e1d4cd2b3c59ef0fc7765357e8d10617070200f0
Adding DTC struct to data model.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/csl.go", "new_path": "pkg/csl/csl.go", "diff": "@@ -15,7 +15,7 @@ type CSL struct {\nPLCs []*PLC // Palestinian Legislative Council List (PLC) - Treasury Department\nCAPs []*CAP // CAPTA (formerly Foreign Financial Institutions Subject to Part 561 - Treasury Department)\nDPLs []*DPL // Denied Persons List (DPL) - Bureau of Industry and Security\n- // []*ADL (AECA Debarred List - State Department)\n+ DTCs []*DTC // ITAR Debarred (DTC) - State Department\n}\n// This is the order of the columns in the CSL\n@@ -183,3 +183,12 @@ type DPL struct {\nSourceListURL string `json:\"sourceListURL\"`\nSourceInfoURL string `json:\"sourceInfoURL\"`\n}\n+\n+type DTC struct {\n+ EntityID string `json:\"entityID\"`\n+ Name string `json:\"name\"`\n+ FederalRegisterNotice string `json:\"federalRegisterNotice\"`\n+ SourceListURL string `json:\"sourceListURL\"`\n+ AlternateNames []string `json:\"alternateNames,omitempty\"`\n+ SourceInfoURL string `json:\"sourceInfoURL\"`\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding DTC struct to data model.
428,981
01.09.2022 10:35:07
21,600
9fd3ff360d363ccc568e47a02e1756ecb4840e85
Adding CMIC struct to data model.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/csl.go", "new_path": "pkg/csl/csl.go", "diff": "@@ -16,6 +16,7 @@ type CSL struct {\nCAPs []*CAP // CAPTA (formerly Foreign Financial Institutions Subject to Part 561 - Treasury Department)\nDPLs []*DPL // Denied Persons List (DPL) - Bureau of Industry and Security\nDTCs []*DTC // ITAR Debarred (DTC) - State Department\n+ CMICs []*CMIC // Non-SDN Chinese Military-Industrial Complex Companies List (CMIC) - Treasury Department\n}\n// This is the order of the columns in the CSL\n@@ -192,3 +193,17 @@ type DTC struct {\nAlternateNames []string `json:\"alternateNames,omitempty\"`\nSourceInfoURL string `json:\"sourceInfoURL\"`\n}\n+\n+type CMIC struct {\n+ EntityID string `json:\"entityID\"`\n+ EntityNumber string `json:\"entityNumber\"`\n+ Type string `json:\"type\"`\n+ Programs []string `json:\"programs\"`\n+ Name string `json:\"name\"`\n+ Addresses []string `json:\"addresses\"`\n+ Remarks []string `json:\"remarks,omitempty\"`\n+ SourceListURL string `json:\"sourceListURL\"`\n+ AlternateNames []string `json:\"alternateNames\"`\n+ SourceInfoURL string `json:\"sourceInfoURL\"`\n+ IDs []string `json:\"IDs\"`\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding CMIC struct to data model.
428,981
01.09.2022 11:05:17
21,600
5ae4ee5155be68badc2506cd7498ef963ba33692
Removing DPL struct as we're tracking DPL elsewhere.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/csl.go", "new_path": "pkg/csl/csl.go", "diff": "@@ -14,9 +14,9 @@ type CSL struct {\nISNs []*ISN // Nonproliferation Sanctions (ISN) - State Department\nPLCs []*PLC // Palestinian Legislative Council List (PLC) - Treasury Department\nCAPs []*CAP // CAPTA (formerly Foreign Financial Institutions Subject to Part 561 - Treasury Department)\n- DPLs []*DPL // Denied Persons List (DPL) - Bureau of Industry and Security\nDTCs []*DTC // ITAR Debarred (DTC) - State Department\nCMICs []*CMIC // Non-SDN Chinese Military-Industrial Complex Companies List (CMIC) - Treasury Department\n+ NS_MBSs []*NS_MBS // Non-SDN Menu-Based Sanctions List (NS-MBS List) - Treasury Department\n}\n// This is the order of the columns in the CSL\n@@ -172,19 +172,6 @@ type CAP struct {\nIDs []string `json:\"IDs\"`\n}\n-type DPL struct {\n- EntityID string `json:\"entityID\"`\n- Name string `json:\"name\"`\n- Addresses []string `json:\"addresses\"`\n- FederalRegisterNotice string `json:\"federalRegisterNotice,omitempty\"`\n- StartDate string `json:\"startDate\"`\n- EndDate string `json:\"endDate,omitempty\"`\n- StandardOrder string `json:\"standardOrder\"`\n- Remarks []string `json:\"remarks,omitempty\"`\n- SourceListURL string `json:\"sourceListURL\"`\n- SourceInfoURL string `json:\"sourceInfoURL\"`\n-}\n-\ntype DTC struct {\nEntityID string `json:\"entityID\"`\nName string `json:\"name\"`\n@@ -207,3 +194,16 @@ type CMIC struct {\nSourceInfoURL string `json:\"sourceInfoURL\"`\nIDs []string `json:\"IDs\"`\n}\n+\n+type NS_MBS struct {\n+ EntityID string `json:\"entityID\"`\n+ EntityNumber string `json:\"entityNumber\"`\n+ Type string `json:\"type\"`\n+ Programs []string `json:\"programs\"`\n+ Name string `json:\"name\"`\n+ Addresses []string `json:\"addresses\"`\n+ Remarks []string `json:\"remarks,omitempty\"`\n+ AlternateNames []string `json:\"alternateNames,omitempty\"`\n+ SourceInfoURL string `json:\"sourceInfoURL\"`\n+ IDs []string `json:\"IDs\"`\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
Removing DPL struct as we're tracking DPL elsewhere.
428,981
01.09.2022 12:04:52
21,600
c6b40fe93fef03700af15086b719e45f9e73c8e1
WIP: Adding in unmarshal funcs for new CSL data.
[ { "change_type": "MODIFY", "old_path": "cmd/server/main.go", "new_path": "cmd/server/main.go", "diff": "@@ -167,6 +167,12 @@ func main() {\n\"BISEntities\": log.Int(stats.BISEntities),\n\"UVL\": log.Int(stats.Unverified),\n\"ISN\": log.Int(stats.NonProliferationSanctions),\n+ \"FSE\": log.Int(stats.ForeignSanctionsEvaders),\n+ \"PLC\": log.Int(stats.PalestinianLegislativeCouncil),\n+ \"CAP\": log.Int(stats.CAPTA),\n+ \"DTC\": log.Int(stats.ITARDebarred),\n+ \"CMIC\": log.Int(stats.ChineseMilitaryIndustrialComplex),\n+ \"NS_MBS\": log.Int(stats.NonSDNMenuBasedSanctions),\n}).Logf(\"data refreshed %v ago\", time.Since(stats.RefreshedAt))\n}\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader.go", "new_path": "pkg/csl/reader.go", "diff": "@@ -66,21 +66,27 @@ func Parse(r io.Reader) (*CSL, error) {\ncase \"Foreign Sanctions Evaders (FSE) - Treasury Department\":\n// TODO(adam): https://github.com/moov-io/watchman/issues/415\n+ report.FSEs = append(report.FSEs, unmarshalFSE(record, i))\ncase \"Palestinian Legislative Council List (PLC) - Treasury Department\":\n// TODO(adam): https://github.com/moov-io/watchman/issues/416\n+ report.PLCs = append(report.PLCs, unmarshalPLC(record, i))\ncase \"Capta List (CAP) - Treasury Department\":\n// TODO(adam): https://github.com/moov-io/watchman/issues/417\n+ report.CAPs = append(report.CAPs, unmarshalCAP(record, i))\ncase \"Non-SDN Menu-Based Sanctions List (NS-MBS List) - Treasury Department\":\n// TODO(adam): https://github.com/moov-io/watchman/issues/418\n+ report.NS_MBSs = append(report.NS_MBSs, unmarshalNS_MBS(record, i))\ncase \"Non-SDN Chinese Military-Industrial Complex Companies List (CMIC) - Treasury Department\":\n// TODO(adam): https://github.com/moov-io/watchman/issues/419\n+ report.CMICs = append(report.CMICs, unmarshalCMIC(record, i))\ncase \"ITAR Debarred (DTC) - State Department\":\n// TODO(adam): https://github.com/moov-io/watchman/issues/422\n+ report.DTCs = append(report.DTCs, unmarshalDTC(record, i))\ndefault:\n// Other lists are:\n@@ -161,6 +167,97 @@ func unmarshalISN(record []string, offset int) *ISN {\n}\n}\n+func unmarshalFSE(record []string, offset int) *FSE {\n+ return &FSE{\n+ EntityID: record[0],\n+ EntityNumber: record[EntityNumberIdx+offset],\n+ Type: record[TypeIdx+offset],\n+ Programs: expandProgramsList(record[ProgramsIdx+offset]),\n+ Name: record[NameIdx+offset],\n+ Addresses: expandField(record[AddressesIdx+offset]),\n+ SourceListURL: record[SourceListURLIdx+offset],\n+ Citizenships: record[CitizenshipsIdx+offset],\n+ DatesOfBirth: record[DatesOfBirthIdx+offset],\n+ SourceInfoURL: record[SourceInformationURLIdx+offset],\n+ IDs: expandField(record[IDsIdx+offset]),\n+ }\n+}\n+\n+func unmarshalPLC(record []string, offset int) *PLC {\n+ return &PLC{\n+ EntityID: record[0],\n+ EntityNumber: record[EntityNumberIdx+offset],\n+ Type: record[TypeIdx+offset],\n+ Programs: expandProgramsList(record[ProgramsIdx+offset]),\n+ Name: record[NameIdx+offset],\n+ Addresses: expandField(record[AddressesIdx+offset]),\n+ Remarks: record[RemarksIdx+offset],\n+ SourceListURL: record[SourceListURLIdx+offset],\n+ AlternateNames: expandField(record[AltNamesIdx+offset]),\n+ DatesOfBirth: record[DatesOfBirthIdx+offset],\n+ PlacesOfBirth: record[PlacesOfBirthIdx+offset],\n+ SourceInfoURL: record[SourceInformationURLIdx+offset],\n+ }\n+}\n+\n+func unmarshalCAP(record []string, offset int) *CAP {\n+ return &CAP{\n+ EntityID: record[0],\n+ EntityNumber: record[EntityNumberIdx+offset],\n+ Type: record[TypeIdx+offset],\n+ Programs: expandProgramsList(record[ProgramsIdx+offset]),\n+ Name: record[NameIdx+offset],\n+ Addresses: expandField(record[AddressesIdx+offset]),\n+ Remarks: expandField(record[RemarksIdx+offset]),\n+ SourceListURL: record[SourceListURLIdx+offset],\n+ AlternateNames: expandField(record[AltNamesIdx+offset]),\n+ SourceInfoURL: record[SourceInformationURLIdx+offset],\n+ IDs: expandField(record[IDsIdx+offset]),\n+ }\n+}\n+\n+func unmarshalNS_MBS(record []string, offset int) *NS_MBS {\n+ return &NS_MBS{\n+ EntityID: record[0],\n+ EntityNumber: record[EntityNumberIdx+offset],\n+ Type: record[TypeIdx+offset],\n+ Programs: expandProgramsList(record[ProgramsIdx+offset]),\n+ Name: record[NameIdx+offset],\n+ Addresses: expandField(record[AddressesIdx+offset]),\n+ Remarks: expandField(record[RemarksIdx+offset]),\n+ AlternateNames: expandField(record[AltNamesIdx+offset]),\n+ SourceInfoURL: record[SourceInformationURLIdx],\n+ IDs: expandField(record[IDsIdx+offset]),\n+ }\n+}\n+\n+func unmarshalCMIC(record []string, offset int) *CMIC {\n+ return &CMIC{\n+ EntityID: record[0],\n+ EntityNumber: record[EntityNumberIdx+offset],\n+ Type: record[TypeIdx+offset],\n+ Programs: expandProgramsList(record[ProgramsIdx+offset]),\n+ Name: record[NameIdx+offset],\n+ Addresses: expandField(record[AddressesIdx+offset]),\n+ Remarks: expandField(record[RemarksIdx+offset]),\n+ SourceListURL: record[SourceListURLIdx+offset],\n+ AlternateNames: expandField(record[AltNamesIdx+offset]),\n+ SourceInfoURL: record[SourceInformationURLIdx+offset],\n+ IDs: expandField(record[IDsIdx+offset]),\n+ }\n+}\n+\n+func unmarshalDTC(record []string, offset int) *DTC {\n+ return &DTC{\n+ EntityID: record[0],\n+ Name: record[NameIdx+offset],\n+ FederalRegisterNotice: record[FRNoticeIdx+offset],\n+ SourceListURL: record[SourceListURLIdx+offset],\n+ AlternateNames: expandField(record[AltNamesIdx+offset]),\n+ SourceInfoURL: record[SourceInformationURLIdx+offset],\n+ }\n+}\n+\n// Some columns in a CSL row are actually lists delimited by ';'.\n// These helper methods split these fields out and clean up the results.\n" } ]
Go
Apache License 2.0
moov-io/watchman
WIP: Adding in unmarshal funcs for new CSL data.
428,981
02.09.2022 09:34:55
21,600
bf19c1e2c92c37ed495af7aa5bb1fc9304ac8625
Adding unit test for unmarshaling FSE data
[ { "change_type": "MODIFY", "old_path": "pkg/csl/reader_test.go", "new_path": "pkg/csl/reader_test.go", "diff": "@@ -202,6 +202,33 @@ func Test_unmarshalISN(t *testing.T) {\n}\n}\n+func Test_unmarshalFSE(t *testing.T) {\n+ // Record from official CSV\n+ record := []string{\"17526\", \"Foreign Sanctions Evaders (FSE) - Treasury Department\", \"17526\", \"Individual\", \"SYRIA; FSE-SY\",\n+ \"BEKTAS, Halis\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"https://bit.ly/1QWTIfE\", \"\", \"CH\", \"1966-02-13\", \"\", \"\",\n+ \"http://bit.ly/1N1docf\", \"CH, X0906223, Passport\",\n+ }\n+ expectedFSE := &FSE{\n+ EntityID: \"17526\",\n+ EntityNumber: \"17526\",\n+ Type: \"Individual\",\n+ Programs: []string{\"SYRIA\", \"FSE-SY\"},\n+ Name: \"BEKTAS, Halis\",\n+ Addresses: nil,\n+ SourceListURL: \"https://bit.ly/1QWTIfE\",\n+ Citizenships: \"CH\",\n+ DatesOfBirth: \"1966-02-13\",\n+ SourceInfoURL: \"http://bit.ly/1N1docf\",\n+ IDs: []string{\"CH, X0906223, Passport\"},\n+ }\n+\n+ actualFSE := unmarshalFSE(record, 1)\n+\n+ if !reflect.DeepEqual(expectedFSE, actualFSE) {\n+ t.Errorf(\"Expected: %#v\\nFound: %#v\\n\", expectedFSE, actualFSE)\n+ }\n+}\n+\nfunc Test__Issue326EL(t *testing.T) {\nfd, err := os.CreateTemp(\"\", \"csl*.csv\")\nif err != nil {\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding unit test for unmarshaling FSE data
428,981
02.09.2022 12:43:49
21,600
291d7d2e79f5aeb9137e6421d4beebb559486481
Adding unit test for unmarshaling PLC data.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/reader_test.go", "new_path": "pkg/csl/reader_test.go", "diff": "@@ -229,6 +229,35 @@ func Test_unmarshalFSE(t *testing.T) {\n}\n}\n+func Test_unmarshalPLC(t *testing.T) {\n+ // Record derived from official CSV\n+ record := []string{\"9702\", \"Palestinian Legislative Council List (PLC) - Treasury Department\", \"9702\", \"Individual\", \"NS-PLC;Office of Misinformation\", \"SALAMEH, Salem\",\n+ \"\", \"123 Dunbar Street, Testerville, TX, Palestine\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"HAMAS - Der al-Balah\", \"https://bit.ly/1QWTIfE\", \"SALAMEH, Salem Ahmad Abdel Hadi\", \"\", \"1951\",\n+ \"\", \"\", \"http://bit.ly/2tjOLpx\", \"\",\n+ }\n+\n+ expectedPLC := &PLC{\n+ EntityID: \"9702\",\n+ EntityNumber: \"9702\",\n+ Type: \"Individual\",\n+ Programs: []string{\"NS-PLC\", \"Office of Misinformation\"},\n+ Name: \"SALAMEH, Salem\",\n+ Addresses: []string{\"123 Dunbar Street, Testerville, TX, Palestine\"},\n+ Remarks: \"HAMAS - Der al-Balah\",\n+ SourceListURL: \"https://bit.ly/1QWTIfE\",\n+ AlternateNames: []string{\"SALAMEH, Salem Ahmad Abdel Hadi\"},\n+ DatesOfBirth: \"1951\",\n+ PlacesOfBirth: \"\",\n+ SourceInfoURL: \"http://bit.ly/2tjOLpx\",\n+ }\n+\n+ actualPLC := unmarshalPLC(record, 1)\n+\n+ if !reflect.DeepEqual(expectedPLC, actualPLC) {\n+ t.Errorf(\"Expected: %#v\\nFound: %#v\\n\", expectedPLC, actualPLC)\n+ }\n+}\n+\nfunc Test__Issue326EL(t *testing.T) {\nfd, err := os.CreateTemp(\"\", \"csl*.csv\")\nif err != nil {\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding unit test for unmarshaling PLC data.
428,981
02.09.2022 13:44:32
21,600
079873b777870ab7b965ab1fa3abb278800757a1
Adding unit test for unmarshaling CAP data.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/reader_test.go", "new_path": "pkg/csl/reader_test.go", "diff": "@@ -258,6 +258,45 @@ func Test_unmarshalPLC(t *testing.T) {\n}\n}\n+func Test_unmarshalCAP(t *testing.T) {\n+ // Record derived from official CSV\n+ record := []string{\"20002\", \"Capta List (CAP) - Treasury Department\", \"20002\", \"Entity\", \"UKRAINE-EO13662; RUSSIA-EO14024\", \"BM BANK PUBLIC JOINT STOCK COMPANY\",\n+ \"\", \"Bld 3 8/15, Rozhdestvenka St., Moscow, 107996, RU\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\",\n+ \"All offices worldwide; for more information on directives, please visit the following link: https://www.treasury.gov/resource-center/sanctions/Programs/Pages/ukraine.aspx#directives; (Linked To: VTB BANK PUBLIC JOINT STOCK COMPANY)\",\n+ \"\", \"BM BANK JSC; BM BANK AO; AKTSIONERNOE OBSHCHESTVO BM BANK; PAO BM BANK; BANK MOSKVY PAO; BANK OF MOSCOW; AKTSIONERNY KOMMERCHESKI BANK BANK MOSKVY OTKRYTOE AKTSIONERNOE OBSCHCHESTVO; JOINT STOCK COMMERCIAL BANK - BANK OF MOSCOW OPEN JOINT STOCK COMPANY\",\n+ \"\", \"\", \"\", \"\", \"http://bit.ly/2PqohAD\", \"RU, 1027700159497, Registration Number; RU, 29292940, Government Gazette Number; MOSWRUMM, SWIFT/BIC; www.bm.ru, Website; Subject to Directive 1, Executive Order 13662 Directive Determination -; 044525219, BIK (RU); Financial Institution, Target Type\",\n+ }\n+\n+ expectedCAP := &CAP{\n+ EntityID: \"20002\",\n+ EntityNumber: \"20002\",\n+ Type: \"Entity\",\n+ Programs: []string{\"UKRAINE-EO13662\", \"RUSSIA-EO14024\"},\n+ Name: \"BM BANK PUBLIC JOINT STOCK COMPANY\",\n+ Addresses: []string{\"Bld 3 8/15, Rozhdestvenka St., Moscow, 107996, RU\"},\n+ Remarks: []string{\"All offices worldwide\", \"for more information on directives, please visit the following link: https://www.treasury.gov/resource-center/sanctions/Programs/Pages/ukraine.aspx#directives\", \"(Linked To: VTB BANK PUBLIC JOINT STOCK COMPANY)\"},\n+ SourceListURL: \"\",\n+ AlternateNames: []string{\"BM BANK JSC\", \"BM BANK AO\", \"AKTSIONERNOE OBSHCHESTVO BM BANK\",\n+ \"PAO BM BANK\", \"BANK MOSKVY PAO\", \"BANK OF MOSCOW\",\n+ \"AKTSIONERNY KOMMERCHESKI BANK BANK MOSKVY OTKRYTOE AKTSIONERNOE OBSCHCHESTVO\",\n+ \"JOINT STOCK COMMERCIAL BANK - BANK OF MOSCOW OPEN JOINT STOCK COMPANY\"},\n+ SourceInfoURL: \"http://bit.ly/2PqohAD\",\n+ IDs: []string{\"RU, 1027700159497, Registration Number\",\n+ \"RU, 29292940, Government Gazette Number\",\n+ \"MOSWRUMM, SWIFT/BIC\",\n+ \"www.bm.ru, Website\",\n+ \"Subject to Directive 1, Executive Order 13662 Directive Determination -\",\n+ \"044525219, BIK (RU)\",\n+ \"Financial Institution, Target Type\"},\n+ }\n+\n+ actualCAP := unmarshalCAP(record, 1)\n+\n+ if !reflect.DeepEqual(expectedCAP, actualCAP) {\n+ t.Errorf(\"Expected: %#v\\nFound: %#v\\n\", expectedCAP, actualCAP)\n+ }\n+}\n+\nfunc Test__Issue326EL(t *testing.T) {\nfd, err := os.CreateTemp(\"\", \"csl*.csv\")\nif err != nil {\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding unit test for unmarshaling CAP data.
428,981
02.09.2022 14:42:20
21,600
a0ce574a03ccad8ae6f5b987f728a1dda7df080e
Adding unit test for unmarshaling DTC data.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/reader_test.go", "new_path": "pkg/csl/reader_test.go", "diff": "@@ -297,6 +297,29 @@ func Test_unmarshalCAP(t *testing.T) {\n}\n}\n+func Test_unmarshalDTC(t *testing.T) {\n+ // Record derived from official CSV\n+ record := []string{\"d44d88d0265d93927b9ff1c13bbbb7c7db64142c\", \"ITAR Debarred (DTC) - State Department\", \"\", \"\", \"\",\n+ \"Yasmin Ahmed\", \"\", \"\", \"69 FR 17468\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\",\n+ \"http://bit.ly/307FuRQ\", \"Yasmin Tariq; Fatimah Mohammad\", \"\", \"\", \"\", \"\", \"http://bit.ly/307FuRQ\",\n+ }\n+\n+ expectedDTC := &DTC{\n+ EntityID: \"d44d88d0265d93927b9ff1c13bbbb7c7db64142c\",\n+ Name: \"Yasmin Ahmed\",\n+ FederalRegisterNotice: \"69 FR 17468\",\n+ SourceListURL: \"http://bit.ly/307FuRQ\",\n+ AlternateNames: []string{\"Yasmin Tariq\", \"Fatimah Mohammad\"},\n+ SourceInfoURL: \"http://bit.ly/307FuRQ\",\n+ }\n+\n+ actualDTC := unmarshalDTC(record, 1)\n+\n+ if !reflect.DeepEqual(expectedDTC, actualDTC) {\n+ t.Errorf(\"Expected: %#v\\nFound: %#v\\n\", expectedDTC, actualDTC)\n+ }\n+}\n+\nfunc Test__Issue326EL(t *testing.T) {\nfd, err := os.CreateTemp(\"\", \"csl*.csv\")\nif err != nil {\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding unit test for unmarshaling DTC data.
428,981
06.09.2022 11:18:20
21,600
e2dc60a0deb50e8a0739d4321ef54d249ffdd0ae
Adding unit test for unmarshaling CMIC data.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/reader_test.go", "new_path": "pkg/csl/reader_test.go", "diff": "@@ -320,6 +320,38 @@ func Test_unmarshalDTC(t *testing.T) {\n}\n}\n+func Test_unmarshalCMIC(t *testing.T) {\n+ // Record derived from official CSV\n+ record := []string{\"32091\", \"Non-SDN Chinese Military-Industrial Complex Companies List (CMIC) - Treasury Department\", \"32091\", \"Entity\",\n+ \"CMIC-EO13959\", \"PROVEN HONOUR CAPITAL LIMITED\", \"\", \"C/O Vistra Corporate Services Centre, Wickhams Cay II, Road Town, VG1110, VG\",\n+ \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"(Linked To: HUAWEI INVESTMENT & HOLDING CO., LTD.)\", \"https://bit.ly/1QWTIfE\",\n+ \"PROVEN HONOUR CAPITAL LTD; PROVEN HONOUR\", \"\", \"\", \"\", \"\", \"https://bit.ly/3zsMQ4n\",\n+ \"Proven Honour Capital Ltd, Issuer Name; Proven Honour Capital Limited, Issuer Name; XS1233275194, ISIN; HK0000216777, ISIN; Private Company, Target Type; XS1401816761, ISIN; HK0000111952, ISIN; 03 Jun 2021, Listing Date (CMIC); 02 Aug 2021, Effective Date (CMIC); 03 Jun 2022, Purchase/Sales For Divestment Date (CMIC)\",\n+ }\n+\n+ expectedCMIC := &CMIC{\n+ EntityID: \"32091\",\n+ EntityNumber: \"32091\",\n+ Type: \"Entity\",\n+ Programs: []string{\"CMIC-EO13959\"},\n+ Name: \"PROVEN HONOUR CAPITAL LIMITED\",\n+ Addresses: []string{\"C/O Vistra Corporate Services Centre, Wickhams Cay II, Road Town, VG1110, VG\"},\n+ Remarks: []string{\"(Linked To: HUAWEI INVESTMENT & HOLDING CO., LTD.)\"},\n+ SourceListURL: \"https://bit.ly/1QWTIfE\",\n+ AlternateNames: []string{\"PROVEN HONOUR CAPITAL LTD\", \"PROVEN HONOUR\"},\n+ SourceInfoURL: \"https://bit.ly/3zsMQ4n\",\n+ IDs: []string{\"Proven Honour Capital Ltd, Issuer Name\", \"Proven Honour Capital Limited, Issuer Name\", \"XS1233275194, ISIN\",\n+ \"HK0000216777, ISIN\", \"Private Company, Target Type\", \"XS1401816761, ISIN\", \"HK0000111952, ISIN\", \"03 Jun 2021, Listing Date (CMIC)\",\n+ \"02 Aug 2021, Effective Date (CMIC)\", \"03 Jun 2022, Purchase/Sales For Divestment Date (CMIC)\"},\n+ }\n+\n+ actualCMIC := unmarshalCMIC(record, 1)\n+\n+ if !reflect.DeepEqual(expectedCMIC, actualCMIC) {\n+ t.Errorf(\"Expected: %#v\\nFound: %#v\\n\", expectedCMIC, actualCMIC)\n+ }\n+}\n+\nfunc Test__Issue326EL(t *testing.T) {\nfd, err := os.CreateTemp(\"\", \"csl*.csv\")\nif err != nil {\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding unit test for unmarshaling CMIC data.
428,981
06.09.2022 11:43:56
21,600
b338f79c42f5370d73940c1555dad39066c273d1
Adding unit test for unmarshaling NB-MBS data, plus fixing bug.
[ { "change_type": "MODIFY", "old_path": "pkg/csl/reader.go", "new_path": "pkg/csl/reader.go", "diff": "@@ -226,7 +226,7 @@ func unmarshalNS_MBS(record []string, offset int) *NS_MBS {\nAddresses: expandField(record[AddressesIdx+offset]),\nRemarks: expandField(record[RemarksIdx+offset]),\nAlternateNames: expandField(record[AltNamesIdx+offset]),\n- SourceInfoURL: record[SourceInformationURLIdx],\n+ SourceInfoURL: record[SourceInformationURLIdx+offset],\nIDs: expandField(record[IDsIdx+offset]),\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader_test.go", "new_path": "pkg/csl/reader_test.go", "diff": "@@ -352,6 +352,39 @@ func Test_unmarshalCMIC(t *testing.T) {\n}\n}\n+func Test_unmarshalNS_MBS(t *testing.T) {\n+ // Record derived from official CSV\n+ record := []string{\"17016\", \"Non-SDN Menu-Based Sanctions List (NS-MBS List) - Treasury Department\", \"17016\", \"Entity\", \"UKRAINE-EO13662; MBS\",\n+ \"GAZPROMBANK JOINT STOCK COMPANY\", \"\", \"16 Nametkina Street, Bldg. 1, Moscow, 117420, RU\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\", \"\",\n+ \"For more information on directives, please visit the following link: http://www.treasury.gov/resource-center/sanctions/Programs/Pages/ukraine.aspx#directives.\",\n+ \"\", \"GAZPROMBANK OPEN JOINT STOCK COMPANY; BANK GPB JSC; GAZPROMBANK AO; JOINT STOCK BANK OF THE GAS INDUSTRY GAZPROMBANK\", \"\", \"\", \"\", \"\", \"https://bit.ly/2MbsybU\",\n+ \"RU, 1027700167110, Registration Number; RU, 09807684, Government Gazette Number; RU, 7744001497, Tax ID No.; www.gazprombank.ru, Website; GAZPRUMM, SWIFT/BIC; Subject to Directive 1, Executive Order 13662 Directive Determination -; Subject to Directive 3 - All transactions in, provision of financing for, and other dealings in new debt of longer than 14 days maturity or new equity where such new debt or new equity is issued on or after the 'Effective Date (EO 14024 Directive)' associated with this name are prohibited., Executive Order 14024 Directive Information; 31 Jul 1990, Organization Established Date; 24 Feb 2022, Listing Date (EO 14024 Directive 3):; 26 Mar 2022, Effective Date (EO 14024 Directive 3):; For more information on directives, please visit the following link: https://home.treasury.gov/policy-issues/financial-sanctions/sanctions-programs-and-country-information/russian-harmful-foreign-activities-sanctions#directives, Executive Order 14024 Directive Information -\",\n+ }\n+\n+ expectedNS_MBS := &NS_MBS{\n+ EntityID: \"17016\",\n+ EntityNumber: \"17016\",\n+ Type: \"Entity\",\n+ Programs: []string{\"UKRAINE-EO13662\", \"MBS\"},\n+ Name: \"GAZPROMBANK JOINT STOCK COMPANY\",\n+ Addresses: []string{\"16 Nametkina Street, Bldg. 1, Moscow, 117420, RU\"},\n+ Remarks: []string{\"For more information on directives, please visit the following link: http://www.treasury.gov/resource-center/sanctions/Programs/Pages/ukraine.aspx#directives.\"},\n+ AlternateNames: []string{\"GAZPROMBANK OPEN JOINT STOCK COMPANY\", \"BANK GPB JSC\", \"GAZPROMBANK AO\", \"JOINT STOCK BANK OF THE GAS INDUSTRY GAZPROMBANK\"},\n+ SourceInfoURL: \"https://bit.ly/2MbsybU\",\n+ IDs: []string{\"RU, 1027700167110, Registration Number\", \"RU, 09807684, Government Gazette Number\", \"RU, 7744001497, Tax ID No.\",\n+ \"www.gazprombank.ru, Website\", \"GAZPRUMM, SWIFT/BIC\", \"Subject to Directive 1, Executive Order 13662 Directive Determination -\",\n+ \"Subject to Directive 3 - All transactions in, provision of financing for, and other dealings in new debt of longer than 14 days maturity or new equity where such new debt or new equity is issued on or after the 'Effective Date (EO 14024 Directive)' associated with this name are prohibited., Executive Order 14024 Directive Information\",\n+ \"31 Jul 1990, Organization Established Date\", \"24 Feb 2022, Listing Date (EO 14024 Directive 3):\", \"26 Mar 2022, Effective Date (EO 14024 Directive 3):\",\n+ \"For more information on directives, please visit the following link: https://home.treasury.gov/policy-issues/financial-sanctions/sanctions-programs-and-country-information/russian-harmful-foreign-activities-sanctions#directives, Executive Order 14024 Directive Information -\"},\n+ }\n+\n+ actualNB_MBS := unmarshalNS_MBS(record, 1)\n+\n+ if !reflect.DeepEqual(expectedNS_MBS, actualNB_MBS) {\n+ t.Errorf(\"Expected: %#v\\nFound: %#v\\n\", expectedNS_MBS, actualNB_MBS)\n+ }\n+}\n+\nfunc Test__Issue326EL(t *testing.T) {\nfd, err := os.CreateTemp(\"\", \"csl*.csv\")\nif err != nil {\n" } ]
Go
Apache License 2.0
moov-io/watchman
Adding unit test for unmarshaling NB-MBS data, plus fixing bug.
428,981
06.09.2022 13:49:23
21,600
46c2d2fa09b23009955165c593c1aa3bef590485
Added search handlers for the rest of the CSL data.
[ { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -299,6 +299,24 @@ var (\nfunc(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\nresp.NonproliferationSanctions = s.TopISNs(limit, minMatch, name)\n},\n+ func(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n+ resp.ForeignSanctionsEvaders = s.TopFSEs(limit, minMatch, name)\n+ },\n+ func(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n+ resp.PalestinianLegislativeCouncil = s.TopPLCs(limit, minMatch, name)\n+ },\n+ func(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n+ resp.CaptaList = s.TopCAPs(limit, minMatch, name)\n+ },\n+ func(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n+ resp.ITARDebarred = s.TopDTCs(limit, minMatch, name)\n+ },\n+ func(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n+ resp.NonSDNChineseMilitaryIndustrialComplex = s.TopCMICs(limit, minMatch, name)\n+ },\n+ func(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n+ resp.NonSDNMenuBasedSanctionsList = s.TopNS_MBS(limit, minMatch, name)\n+ },\n}\n)\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_us_csl.go", "new_path": "cmd/server/search_us_csl.go", "diff": "@@ -106,7 +106,7 @@ func (s *searcher) TopISNs(limit int, minMatch float64, name string) []*Result[c\n}\n// TopFSEs searches Foreign Sanctions Evaders records by Name and Alias\n-func (s *searcher) TobFSEs(limit int, minMatch float64, name string) []*Result[csl.FSE] {\n+func (s *searcher) TopFSEs(limit int, minMatch float64, name string) []*Result[csl.FSE] {\ns.RLock()\ndefer s.RUnlock()\n" }, { "change_type": "MODIFY", "old_path": "webui/package-lock.json", "new_path": "webui/package-lock.json", "diff": "\"name\": \"watchman-search-ui\",\n\"version\": \"0.1.0\",\n\"dependencies\": {\n- \"express\": \"4.17.3\",\n+ \"express\": \"4.18.1\",\n\"express-winston\": \"3.4.0\",\n\"history\": \"4.10.1\",\n\"http-proxy-middleware\": \"0.21.0\",\n\"react\": \"18.2.0\",\n\"react-dom\": \"18.2.0\",\n\"react-scripts\": \"^5.0.1\",\n- \"winston\": \"3.6.0\"\n+ \"winston\": \"3.8.1\"\n},\n\"devDependencies\": {\n\"@material-ui/core\": \"4.12.4\",\n\"integrity\": \"sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==\"\n},\n\"node_modules/body-parser\": {\n- \"version\": \"1.19.2\",\n- \"resolved\": \"https://registry.npmjs.org/body-parser/-/body-parser-1.19.2.tgz\",\n- \"integrity\": \"sha512-SAAwOxgoCKMGs9uUAUFHygfLAyaniaoun6I8mFY9pRAJL9+Kec34aU+oIjDhTycub1jozEfEwx1W1IuOYxVSFw==\",\n+ \"version\": \"1.20.0\",\n+ \"resolved\": \"https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz\",\n+ \"integrity\": \"sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==\",\n\"dependencies\": {\n\"bytes\": \"3.1.2\",\n\"content-type\": \"~1.0.4\",\n\"debug\": \"2.6.9\",\n- \"depd\": \"~1.1.2\",\n- \"http-errors\": \"1.8.1\",\n+ \"depd\": \"2.0.0\",\n+ \"destroy\": \"1.2.0\",\n+ \"http-errors\": \"2.0.0\",\n\"iconv-lite\": \"0.4.24\",\n- \"on-finished\": \"~2.3.0\",\n- \"qs\": \"6.9.7\",\n- \"raw-body\": \"2.4.3\",\n- \"type-is\": \"~1.6.18\"\n+ \"on-finished\": \"2.4.1\",\n+ \"qs\": \"6.10.3\",\n+ \"raw-body\": \"2.5.1\",\n+ \"type-is\": \"~1.6.18\",\n+ \"unpipe\": \"1.0.0\"\n},\n\"engines\": {\n- \"node\": \">= 0.8\"\n+ \"node\": \">= 0.8\",\n+ \"npm\": \"1.2.8000 || >= 1.4.16\"\n}\n},\n\"node_modules/body-parser/node_modules/bytes\": {\n\"ms\": \"2.0.0\"\n}\n},\n+ \"node_modules/body-parser/node_modules/depd\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/depd/-/depd-2.0.0.tgz\",\n+ \"integrity\": \"sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==\",\n+ \"engines\": {\n+ \"node\": \">= 0.8\"\n+ }\n+ },\n\"node_modules/body-parser/node_modules/ms\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz\",\n- \"integrity\": \"sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=\"\n+ \"integrity\": \"sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==\"\n},\n\"node_modules/bonjour-service\": {\n\"version\": \"1.0.12\",\n}\n},\n\"node_modules/cookie\": {\n- \"version\": \"0.4.2\",\n- \"resolved\": \"https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz\",\n- \"integrity\": \"sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==\",\n+ \"version\": \"0.5.0\",\n+ \"resolved\": \"https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz\",\n+ \"integrity\": \"sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==\",\n\"engines\": {\n\"node\": \">= 0.6\"\n}\n}\n},\n\"node_modules/destroy\": {\n- \"version\": \"1.0.4\",\n- \"resolved\": \"https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz\",\n- \"integrity\": \"sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=\"\n+ \"version\": \"1.2.0\",\n+ \"resolved\": \"https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz\",\n+ \"integrity\": \"sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==\",\n+ \"engines\": {\n+ \"node\": \">= 0.8\",\n+ \"npm\": \"1.2.8000 || >= 1.4.16\"\n+ }\n},\n\"node_modules/detect-newline\": {\n\"version\": \"3.1.0\",\n\"node_modules/ee-first\": {\n\"version\": \"1.1.1\",\n\"resolved\": \"https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz\",\n- \"integrity\": \"sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=\"\n+ \"integrity\": \"sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==\"\n},\n\"node_modules/ejs\": {\n\"version\": \"3.1.7\",\n\"node_modules/encodeurl\": {\n\"version\": \"1.0.2\",\n\"resolved\": \"https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz\",\n- \"integrity\": \"sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=\",\n+ \"integrity\": \"sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==\",\n\"engines\": {\n\"node\": \">= 0.8\"\n}\n\"node_modules/etag\": {\n\"version\": \"1.8.1\",\n\"resolved\": \"https://registry.npmjs.org/etag/-/etag-1.8.1.tgz\",\n- \"integrity\": \"sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=\",\n+ \"integrity\": \"sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==\",\n\"engines\": {\n\"node\": \">= 0.6\"\n}\n}\n},\n\"node_modules/express\": {\n- \"version\": \"4.17.3\",\n- \"resolved\": \"https://registry.npmjs.org/express/-/express-4.17.3.tgz\",\n- \"integrity\": \"sha512-yuSQpz5I+Ch7gFrPCk4/c+dIBKlQUxtgwqzph132bsT6qhuzss6I8cLJQz7B3rFblzd6wtcI0ZbGltH/C4LjUg==\",\n+ \"version\": \"4.18.1\",\n+ \"resolved\": \"https://registry.npmjs.org/express/-/express-4.18.1.tgz\",\n+ \"integrity\": \"sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==\",\n\"dependencies\": {\n\"accepts\": \"~1.3.8\",\n\"array-flatten\": \"1.1.1\",\n- \"body-parser\": \"1.19.2\",\n+ \"body-parser\": \"1.20.0\",\n\"content-disposition\": \"0.5.4\",\n\"content-type\": \"~1.0.4\",\n- \"cookie\": \"0.4.2\",\n+ \"cookie\": \"0.5.0\",\n\"cookie-signature\": \"1.0.6\",\n\"debug\": \"2.6.9\",\n- \"depd\": \"~1.1.2\",\n+ \"depd\": \"2.0.0\",\n\"encodeurl\": \"~1.0.2\",\n\"escape-html\": \"~1.0.3\",\n\"etag\": \"~1.8.1\",\n- \"finalhandler\": \"~1.1.2\",\n+ \"finalhandler\": \"1.2.0\",\n\"fresh\": \"0.5.2\",\n+ \"http-errors\": \"2.0.0\",\n\"merge-descriptors\": \"1.0.1\",\n\"methods\": \"~1.1.2\",\n- \"on-finished\": \"~2.3.0\",\n+ \"on-finished\": \"2.4.1\",\n\"parseurl\": \"~1.3.3\",\n\"path-to-regexp\": \"0.1.7\",\n\"proxy-addr\": \"~2.0.7\",\n- \"qs\": \"6.9.7\",\n+ \"qs\": \"6.10.3\",\n\"range-parser\": \"~1.2.1\",\n\"safe-buffer\": \"5.2.1\",\n- \"send\": \"0.17.2\",\n- \"serve-static\": \"1.14.2\",\n+ \"send\": \"0.18.0\",\n+ \"serve-static\": \"1.15.0\",\n\"setprototypeof\": \"1.2.0\",\n- \"statuses\": \"~1.5.0\",\n+ \"statuses\": \"2.0.1\",\n\"type-is\": \"~1.6.18\",\n\"utils-merge\": \"1.0.1\",\n\"vary\": \"~1.1.2\"\n\"ms\": \"2.0.0\"\n}\n},\n+ \"node_modules/express/node_modules/depd\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/depd/-/depd-2.0.0.tgz\",\n+ \"integrity\": \"sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==\",\n+ \"engines\": {\n+ \"node\": \">= 0.8\"\n+ }\n+ },\n\"node_modules/express/node_modules/ms\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz\",\n}\n]\n},\n+ \"node_modules/express/node_modules/statuses\": {\n+ \"version\": \"2.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz\",\n+ \"integrity\": \"sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==\",\n+ \"engines\": {\n+ \"node\": \">= 0.8\"\n+ }\n+ },\n\"node_modules/fast-deep-equal\": {\n\"version\": \"3.1.3\",\n\"resolved\": \"https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz\",\n}\n},\n\"node_modules/finalhandler\": {\n- \"version\": \"1.1.2\",\n- \"resolved\": \"https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz\",\n- \"integrity\": \"sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==\",\n+ \"version\": \"1.2.0\",\n+ \"resolved\": \"https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz\",\n+ \"integrity\": \"sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==\",\n\"dependencies\": {\n\"debug\": \"2.6.9\",\n\"encodeurl\": \"~1.0.2\",\n\"escape-html\": \"~1.0.3\",\n- \"on-finished\": \"~2.3.0\",\n+ \"on-finished\": \"2.4.1\",\n\"parseurl\": \"~1.3.3\",\n- \"statuses\": \"~1.5.0\",\n+ \"statuses\": \"2.0.1\",\n\"unpipe\": \"~1.0.0\"\n},\n\"engines\": {\n\"node_modules/finalhandler/node_modules/ms\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz\",\n- \"integrity\": \"sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=\"\n+ \"integrity\": \"sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==\"\n+ },\n+ \"node_modules/finalhandler/node_modules/statuses\": {\n+ \"version\": \"2.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz\",\n+ \"integrity\": \"sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==\",\n+ \"engines\": {\n+ \"node\": \">= 0.8\"\n+ }\n},\n\"node_modules/find-cache-dir\": {\n\"version\": \"3.3.2\",\n\"node_modules/fresh\": {\n\"version\": \"0.5.2\",\n\"resolved\": \"https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz\",\n- \"integrity\": \"sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=\",\n+ \"integrity\": \"sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==\",\n\"engines\": {\n\"node\": \">= 0.6\"\n}\n\"integrity\": \"sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=\"\n},\n\"node_modules/http-errors\": {\n- \"version\": \"1.8.1\",\n- \"resolved\": \"https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz\",\n- \"integrity\": \"sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==\",\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz\",\n+ \"integrity\": \"sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==\",\n\"dependencies\": {\n- \"depd\": \"~1.1.2\",\n+ \"depd\": \"2.0.0\",\n\"inherits\": \"2.0.4\",\n\"setprototypeof\": \"1.2.0\",\n- \"statuses\": \">= 1.5.0 < 2\",\n+ \"statuses\": \"2.0.1\",\n\"toidentifier\": \"1.0.1\"\n},\n\"engines\": {\n- \"node\": \">= 0.6\"\n+ \"node\": \">= 0.8\"\n+ }\n+ },\n+ \"node_modules/http-errors/node_modules/depd\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/depd/-/depd-2.0.0.tgz\",\n+ \"integrity\": \"sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==\",\n+ \"engines\": {\n+ \"node\": \">= 0.8\"\n+ }\n+ },\n+ \"node_modules/http-errors/node_modules/statuses\": {\n+ \"version\": \"2.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz\",\n+ \"integrity\": \"sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==\",\n+ \"engines\": {\n+ \"node\": \">= 0.8\"\n}\n},\n\"node_modules/http-parser-js\": {\n\"node_modules/media-typer\": {\n\"version\": \"0.3.0\",\n\"resolved\": \"https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz\",\n- \"integrity\": \"sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=\",\n+ \"integrity\": \"sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==\",\n\"engines\": {\n\"node\": \">= 0.6\"\n}\n\"node\": \">=8.6\"\n}\n},\n+ \"node_modules/mime\": {\n+ \"version\": \"1.6.0\",\n+ \"resolved\": \"https://registry.npmjs.org/mime/-/mime-1.6.0.tgz\",\n+ \"integrity\": \"sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==\",\n+ \"bin\": {\n+ \"mime\": \"cli.js\"\n+ },\n+ \"engines\": {\n+ \"node\": \">=4\"\n+ }\n+ },\n\"node_modules/mime-db\": {\n\"version\": \"1.51.0\",\n\"resolved\": \"https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz\",\n\"integrity\": \"sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==\"\n},\n\"node_modules/on-finished\": {\n- \"version\": \"2.3.0\",\n- \"resolved\": \"https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz\",\n- \"integrity\": \"sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=\",\n+ \"version\": \"2.4.1\",\n+ \"resolved\": \"https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz\",\n+ \"integrity\": \"sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==\",\n\"dependencies\": {\n\"ee-first\": \"1.1.1\"\n},\n}\n},\n\"node_modules/qs\": {\n- \"version\": \"6.9.7\",\n- \"resolved\": \"https://registry.npmjs.org/qs/-/qs-6.9.7.tgz\",\n- \"integrity\": \"sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw==\",\n+ \"version\": \"6.10.3\",\n+ \"resolved\": \"https://registry.npmjs.org/qs/-/qs-6.10.3.tgz\",\n+ \"integrity\": \"sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==\",\n+ \"dependencies\": {\n+ \"side-channel\": \"^1.0.4\"\n+ },\n\"engines\": {\n\"node\": \">=0.6\"\n},\n}\n},\n\"node_modules/raw-body\": {\n- \"version\": \"2.4.3\",\n- \"resolved\": \"https://registry.npmjs.org/raw-body/-/raw-body-2.4.3.tgz\",\n- \"integrity\": \"sha512-UlTNLIcu0uzb4D2f4WltY6cVjLi+/jEN4lgEUj3E04tpMDpUlkBo/eSn6zou9hum2VMNpCCUone0O0WeJim07g==\",\n+ \"version\": \"2.5.1\",\n+ \"resolved\": \"https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz\",\n+ \"integrity\": \"sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==\",\n\"dependencies\": {\n\"bytes\": \"3.1.2\",\n- \"http-errors\": \"1.8.1\",\n+ \"http-errors\": \"2.0.0\",\n\"iconv-lite\": \"0.4.24\",\n\"unpipe\": \"1.0.0\"\n},\n}\n},\n\"node_modules/send\": {\n- \"version\": \"0.17.2\",\n- \"resolved\": \"https://registry.npmjs.org/send/-/send-0.17.2.tgz\",\n- \"integrity\": \"sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==\",\n+ \"version\": \"0.18.0\",\n+ \"resolved\": \"https://registry.npmjs.org/send/-/send-0.18.0.tgz\",\n+ \"integrity\": \"sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==\",\n\"dependencies\": {\n\"debug\": \"2.6.9\",\n- \"depd\": \"~1.1.2\",\n- \"destroy\": \"~1.0.4\",\n+ \"depd\": \"2.0.0\",\n+ \"destroy\": \"1.2.0\",\n\"encodeurl\": \"~1.0.2\",\n\"escape-html\": \"~1.0.3\",\n\"etag\": \"~1.8.1\",\n\"fresh\": \"0.5.2\",\n- \"http-errors\": \"1.8.1\",\n+ \"http-errors\": \"2.0.0\",\n\"mime\": \"1.6.0\",\n\"ms\": \"2.1.3\",\n- \"on-finished\": \"~2.3.0\",\n+ \"on-finished\": \"2.4.1\",\n\"range-parser\": \"~1.2.1\",\n- \"statuses\": \"~1.5.0\"\n+ \"statuses\": \"2.0.1\"\n},\n\"engines\": {\n\"node\": \">= 0.8.0\"\n\"node_modules/send/node_modules/debug/node_modules/ms\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz\",\n- \"integrity\": \"sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=\"\n- },\n- \"node_modules/send/node_modules/mime\": {\n- \"version\": \"1.6.0\",\n- \"resolved\": \"https://registry.npmjs.org/mime/-/mime-1.6.0.tgz\",\n- \"integrity\": \"sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==\",\n- \"bin\": {\n- \"mime\": \"cli.js\"\n+ \"integrity\": \"sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==\"\n},\n+ \"node_modules/send/node_modules/depd\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/depd/-/depd-2.0.0.tgz\",\n+ \"integrity\": \"sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==\",\n\"engines\": {\n- \"node\": \">=4\"\n+ \"node\": \">= 0.8\"\n}\n},\n\"node_modules/send/node_modules/ms\": {\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.1.3.tgz\",\n\"integrity\": \"sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==\"\n},\n+ \"node_modules/send/node_modules/statuses\": {\n+ \"version\": \"2.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz\",\n+ \"integrity\": \"sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==\",\n+ \"engines\": {\n+ \"node\": \">= 0.8\"\n+ }\n+ },\n\"node_modules/serialize-javascript\": {\n\"version\": \"6.0.0\",\n\"resolved\": \"https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz\",\n\"integrity\": \"sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==\"\n},\n\"node_modules/serve-static\": {\n- \"version\": \"1.14.2\",\n- \"resolved\": \"https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz\",\n- \"integrity\": \"sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==\",\n+ \"version\": \"1.15.0\",\n+ \"resolved\": \"https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz\",\n+ \"integrity\": \"sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==\",\n\"dependencies\": {\n\"encodeurl\": \"~1.0.2\",\n\"escape-html\": \"~1.0.3\",\n\"parseurl\": \"~1.3.3\",\n- \"send\": \"0.17.2\"\n+ \"send\": \"0.18.0\"\n},\n\"engines\": {\n\"node\": \">= 0.8.0\"\n\"node_modules/unpipe\": {\n\"version\": \"1.0.0\",\n\"resolved\": \"https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz\",\n- \"integrity\": \"sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=\",\n+ \"integrity\": \"sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==\",\n\"engines\": {\n\"node\": \">= 0.8\"\n}\n}\n},\n\"node_modules/winston\": {\n- \"version\": \"3.6.0\",\n- \"resolved\": \"https://registry.npmjs.org/winston/-/winston-3.6.0.tgz\",\n- \"integrity\": \"sha512-9j8T75p+bcN6D00sF/zjFVmPp+t8KMPB1MzbbzYjeN9VWxdsYnTB40TkbNUEXAmILEfChMvAMgidlX64OG3p6w==\",\n+ \"version\": \"3.8.1\",\n+ \"resolved\": \"https://registry.npmjs.org/winston/-/winston-3.8.1.tgz\",\n+ \"integrity\": \"sha512-r+6YAiCR4uI3N8eQNOg8k3P3PqwAm20cLKlzVD9E66Ch39+LZC+VH1UKf9JemQj2B3QoUHfKD7Poewn0Pr3Y1w==\",\n\"dependencies\": {\n\"@dabh/diagnostics\": \"^2.0.2\",\n\"async\": \"^3.2.3\",\n\"integrity\": \"sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==\"\n},\n\"body-parser\": {\n- \"version\": \"1.19.2\",\n- \"resolved\": \"https://registry.npmjs.org/body-parser/-/body-parser-1.19.2.tgz\",\n- \"integrity\": \"sha512-SAAwOxgoCKMGs9uUAUFHygfLAyaniaoun6I8mFY9pRAJL9+Kec34aU+oIjDhTycub1jozEfEwx1W1IuOYxVSFw==\",\n+ \"version\": \"1.20.0\",\n+ \"resolved\": \"https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz\",\n+ \"integrity\": \"sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==\",\n\"requires\": {\n\"bytes\": \"3.1.2\",\n\"content-type\": \"~1.0.4\",\n\"debug\": \"2.6.9\",\n- \"depd\": \"~1.1.2\",\n- \"http-errors\": \"1.8.1\",\n+ \"depd\": \"2.0.0\",\n+ \"destroy\": \"1.2.0\",\n+ \"http-errors\": \"2.0.0\",\n\"iconv-lite\": \"0.4.24\",\n- \"on-finished\": \"~2.3.0\",\n- \"qs\": \"6.9.7\",\n- \"raw-body\": \"2.4.3\",\n- \"type-is\": \"~1.6.18\"\n+ \"on-finished\": \"2.4.1\",\n+ \"qs\": \"6.10.3\",\n+ \"raw-body\": \"2.5.1\",\n+ \"type-is\": \"~1.6.18\",\n+ \"unpipe\": \"1.0.0\"\n},\n\"dependencies\": {\n\"bytes\": {\n\"ms\": \"2.0.0\"\n}\n},\n+ \"depd\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/depd/-/depd-2.0.0.tgz\",\n+ \"integrity\": \"sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==\"\n+ },\n\"ms\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz\",\n- \"integrity\": \"sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=\"\n+ \"integrity\": \"sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==\"\n}\n}\n},\n}\n},\n\"cookie\": {\n- \"version\": \"0.4.2\",\n- \"resolved\": \"https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz\",\n- \"integrity\": \"sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==\"\n+ \"version\": \"0.5.0\",\n+ \"resolved\": \"https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz\",\n+ \"integrity\": \"sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==\"\n},\n\"cookie-signature\": {\n\"version\": \"1.0.6\",\n\"integrity\": \"sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=\"\n},\n\"destroy\": {\n- \"version\": \"1.0.4\",\n- \"resolved\": \"https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz\",\n- \"integrity\": \"sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=\"\n+ \"version\": \"1.2.0\",\n+ \"resolved\": \"https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz\",\n+ \"integrity\": \"sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==\"\n},\n\"detect-newline\": {\n\"version\": \"3.1.0\",\n\"ee-first\": {\n\"version\": \"1.1.1\",\n\"resolved\": \"https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz\",\n- \"integrity\": \"sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=\"\n+ \"integrity\": \"sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==\"\n},\n\"ejs\": {\n\"version\": \"3.1.7\",\n\"encodeurl\": {\n\"version\": \"1.0.2\",\n\"resolved\": \"https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz\",\n- \"integrity\": \"sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=\"\n+ \"integrity\": \"sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==\"\n},\n\"enhanced-resolve\": {\n\"version\": \"5.9.3\",\n\"etag\": {\n\"version\": \"1.8.1\",\n\"resolved\": \"https://registry.npmjs.org/etag/-/etag-1.8.1.tgz\",\n- \"integrity\": \"sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=\"\n+ \"integrity\": \"sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==\"\n},\n\"eventemitter3\": {\n\"version\": \"4.0.4\",\n}\n},\n\"express\": {\n- \"version\": \"4.17.3\",\n- \"resolved\": \"https://registry.npmjs.org/express/-/express-4.17.3.tgz\",\n- \"integrity\": \"sha512-yuSQpz5I+Ch7gFrPCk4/c+dIBKlQUxtgwqzph132bsT6qhuzss6I8cLJQz7B3rFblzd6wtcI0ZbGltH/C4LjUg==\",\n+ \"version\": \"4.18.1\",\n+ \"resolved\": \"https://registry.npmjs.org/express/-/express-4.18.1.tgz\",\n+ \"integrity\": \"sha512-zZBcOX9TfehHQhtupq57OF8lFZ3UZi08Y97dwFCkD8p9d/d2Y3M+ykKcwaMDEL+4qyUolgBDX6AblpR3fL212Q==\",\n\"requires\": {\n\"accepts\": \"~1.3.8\",\n\"array-flatten\": \"1.1.1\",\n- \"body-parser\": \"1.19.2\",\n+ \"body-parser\": \"1.20.0\",\n\"content-disposition\": \"0.5.4\",\n\"content-type\": \"~1.0.4\",\n- \"cookie\": \"0.4.2\",\n+ \"cookie\": \"0.5.0\",\n\"cookie-signature\": \"1.0.6\",\n\"debug\": \"2.6.9\",\n- \"depd\": \"~1.1.2\",\n+ \"depd\": \"2.0.0\",\n\"encodeurl\": \"~1.0.2\",\n\"escape-html\": \"~1.0.3\",\n\"etag\": \"~1.8.1\",\n- \"finalhandler\": \"~1.1.2\",\n+ \"finalhandler\": \"1.2.0\",\n\"fresh\": \"0.5.2\",\n+ \"http-errors\": \"2.0.0\",\n\"merge-descriptors\": \"1.0.1\",\n\"methods\": \"~1.1.2\",\n- \"on-finished\": \"~2.3.0\",\n+ \"on-finished\": \"2.4.1\",\n\"parseurl\": \"~1.3.3\",\n\"path-to-regexp\": \"0.1.7\",\n\"proxy-addr\": \"~2.0.7\",\n- \"qs\": \"6.9.7\",\n+ \"qs\": \"6.10.3\",\n\"range-parser\": \"~1.2.1\",\n\"safe-buffer\": \"5.2.1\",\n- \"send\": \"0.17.2\",\n- \"serve-static\": \"1.14.2\",\n+ \"send\": \"0.18.0\",\n+ \"serve-static\": \"1.15.0\",\n\"setprototypeof\": \"1.2.0\",\n- \"statuses\": \"~1.5.0\",\n+ \"statuses\": \"2.0.1\",\n\"type-is\": \"~1.6.18\",\n\"utils-merge\": \"1.0.1\",\n\"vary\": \"~1.1.2\"\n\"ms\": \"2.0.0\"\n}\n},\n+ \"depd\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/depd/-/depd-2.0.0.tgz\",\n+ \"integrity\": \"sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==\"\n+ },\n\"ms\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz\",\n\"version\": \"5.2.1\",\n\"resolved\": \"https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz\",\n\"integrity\": \"sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==\"\n+ },\n+ \"statuses\": {\n+ \"version\": \"2.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz\",\n+ \"integrity\": \"sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==\"\n}\n}\n},\n}\n},\n\"finalhandler\": {\n- \"version\": \"1.1.2\",\n- \"resolved\": \"https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz\",\n- \"integrity\": \"sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==\",\n+ \"version\": \"1.2.0\",\n+ \"resolved\": \"https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz\",\n+ \"integrity\": \"sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==\",\n\"requires\": {\n\"debug\": \"2.6.9\",\n\"encodeurl\": \"~1.0.2\",\n\"escape-html\": \"~1.0.3\",\n- \"on-finished\": \"~2.3.0\",\n+ \"on-finished\": \"2.4.1\",\n\"parseurl\": \"~1.3.3\",\n- \"statuses\": \"~1.5.0\",\n+ \"statuses\": \"2.0.1\",\n\"unpipe\": \"~1.0.0\"\n},\n\"dependencies\": {\n\"ms\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz\",\n- \"integrity\": \"sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=\"\n+ \"integrity\": \"sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==\"\n+ },\n+ \"statuses\": {\n+ \"version\": \"2.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz\",\n+ \"integrity\": \"sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==\"\n}\n}\n},\n\"fresh\": {\n\"version\": \"0.5.2\",\n\"resolved\": \"https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz\",\n- \"integrity\": \"sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=\"\n+ \"integrity\": \"sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==\"\n},\n\"fs-extra\": {\n\"version\": \"10.1.0\",\n\"integrity\": \"sha1-+nFolEq5pRnTN8sL7HKE3D5yPYc=\"\n},\n\"http-errors\": {\n- \"version\": \"1.8.1\",\n- \"resolved\": \"https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz\",\n- \"integrity\": \"sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==\",\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz\",\n+ \"integrity\": \"sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==\",\n\"requires\": {\n- \"depd\": \"~1.1.2\",\n+ \"depd\": \"2.0.0\",\n\"inherits\": \"2.0.4\",\n\"setprototypeof\": \"1.2.0\",\n- \"statuses\": \">= 1.5.0 < 2\",\n+ \"statuses\": \"2.0.1\",\n\"toidentifier\": \"1.0.1\"\n+ },\n+ \"dependencies\": {\n+ \"depd\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/depd/-/depd-2.0.0.tgz\",\n+ \"integrity\": \"sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==\"\n+ },\n+ \"statuses\": {\n+ \"version\": \"2.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz\",\n+ \"integrity\": \"sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==\"\n+ }\n}\n},\n\"http-parser-js\": {\n\"media-typer\": {\n\"version\": \"0.3.0\",\n\"resolved\": \"https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz\",\n- \"integrity\": \"sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=\"\n+ \"integrity\": \"sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==\"\n},\n\"memfs\": {\n\"version\": \"3.4.1\",\n\"picomatch\": \"^2.3.1\"\n}\n},\n+ \"mime\": {\n+ \"version\": \"1.6.0\",\n+ \"resolved\": \"https://registry.npmjs.org/mime/-/mime-1.6.0.tgz\",\n+ \"integrity\": \"sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==\"\n+ },\n\"mime-db\": {\n\"version\": \"1.51.0\",\n\"resolved\": \"https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz\",\n\"integrity\": \"sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==\"\n},\n\"on-finished\": {\n- \"version\": \"2.3.0\",\n- \"resolved\": \"https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz\",\n- \"integrity\": \"sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=\",\n+ \"version\": \"2.4.1\",\n+ \"resolved\": \"https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz\",\n+ \"integrity\": \"sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==\",\n\"requires\": {\n\"ee-first\": \"1.1.1\"\n}\n\"integrity\": \"sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=\"\n},\n\"qs\": {\n- \"version\": \"6.9.7\",\n- \"resolved\": \"https://registry.npmjs.org/qs/-/qs-6.9.7.tgz\",\n- \"integrity\": \"sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw==\"\n+ \"version\": \"6.10.3\",\n+ \"resolved\": \"https://registry.npmjs.org/qs/-/qs-6.10.3.tgz\",\n+ \"integrity\": \"sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==\",\n+ \"requires\": {\n+ \"side-channel\": \"^1.0.4\"\n+ }\n},\n\"queue-microtask\": {\n\"version\": \"1.2.3\",\n\"integrity\": \"sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==\"\n},\n\"raw-body\": {\n- \"version\": \"2.4.3\",\n- \"resolved\": \"https://registry.npmjs.org/raw-body/-/raw-body-2.4.3.tgz\",\n- \"integrity\": \"sha512-UlTNLIcu0uzb4D2f4WltY6cVjLi+/jEN4lgEUj3E04tpMDpUlkBo/eSn6zou9hum2VMNpCCUone0O0WeJim07g==\",\n+ \"version\": \"2.5.1\",\n+ \"resolved\": \"https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz\",\n+ \"integrity\": \"sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==\",\n\"requires\": {\n\"bytes\": \"3.1.2\",\n- \"http-errors\": \"1.8.1\",\n+ \"http-errors\": \"2.0.0\",\n\"iconv-lite\": \"0.4.24\",\n\"unpipe\": \"1.0.0\"\n},\n}\n},\n\"send\": {\n- \"version\": \"0.17.2\",\n- \"resolved\": \"https://registry.npmjs.org/send/-/send-0.17.2.tgz\",\n- \"integrity\": \"sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==\",\n+ \"version\": \"0.18.0\",\n+ \"resolved\": \"https://registry.npmjs.org/send/-/send-0.18.0.tgz\",\n+ \"integrity\": \"sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==\",\n\"requires\": {\n\"debug\": \"2.6.9\",\n- \"depd\": \"~1.1.2\",\n- \"destroy\": \"~1.0.4\",\n+ \"depd\": \"2.0.0\",\n+ \"destroy\": \"1.2.0\",\n\"encodeurl\": \"~1.0.2\",\n\"escape-html\": \"~1.0.3\",\n\"etag\": \"~1.8.1\",\n\"fresh\": \"0.5.2\",\n- \"http-errors\": \"1.8.1\",\n+ \"http-errors\": \"2.0.0\",\n\"mime\": \"1.6.0\",\n\"ms\": \"2.1.3\",\n- \"on-finished\": \"~2.3.0\",\n+ \"on-finished\": \"2.4.1\",\n\"range-parser\": \"~1.2.1\",\n- \"statuses\": \"~1.5.0\"\n+ \"statuses\": \"2.0.1\"\n},\n\"dependencies\": {\n\"debug\": {\n\"ms\": {\n\"version\": \"2.0.0\",\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz\",\n- \"integrity\": \"sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=\"\n+ \"integrity\": \"sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==\"\n}\n}\n},\n- \"mime\": {\n- \"version\": \"1.6.0\",\n- \"resolved\": \"https://registry.npmjs.org/mime/-/mime-1.6.0.tgz\",\n- \"integrity\": \"sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==\"\n+ \"depd\": {\n+ \"version\": \"2.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/depd/-/depd-2.0.0.tgz\",\n+ \"integrity\": \"sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==\"\n},\n\"ms\": {\n\"version\": \"2.1.3\",\n\"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.1.3.tgz\",\n\"integrity\": \"sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==\"\n+ },\n+ \"statuses\": {\n+ \"version\": \"2.0.1\",\n+ \"resolved\": \"https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz\",\n+ \"integrity\": \"sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==\"\n}\n}\n},\n}\n},\n\"serve-static\": {\n- \"version\": \"1.14.2\",\n- \"resolved\": \"https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz\",\n- \"integrity\": \"sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==\",\n+ \"version\": \"1.15.0\",\n+ \"resolved\": \"https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz\",\n+ \"integrity\": \"sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==\",\n\"requires\": {\n\"encodeurl\": \"~1.0.2\",\n\"escape-html\": \"~1.0.3\",\n\"parseurl\": \"~1.3.3\",\n- \"send\": \"0.17.2\"\n+ \"send\": \"0.18.0\"\n}\n},\n\"setprototypeof\": {\n\"unpipe\": {\n\"version\": \"1.0.0\",\n\"resolved\": \"https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz\",\n- \"integrity\": \"sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=\"\n+ \"integrity\": \"sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==\"\n},\n\"unquote\": {\n\"version\": \"1.1.1\",\n}\n},\n\"winston\": {\n- \"version\": \"3.6.0\",\n- \"resolved\": \"https://registry.npmjs.org/winston/-/winston-3.6.0.tgz\",\n- \"integrity\": \"sha512-9j8T75p+bcN6D00sF/zjFVmPp+t8KMPB1MzbbzYjeN9VWxdsYnTB40TkbNUEXAmILEfChMvAMgidlX64OG3p6w==\",\n+ \"version\": \"3.8.1\",\n+ \"resolved\": \"https://registry.npmjs.org/winston/-/winston-3.8.1.tgz\",\n+ \"integrity\": \"sha512-r+6YAiCR4uI3N8eQNOg8k3P3PqwAm20cLKlzVD9E66Ch39+LZC+VH1UKf9JemQj2B3QoUHfKD7Poewn0Pr3Y1w==\",\n\"requires\": {\n\"@dabh/diagnostics\": \"^2.0.2\",\n\"async\": \"^3.2.3\",\n" } ]
Go
Apache License 2.0
moov-io/watchman
Added search handlers for the rest of the CSL data.
428,981
07.09.2022 15:44:21
21,600
7bdf3475f09dc689ac5fda1dc94de332b0d7d230
Added unit tests for TopN functions, to verify CSL data search.
[ { "change_type": "MODIFY", "old_path": "cmd/server/search_test.go", "new_path": "cmd/server/search_test.go", "diff": "@@ -38,6 +38,13 @@ var (\nmeuSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\nssiSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\nisnSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\n+ uvlSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\n+ fseSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\n+ plcSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\n+ capSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\n+ dtcSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\n+ cmicSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\n+ ns_mbsSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\n)\nfunc init() {\n@@ -210,6 +217,115 @@ func init() {\nSourceInfoURL: \"http://bit.ly/1NuVFxV\",\n},\n}, noLogPipeliner)\n+ uvlSearcher.UVLs = precomputeCSLEntities[csl.UVL]([]*csl.UVL{\n+ {\n+ EntityID: \"f15fa805ff4ac5e09026f5e78011a1bb6b26dec2\",\n+ Name: \"Atlas Sanatgaran\",\n+ Addresses: []string{\"Komitas 26/114, Yerevan, Armenia, AM\"},\n+ SourceListURL: \"http://bit.ly/1iwwTSJ\",\n+ SourceInfoURL: \"http://bit.ly/1Qi4R7Z\",\n+ },\n+ }, noLogPipeliner)\n+ fseSearcher.FSEs = precomputeCSLEntities[csl.FSE]([]*csl.FSE{\n+ {\n+ EntityID: \"17526\",\n+ EntityNumber: \"17526\",\n+ Type: \"Individual\",\n+ Programs: []string{\"SYRIA\", \"FSE-SY\"},\n+ Name: \"BEKTAS, Halis\",\n+ Addresses: nil,\n+ SourceListURL: \"https://bit.ly/1QWTIfE\",\n+ Citizenships: \"CH\",\n+ DatesOfBirth: \"1966-02-13\",\n+ SourceInfoURL: \"http://bit.ly/1N1docf\",\n+ IDs: []string{\"CH, X0906223, Passport\"},\n+ },\n+ }, noLogPipeliner)\n+ plcSearcher.PLCs = precomputeCSLEntities[csl.PLC]([]*csl.PLC{\n+ {\n+ EntityID: \"9702\",\n+ EntityNumber: \"9702\",\n+ Type: \"Individual\",\n+ Programs: []string{\"NS-PLC\", \"Office of Misinformation\"},\n+ Name: \"SALAMEH, Salem\",\n+ Addresses: []string{\"123 Dunbar Street, Testerville, TX, Palestine\"},\n+ Remarks: \"HAMAS - Der al-Balah\",\n+ SourceListURL: \"https://bit.ly/1QWTIfE\",\n+ AlternateNames: []string{\"SALAMEH, Salem Ahmad Abdel Hadi\"},\n+ DatesOfBirth: \"1951\",\n+ PlacesOfBirth: \"\",\n+ SourceInfoURL: \"http://bit.ly/2tjOLpx\",\n+ },\n+ }, noLogPipeliner)\n+ capSearcher.CAPs = precomputeCSLEntities[csl.CAP]([]*csl.CAP{\n+ {\n+ EntityID: \"20002\",\n+ EntityNumber: \"20002\",\n+ Type: \"Entity\",\n+ Programs: []string{\"UKRAINE-EO13662\", \"RUSSIA-EO14024\"},\n+ Name: \"BM BANK PUBLIC JOINT STOCK COMPANY\",\n+ Addresses: []string{\"Bld 3 8/15, Rozhdestvenka St., Moscow, 107996, RU\"},\n+ Remarks: []string{\"All offices worldwide\", \"for more information on directives, please visit the following link: https://www.treasury.gov/resource-center/sanctions/Programs/Pages/ukraine.aspx#directives\", \"(Linked To: VTB BANK PUBLIC JOINT STOCK COMPANY)\"},\n+ SourceListURL: \"\",\n+ AlternateNames: []string{\"BM BANK JSC\", \"BM BANK AO\", \"AKTSIONERNOE OBSHCHESTVO BM BANK\",\n+ \"PAO BM BANK\", \"BANK MOSKVY PAO\", \"BANK OF MOSCOW\",\n+ \"AKTSIONERNY KOMMERCHESKI BANK BANK MOSKVY OTKRYTOE AKTSIONERNOE OBSCHCHESTVO\",\n+ \"JOINT STOCK COMMERCIAL BANK - BANK OF MOSCOW OPEN JOINT STOCK COMPANY\"},\n+ SourceInfoURL: \"http://bit.ly/2PqohAD\",\n+ IDs: []string{\"RU, 1027700159497, Registration Number\",\n+ \"RU, 29292940, Government Gazette Number\",\n+ \"MOSWRUMM, SWIFT/BIC\",\n+ \"www.bm.ru, Website\",\n+ \"Subject to Directive 1, Executive Order 13662 Directive Determination -\",\n+ \"044525219, BIK (RU)\",\n+ \"Financial Institution, Target Type\"},\n+ },\n+ }, noLogPipeliner)\n+ dtcSearcher.DTCs = precomputeCSLEntities[csl.DTC]([]*csl.DTC{\n+ {\n+ EntityID: \"d44d88d0265d93927b9ff1c13bbbb7c7db64142c\",\n+ Name: \"Yasmin Ahmed\",\n+ FederalRegisterNotice: \"69 FR 17468\",\n+ SourceListURL: \"http://bit.ly/307FuRQ\",\n+ AlternateNames: []string{\"Yasmin Tariq\", \"Fatimah Mohammad\"},\n+ SourceInfoURL: \"http://bit.ly/307FuRQ\",\n+ },\n+ }, noLogPipeliner)\n+ cmicSearcher.CMICs = precomputeCSLEntities[csl.CMIC]([]*csl.CMIC{\n+ {\n+ EntityID: \"32091\",\n+ EntityNumber: \"32091\",\n+ Type: \"Entity\",\n+ Programs: []string{\"CMIC-EO13959\"},\n+ Name: \"PROVEN HONOUR CAPITAL LIMITED\",\n+ Addresses: []string{\"C/O Vistra Corporate Services Centre, Wickhams Cay II, Road Town, VG1110, VG\"},\n+ Remarks: []string{\"(Linked To: HUAWEI INVESTMENT & HOLDING CO., LTD.)\"},\n+ SourceListURL: \"https://bit.ly/1QWTIfE\",\n+ AlternateNames: []string{\"PROVEN HONOUR CAPITAL LTD\", \"PROVEN HONOUR\"},\n+ SourceInfoURL: \"https://bit.ly/3zsMQ4n\",\n+ IDs: []string{\"Proven Honour Capital Ltd, Issuer Name\", \"Proven Honour Capital Limited, Issuer Name\", \"XS1233275194, ISIN\",\n+ \"HK0000216777, ISIN\", \"Private Company, Target Type\", \"XS1401816761, ISIN\", \"HK0000111952, ISIN\", \"03 Jun 2021, Listing Date (CMIC)\",\n+ \"02 Aug 2021, Effective Date (CMIC)\", \"03 Jun 2022, Purchase/Sales For Divestment Date (CMIC)\"},\n+ },\n+ }, noLogPipeliner)\n+ ns_mbsSearcher.NS_MBSs = precomputeCSLEntities[csl.NS_MBS]([]*csl.NS_MBS{\n+ {\n+ EntityID: \"17016\",\n+ EntityNumber: \"17016\",\n+ Type: \"Entity\",\n+ Programs: []string{\"UKRAINE-EO13662\", \"MBS\"},\n+ Name: \"GAZPROMBANK JOINT STOCK COMPANY\",\n+ Addresses: []string{\"16 Nametkina Street, Bldg. 1, Moscow, 117420, RU\"},\n+ Remarks: []string{\"For more information on directives, please visit the following link: http://www.treasury.gov/resource-center/sanctions/Programs/Pages/ukraine.aspx#directives.\"},\n+ AlternateNames: []string{\"GAZPROMBANK OPEN JOINT STOCK COMPANY\", \"BANK GPB JSC\", \"GAZPROMBANK AO\", \"JOINT STOCK BANK OF THE GAS INDUSTRY GAZPROMBANK\"},\n+ SourceInfoURL: \"https://bit.ly/2MbsybU\",\n+ IDs: []string{\"RU, 1027700167110, Registration Number\", \"RU, 09807684, Government Gazette Number\", \"RU, 7744001497, Tax ID No.\",\n+ \"www.gazprombank.ru, Website\", \"GAZPRUMM, SWIFT/BIC\", \"Subject to Directive 1, Executive Order 13662 Directive Determination -\",\n+ \"Subject to Directive 3 - All transactions in, provision of financing for, and other dealings in new debt of longer than 14 days maturity or new equity where such new debt or new equity is issued on or after the 'Effective Date (EO 14024 Directive)' associated with this name are prohibited., Executive Order 14024 Directive Information\",\n+ \"31 Jul 1990, Organization Established Date\", \"24 Feb 2022, Listing Date (EO 14024 Directive 3):\", \"26 Mar 2022, Effective Date (EO 14024 Directive 3):\",\n+ \"For more information on directives, please visit the following link: https://home.treasury.gov/policy-issues/financial-sanctions/sanctions-programs-and-country-information/russian-harmful-foreign-activities-sanctions#directives, Executive Order 14024 Directive Information -\"},\n+ },\n+ }, noLogPipeliner)\n}\nfunc createTestSearcher(t *testing.T) *searcher {\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_us_csl_test.go", "new_path": "cmd/server/search_us_csl_test.go", "diff": "@@ -7,6 +7,7 @@ package main\nimport (\n\"fmt\"\n\"math\"\n+ \"strconv\"\n\"testing\"\n\"github.com/stretchr/testify/require\"\n@@ -92,3 +93,66 @@ func TestSearcher_TopISNs(t *testing.T) {\nrequire.Equal(t, \"2d2db09c686e4829d0ef1b0b04145eec3d42cd88\", isn.Data.EntityID)\nrequire.Equal(t, \"0.92\", fmt.Sprintf(\"%.2f\", isn.match))\n}\n+\n+func TestSearcher_TopUVLs(t *testing.T) {\n+ uvls := uvlSearcher.TopUVLs(1, 0.00, \"Atlas Sanatgaran\")\n+ require.Len(t, uvls, 1)\n+\n+ uvl := uvls[0]\n+ require.Equal(t, \"f15fa805ff4ac5e09026f5e78011a1bb6b26dec2\", uvl.Data.EntityID)\n+ require.Equal(t, \"1\", strconv.Itoa(int(uvl.match)))\n+}\n+\n+func TestSearcher_TopFSEs(t *testing.T) {\n+ fses := fseSearcher.TopFSEs(1, 0.00, \"BEKTAS, Halis\")\n+ require.Len(t, fses, 1)\n+\n+ fse := fses[0]\n+ require.Equal(t, \"17526\", fse.Data.EntityID)\n+ require.Equal(t, \"1\", strconv.Itoa(int(fse.match)))\n+}\n+\n+func TestSearcher_TopPLCs(t *testing.T) {\n+ plcs := plcSearcher.TopPLCs(1, 0.00, \"SALAMEH, Salem\")\n+ require.Len(t, plcs, 1)\n+\n+ plc := plcs[0]\n+ require.Equal(t, \"9702\", plc.Data.EntityID)\n+ require.Equal(t, \"1\", strconv.Itoa(int(plc.match)))\n+}\n+\n+func TestSearcher_TopCAPs(t *testing.T) {\n+ caps := capSearcher.TopCAPs(1, 0.00, \"BM BANK PUBLIC JOINT STOCK COMPANY\")\n+ require.Len(t, caps, 1)\n+\n+ cap := caps[0]\n+ require.Equal(t, \"20002\", cap.Data.EntityID)\n+ require.Equal(t, \"1\", strconv.Itoa(int(cap.match)))\n+}\n+\n+func TestSearcher_TopDTCs(t *testing.T) {\n+ dtcs := dtcSearcher.TopDTCs(1, 0.00, \"Yasmin Ahmed\")\n+ require.Len(t, dtcs, 1)\n+\n+ dtc := dtcs[0]\n+ require.Equal(t, \"d44d88d0265d93927b9ff1c13bbbb7c7db64142c\", dtc.Data.EntityID)\n+ require.Equal(t, \"1\", strconv.Itoa(int(dtc.match)))\n+}\n+\n+func TestSearcher_TopCMICs(t *testing.T) {\n+ cmics := cmicSearcher.TopCMICs(1, 0.00, \"PROVEN HONOUR CAPITAL LIMITED\")\n+ require.Len(t, cmics, 1)\n+\n+ cmic := cmics[0]\n+ require.Equal(t, \"32091\", cmic.Data.EntityID)\n+ require.Equal(t, \"1\", strconv.Itoa(int(cmic.match)))\n+}\n+\n+func TestSearcher_TopNSMBSs(t *testing.T) {\n+ ns_mbss := ns_mbsSearcher.TopNS_MBS(1, 0.00, \"GAZPROMBANK JOINT STOCK COMPANY\")\n+ require.Len(t, ns_mbss, 1)\n+\n+ ns_mbs := ns_mbss[0]\n+ require.Equal(t, \"17016\", ns_mbs.Data.EntityID)\n+ require.Equal(t, \"1\", strconv.Itoa(int(ns_mbs.match)))\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
Added unit tests for TopN functions, to verify CSL data search.
428,971
08.11.2022 10:25:59
25,200
7d684ec1b867c61ccd5ae71791202698106e5b99
adds todos for adding eu csl data
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -50,6 +50,7 @@ func init() {\n// DownloadStats holds counts for each type of list data parsed from files and a\n// timestamp of when the download happened.\ntype DownloadStats struct {\n+ // TODO: include EU - Consolidated List of Sanctions (CLS)\n// US Office of Foreign Assets Control (OFAC)\nSDNs int `json:\"SDNs\"`\nAlts int `json:\"altNames\"`\n@@ -234,6 +235,8 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\n}\ndps := precomputeDPs(deniedPersons, s.pipe)\n+ // TODO: we need to grab the EU data here as well and save it to the struct\n+ // csl records from US downloaded here\nconsolidatedLists, err := cslRecords(s.logger, initialDir)\nif err != nil {\nlastDataRefreshFailure.WithLabelValues(\"CSL\").Set(float64(time.Now().Unix()))\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search.go", "new_path": "cmd/server/search.go", "diff": "@@ -43,6 +43,8 @@ type searcher struct {\n// BIS\nDPs []*DP\n+ // TODO: this could be refactored into sub structs that have us/eu (and eventually others)\n+\n// US Consolidated Screening List\nBISEntities []*Result[csl.EL]\nMilitaryEndUsers []*Result[csl.MEU]\n@@ -56,6 +58,8 @@ type searcher struct {\nCMICs []*Result[csl.CMIC]\nNS_MBSs []*Result[csl.NS_MBS]\n+ // EU Consolidated List of Sactions\n+\n// metadata\nlastRefreshedAt time.Time\nsync.RWMutex // protects all above fields\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -31,9 +31,11 @@ var (\n}, []string{\"type\"})\n)\n+// TODO: modify existing search endpoint with additional eu info and add an eu only endpoint\nfunc addSearchRoutes(logger log.Logger, r *mux.Router, searcher *searcher) {\nr.Methods(\"GET\").Path(\"/search\").HandlerFunc(search(logger, searcher))\nr.Methods(\"GET\").Path(\"/search/us-csl\").HandlerFunc(searchUSCSL(logger, searcher))\n+ r.Methods(\"GET\").Path(\"/search/eu-csl\").HandlerFunc(searchEUCSL(logger, searcher))\n}\nfunc extractSearchLimit(r *http.Request) int {\n@@ -260,6 +262,8 @@ func searchViaQ(logger log.Logger, searcher *searcher, name string) http.Handler\n// searchGather performs an inmem search with *searcher and mutates *searchResponse by setting a specific field\ntype searchGather func(searcher *searcher, filters filterRequest, limit int, minMatch float64, name string, resp *searchResponse)\n+// TODO: this could be refactored into function block that returns these\n+// generateAllGatherings()\nvar (\ngatherings = append([]searchGather{\n// OFAC SDN Search\n@@ -285,6 +289,7 @@ var (\n},\n}, cslGatherings...)\n+ // TODO: add a block for eu - cls\n// Consolidated Screening List Results\ncslGatherings = []searchGather{\nfunc(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n@@ -321,6 +326,8 @@ var (\nresp.NonSDNMenuBasedSanctionsList = s.TopNS_MBS(limit, minMatch, name)\n},\n}\n+\n+ euClsGatherings = []searchGather{}\n)\nfunc buildFullSearchResponse(searcher *searcher, filters filterRequest, limit int, minMatch float64, name string) *searchResponse {\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_us_csl.go", "new_path": "cmd/server/search_us_csl.go", "diff": "@@ -14,6 +14,7 @@ import (\n\"github.com/moov-io/watchman/pkg/csl\"\n)\n+// TODO: make a search EUCLS function as well; put it in a new file\nfunc searchUSCSL(logger log.Logger, searcher *searcher) http.HandlerFunc {\nreturn func(w http.ResponseWriter, r *http.Request) {\nw = wrapResponseWriter(logger, w, r)\n" }, { "change_type": "ADD", "old_path": null, "new_path": "pkg/eu/cls/cls.go", "diff": "+package eucls\n+\n+// CLS - Consolidated List Sanctions from European Union\n+// TODO: does this need to be in csl (ask Adam from moov)\n+\n+// TODO: get this from env\n+// download uri\n+// https://webgate.ec.europa.eu/fsd/fsf/public/files/csvFullSanctionsList_1_1/content?token=dG9rZW4tMjAxNw\n+// protocol: https://\n+// hostname: webgate.ec.europa.eu\n+// path: /fsd/fsf/public/files/csvFullSanctionsList_1_1/content\n+// query: ?token=dG9rZW4tMjAxNw\n+\n+// struct to hold the rows from the csv data\n+type EUCLS map[string]EUCLSRow\n+\n+type EUCLSRow struct {\n+ FileGenerationDate string\n+ Entity *Entity\n+ Address *Address\n+ BirthDate *BirthDate\n+ Identification *Identification\n+}\n+\n+type Entity struct {\n+ LogicalID int64\n+ ReferenceNumber string\n+ UnitiedNationsID string\n+ DesignationDate string\n+ DesignationDetails string\n+ Remark string\n+ SubjectType *SubjectType\n+ Regulation *Regulation\n+}\n+type SubjectType struct {\n+ SingleLetter string\n+ ClassificationCode string\n+}\n+type Regulation struct {\n+ Type string\n+ Organization string\n+ PublicationDate string\n+ EntryInfoForceDate string\n+ NumberTitle string\n+ Programme string\n+ PublicationURL string\n+}\n+\n+type NameAlias struct {\n+ LastName string\n+ FirstName string\n+ MiddleName string\n+ WholeName string\n+ NameLanguage string\n+ Gender string\n+ Title string\n+ Function string\n+ LogicalID int64\n+ RegulationLanguage string\n+ Remark string\n+ Regulation *Regulation\n+}\n+type Address struct {\n+ City string\n+ Street string\n+ PoBox string\n+ ZipCode string\n+ Region string\n+ Place string\n+ AsAtListingTime string\n+ ContactInfo string\n+ CountryIso2code string\n+ CountryDescription string\n+ LogicalID int64\n+ RegulationLanguage string\n+ Remark string\n+ Regulation *Regulation\n+}\n+type BirthDate struct {\n+ BirthDate string\n+ Day int64\n+ Month int64\n+ Year int64\n+ YearRangeFrom string\n+ YearRangeTo string\n+ Circa string\n+ CaldendarType string // TODO: this could be an enum\n+ ZipCode string\n+ Region string\n+ Place string\n+ City string\n+ CountryIso2code string\n+ CountryDescription string\n+ LogicalID int64\n+ Regulation *Regulation\n+}\n+\n+type Identification struct {\n+ Regulation *Regulation\n+ Number int64\n+ KnownExpired bool\n+ KnownFalse bool\n+ ReportedLost bool\n+ RevokedByIssuer bool\n+ LogicalID int64\n+ Diplomatic string // TODO: not sure about this field\n+ IssuedBy string\n+ IssuedDate string\n+ ValidFrom string\n+ ValidTo string\n+ NameOnDocument string\n+ TypeCode string\n+ TypeDescription string\n+ Region string\n+ CountryIso2code string\n+ CountryDescription string\n+ RegulationLanguage string\n+ Remark string\n+}\n+\n+// header indicies\n+const ()\n+\n+// TODO: need function to merge the like rows based on the Entity_LogicalId\n+func mergeRowsByLogicalID(rows []EUCLSRow) EUCLS {\n+ cls := make(EUCLS)\n+ // using a map for constant lookups (if possible)\n+ // append to the map every time a new lookup for entity logical id is found\n+ // otherwise\n+\n+ return cls\n+}\n" } ]
Go
Apache License 2.0
moov-io/watchman
adds todos for adding eu csl data Signed-off-by: diginicho <nicholas.rivera@digicert.com>
428,971
08.11.2022 14:30:26
25,200
4afd2a4d952629866cc96df5490af882c2e37ce4
comments out the search for eu-csl to qa parsing
[ { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -35,7 +35,7 @@ var (\nfunc addSearchRoutes(logger log.Logger, r *mux.Router, searcher *searcher) {\nr.Methods(\"GET\").Path(\"/search\").HandlerFunc(search(logger, searcher))\nr.Methods(\"GET\").Path(\"/search/us-csl\").HandlerFunc(searchUSCSL(logger, searcher))\n- r.Methods(\"GET\").Path(\"/search/eu-csl\").HandlerFunc(searchEUCSL(logger, searcher))\n+ // r.Methods(\"GET\").Path(\"/search/eu-csl\").HandlerFunc(searchEUCSL(logger, searcher))\n}\nfunc extractSearchLimit(r *http.Request) int {\n" } ]
Go
Apache License 2.0
moov-io/watchman
comments out the search for eu-csl to qa parsing
428,971
08.11.2022 14:42:03
25,200
2c144f8b896e890da597ac2b8c556229a461584f
adds some blocks for including euCSL record grabbing on initial load in refresh data function
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -201,6 +201,20 @@ func cslRecords(logger log.Logger, initialDir string) (*csl.CSL, error) {\nreturn cslRecords, err\n}\n+func euCSLRecords(logger log.Logger, initialDir string) (csl.EUCSL, error) {\n+ file, err := csl.DownloadEU(logger, initialDir)\n+ if err != nil {\n+ logger.Warn().LogErrorf(\"skipping CSL download: %v\", err)\n+ // no error to return because we skip the download\n+ return nil, nil\n+ }\n+ cslRecords, err := csl.ReadEUFile(file)\n+ if err != nil {\n+ return nil, err\n+ }\n+ return cslRecords, err\n+}\n+\n// refreshData reaches out to the various websites to download the latest\n// files, runs each list's parser, and index data for searches.\nfunc (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\n@@ -236,6 +250,11 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\ndps := precomputeDPs(deniedPersons, s.pipe)\n// TODO: we need to grab the EU data here as well and save it to the struct\n+ euCSL, err := euCSLRecords(s.logger, initialDir)\n+ if err != nil {\n+ lastDataRefreshFailure.WithLabelValues(\"EUCSL\").Set(float64(time.Now().Unix()))\n+ stats.Errors = append(stats.Errors, fmt.Errorf(\"EUCSL: %v\", err))\n+ }\n// csl records from US downloaded here\nconsolidatedLists, err := cslRecords(s.logger, initialDir)\nif err != nil {\n@@ -273,6 +292,8 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nstats.ChineseMilitaryIndustrialComplex = len(cmics)\nstats.NonSDNMenuBasedSanctions = len(ns_mbss)\n+ stats.EUCSL = len(euCSL)\n+\n// record prometheus metrics\nlastDataRefreshCount.WithLabelValues(\"SDNs\").Set(float64(len(sdns)))\nlastDataRefreshCount.WithLabelValues(\"SSIs\").Set(float64(len(ssis)))\n@@ -288,6 +309,8 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nlastDataRefreshCount.WithLabelValues(\"CMICs\").Set(float64(len(cmics)))\nlastDataRefreshCount.WithLabelValues(\"NS_MBSs\").Set(float64(len(ns_mbss)))\n+ lastDataRefreshCount.WithLabelValues(\"EUCSL\").Set(float64(len(euCSL)))\n+\nif len(stats.Errors) > 0 {\nreturn stats, stats\n}\n@@ -312,6 +335,8 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\ns.DTCs = dtcs\ns.CMICs = cmics\ns.NS_MBSs = ns_mbss\n+ //EUCSL\n+ s.EUCSL = euCSL\n// metadata\ns.lastRefreshedAt = stats.RefreshedAt\ns.Unlock()\n" } ]
Go
Apache License 2.0
moov-io/watchman
adds some blocks for including euCSL record grabbing on initial load in refresh data function
428,971
08.11.2022 14:59:04
25,200
bc69ce521a4085270aebd5d13991071524c16569
adds some more todos and adds downloading the eu_csl.csv to the refreshData func
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -250,7 +250,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\ndps := precomputeDPs(deniedPersons, s.pipe)\n// TODO: we need to grab the EU data here as well and save it to the struct\n- euCSL, err := euCSLRecords(s.logger, initialDir)\n+ _, err = euCSLRecords(s.logger, initialDir)\nif err != nil {\nlastDataRefreshFailure.WithLabelValues(\"EUCSL\").Set(float64(time.Now().Unix()))\nstats.Errors = append(stats.Errors, fmt.Errorf(\"EUCSL: %v\", err))\n@@ -292,7 +292,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nstats.ChineseMilitaryIndustrialComplex = len(cmics)\nstats.NonSDNMenuBasedSanctions = len(ns_mbss)\n- stats.EUCSL = len(euCSL)\n+ // stats.EUCSL = len(euCSL)\n// record prometheus metrics\nlastDataRefreshCount.WithLabelValues(\"SDNs\").Set(float64(len(sdns)))\n@@ -309,7 +309,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nlastDataRefreshCount.WithLabelValues(\"CMICs\").Set(float64(len(cmics)))\nlastDataRefreshCount.WithLabelValues(\"NS_MBSs\").Set(float64(len(ns_mbss)))\n- lastDataRefreshCount.WithLabelValues(\"EUCSL\").Set(float64(len(euCSL)))\n+ // lastDataRefreshCount.WithLabelValues(\"EUCSL\").Set(float64(len(euCSL)))\nif len(stats.Errors) > 0 {\nreturn stats, stats\n@@ -336,7 +336,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\ns.CMICs = cmics\ns.NS_MBSs = ns_mbss\n//EUCSL\n- s.EUCSL = euCSL\n+ // s.EUCSL = euCSL\n// metadata\ns.lastRefreshedAt = stats.RefreshedAt\ns.Unlock()\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/download_eu.go", "new_path": "pkg/csl/download_eu.go", "diff": "@@ -13,8 +13,10 @@ import (\n\"github.com/moov-io/watchman/pkg/download\"\n)\n+// where can I get a new token from?\nconst uri = \"https://webgate.ec.europa.eu/fsd/fsf/public/files/csvFullSanctionsList_1_1/content?token=dG9rZW4tMjAxNw\"\n+// TODO: env???\nvar (\neuCSLDownloadTemplate = func() string {\nif w := os.Getenv(\"EU_CSL_DOWNLOAD_TEMPLATE\"); w != \"\" {\n" } ]
Go
Apache License 2.0
moov-io/watchman
adds some more todos and adds downloading the eu_csl.csv to the refreshData func
428,971
09.11.2022 15:02:57
25,200
497e2884624198cf64f650b35b567da0f1b42473
refactors 1 to many into 1:1 on eu csl by merging fields on one record into arrays
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -50,7 +50,6 @@ func init() {\n// DownloadStats holds counts for each type of list data parsed from files and a\n// timestamp of when the download happened.\ntype DownloadStats struct {\n- // TODO: include EU - Consolidated List of Sanctions (CLS)\n// US Office of Foreign Assets Control (OFAC)\nSDNs int `json:\"SDNs\"`\nAlts int `json:\"altNames\"`\n@@ -72,6 +71,9 @@ type DownloadStats struct {\nChineseMilitaryIndustrialComplex int `json:\"chineseMilitaryIndustrialComplex\"`\nNonSDNMenuBasedSanctions int `json:\"nonSDNMenuBasedSanctions\"`\n+ // EU Consolidated Sanctions List\n+ EUCSL int `json:\"EuropeanSanctionsList\"`\n+\nErrors []error `json:\"-\"`\nRefreshedAt time.Time `json:\"timestamp\"`\n}\n@@ -201,7 +203,7 @@ func cslRecords(logger log.Logger, initialDir string) (*csl.CSL, error) {\nreturn cslRecords, err\n}\n-func euCSLRecords(logger log.Logger, initialDir string) (csl.EUCSL, error) {\n+func euCSLRecords(logger log.Logger, initialDir string) ([]*csl.EUCSLRow, error) {\nfile, err := csl.DownloadEU(logger, initialDir)\nif err != nil {\nlogger.Warn().LogErrorf(\"skipping CSL download: %v\", err)\n@@ -249,12 +251,13 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\n}\ndps := precomputeDPs(deniedPersons, s.pipe)\n- // TODO: we need to grab the EU data here as well and save it to the struct\n- _, err = euCSLRecords(s.logger, initialDir)\n+ euConsolidatedList, err := euCSLRecords(s.logger, initialDir)\nif err != nil {\nlastDataRefreshFailure.WithLabelValues(\"EUCSL\").Set(float64(time.Now().Unix()))\nstats.Errors = append(stats.Errors, fmt.Errorf(\"EUCSL: %v\", err))\n}\n+ euCSLs := precomputeCSLEntities[csl.EUCSLRow](euConsolidatedList, s.pipe)\n+\n// csl records from US downloaded here\nconsolidatedLists, err := cslRecords(s.logger, initialDir)\nif err != nil {\n@@ -292,7 +295,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nstats.ChineseMilitaryIndustrialComplex = len(cmics)\nstats.NonSDNMenuBasedSanctions = len(ns_mbss)\n- // stats.EUCSL = len(euCSL)\n+ stats.EUCSL = len(euCSLs)\n// record prometheus metrics\nlastDataRefreshCount.WithLabelValues(\"SDNs\").Set(float64(len(sdns)))\n@@ -309,7 +312,8 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nlastDataRefreshCount.WithLabelValues(\"CMICs\").Set(float64(len(cmics)))\nlastDataRefreshCount.WithLabelValues(\"NS_MBSs\").Set(float64(len(ns_mbss)))\n- // lastDataRefreshCount.WithLabelValues(\"EUCSL\").Set(float64(len(euCSL)))\n+ // EU CSL\n+ lastDataRefreshCount.WithLabelValues(\"EUCSL\").Set(float64(len(euCSLs)))\nif len(stats.Errors) > 0 {\nreturn stats, stats\n@@ -336,7 +340,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\ns.CMICs = cmics\ns.NS_MBSs = ns_mbss\n//EUCSL\n- // s.EUCSL = euCSL\n+ s.EUCSL = euCSLs\n// metadata\ns.lastRefreshedAt = stats.RefreshedAt\ns.Unlock()\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search.go", "new_path": "cmd/server/search.go", "diff": "@@ -59,6 +59,7 @@ type searcher struct {\nNS_MBSs []*Result[csl.NS_MBS]\n// EU Consolidated List of Sactions\n+ EUCSL []*Result[csl.EUCSLRow]\n// metadata\nlastRefreshedAt time.Time\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -170,6 +170,9 @@ type searchResponse struct {\nNonSDNChineseMilitaryIndustrialComplex []*Result[csl.CMIC] `json:\"nonSDNChineseMilitaryIndustrialComplex\"`\nNonSDNMenuBasedSanctionsList []*Result[csl.NS_MBS] `json:\"nonSDNMenuBasedSanctionsList\"`\n+ // EU - Consolidated Sanctions List\n+ EUCSL []*Result[csl.EUCSLRow] `json:\"euConsolidatedSanctionsList\"`\n+\n// Metadata\nRefreshedAt time.Time `json:\"refreshedAt\"`\n}\n@@ -262,10 +265,8 @@ func searchViaQ(logger log.Logger, searcher *searcher, name string) http.Handler\n// searchGather performs an inmem search with *searcher and mutates *searchResponse by setting a specific field\ntype searchGather func(searcher *searcher, filters filterRequest, limit int, minMatch float64, name string, resp *searchResponse)\n-// TODO: this could be refactored into function block that returns these\n-// generateAllGatherings()\nvar (\n- gatherings = append([]searchGather{\n+ gatherings = []searchGather{\n// OFAC SDN Search\nfunc(s *searcher, filters filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\nsdns := s.FindSDNsByRemarksID(limit, name)\n@@ -287,9 +288,8 @@ var (\nfunc(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\nresp.DeniedPersons = s.TopDPs(limit, minMatch, name)\n},\n- }, cslGatherings...)\n+ }\n- // TODO: add a block for eu - cls\n// Consolidated Screening List Results\ncslGatherings = []searchGather{\nfunc(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n@@ -327,11 +327,22 @@ var (\n},\n}\n- euClsGatherings = []searchGather{}\n+ // eu - consolidated sanctions list\n+ euGatherings = []searchGather{\n+ func(s *searcher, _ filterRequest, limit int, minMatch float64, name string, resp *searchResponse) {\n+ resp.EUCSL = s.TopEUCSL(limit, minMatch, name)\n+ },\n+ }\n)\n+func generateAllGatherings() []searchGather {\n+ gatherings = append(gatherings, cslGatherings...)\n+ gatherings = append(gatherings, euGatherings...)\n+ return gatherings\n+}\n+\nfunc buildFullSearchResponse(searcher *searcher, filters filterRequest, limit int, minMatch float64, name string) *searchResponse {\n- return buildFullSearchResponseWith(searcher, gatherings, filters, limit, minMatch, name)\n+ return buildFullSearchResponseWith(searcher, generateAllGatherings(), filters, limit, minMatch, name)\n}\nfunc buildFullSearchResponseWith(searcher *searcher, searchGatherings []searchGather, filters filterRequest, limit int, minMatch float64, name string) *searchResponse {\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_test.go", "new_path": "cmd/server/search_test.go", "diff": "@@ -46,6 +46,8 @@ var (\ndtcSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\ncmicSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\nns_mbsSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\n+\n+ eu_cslSearcher = newSearcher(log.NewNopLogger(), noLogPipeliner, 1)\n)\nfunc init() {\n@@ -327,6 +329,49 @@ func init() {\n\"For more information on directives, please visit the following link: https://home.treasury.gov/policy-issues/financial-sanctions/sanctions-programs-and-country-information/russian-harmful-foreign-activities-sanctions#directives, Executive Order 14024 Directive Information -\"},\n},\n}, noLogPipeliner)\n+\n+ eu_cslSearcher.EUCSL = precomputeCSLEntities[csl.EUCSLRow]([]*csl.EUCSLRow{\n+ {\n+ FileGenerationDate: \"28/10/2022\",\n+ Entity: &csl.Entity{\n+ LogicalID: 13,\n+ ReferenceNumber: \"EU.27.28\",\n+ Remark: \"(UNSC RESOLUTION 1483)\",\n+ SubjectType: &csl.SubjectType{\n+ ClassificationCode: \"person\",\n+ },\n+ Regulation: &csl.Regulation{\n+ PublicationURL: \"http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=OJ:L:2003:169:0006:0023:EN:PDF\",\n+ },\n+ },\n+ NameAliases: []*csl.NameAlias{{\n+ WholeName: \"Saddam Hussein Al-Tikriti\",\n+ Title: \"\",\n+ }, {\n+ WholeName: \"Abu Ali\",\n+ Title: \"\",\n+ }, {\n+ WholeName: \"Abou Ali\",\n+ Title: \"\",\n+ }},\n+ Addresses: []*csl.Address{{\n+ City: \"test city\",\n+ Street: \"test street\",\n+ PoBox: \"test po box\",\n+ ZipCode: \"test zip\",\n+ CountryDescription: \"test country\",\n+ }},\n+ BirthDates: []*csl.BirthDate{{\n+ BirthDate: \"1937-04-28\",\n+ City: \"al-Awja, near Tikrit\",\n+ CountryDescription: \"IRAQ\",\n+ }},\n+ Identifications: []*csl.Identification{{\n+ ValidFrom: \"2002\",\n+ ValidTo: \"2032\",\n+ }},\n+ },\n+ }, noLogPipeliner)\n}\nfunc createTestSearcher(t *testing.T) *searcher {\n@@ -381,6 +426,9 @@ func verifyDownloadStats(b *testing.B) {\nrequire.Greater(b, testSearcherStats.ITARDebarred, 1)\nrequire.Greater(b, testSearcherStats.ChineseMilitaryIndustrialComplex, 1)\nrequire.Greater(b, testSearcherStats.NonSDNMenuBasedSanctions, 1)\n+\n+ // EU - CSL\n+ require.Greater(b, testSearcherStats.EUCSL, 1)\n}\nfunc TestJaroWinkler(t *testing.T) {\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_us_csl.go", "new_path": "cmd/server/search_us_csl.go", "diff": "@@ -198,3 +198,14 @@ func (s *searcher) TopNS_MBS(limit int, minMatch float64, name string) []*Result\nreturn topResults[csl.NS_MBS](limit, minMatch, name, s.NS_MBSs)\n}\n+\n+// TopEUCSL searches the Non-SDN Menu Based Sanctions list by Name and Alias\n+func (s *searcher) TopEUCSL(limit int, minMatch float64, name string) []*Result[csl.EUCSLRow] {\n+ s.RLock()\n+ defer s.RUnlock()\n+\n+ s.Gate.Start()\n+ defer s.Gate.Done()\n+\n+ return topResults[csl.EUCSLRow](limit, minMatch, name, s.EUCSL)\n+}\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/eu_csl.go", "new_path": "pkg/csl/eu_csl.go", "diff": "@@ -12,15 +12,17 @@ package csl\n// query: ?token=dG9rZW4tMjAxNw\n// struct to hold the rows from the csv data\n-type EUCSL map[int][]*EUCSLRow\n+type EUCSL map[int]*EUCSLRow\n+\n+// type EUCSLSheet []*EUCSLRow\ntype EUCSLRow struct {\nFileGenerationDate string\nEntity *Entity\n- NameAlias *NameAlias\n- Address *Address\n- BirthDate *BirthDate\n- Identification *Identification\n+ NameAliases []*NameAlias\n+ Addresses []*Address\n+ BirthDates []*BirthDate\n+ Identifications []*Identification\n}\ntype Entity struct {\n@@ -150,10 +152,10 @@ func NewEUCSLRow() *EUCSLRow {\nrow.Entity = new(Entity)\nrow.Entity.SubjectType = new(SubjectType)\nrow.Entity.Regulation = new(Regulation)\n- row.NameAlias = new(NameAlias)\n- row.Address = new(Address)\n- row.BirthDate = new(BirthDate)\n- row.Identification = new(Identification)\n+ row.NameAliases = make([]*NameAlias, 0)\n+ row.Addresses = make([]*Address, 0)\n+ row.BirthDates = make([]*BirthDate, 0)\n+ row.Identifications = make([]*Identification, 0)\nreturn row\n}\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader_eu.go", "new_path": "pkg/csl/reader_eu.go", "diff": "@@ -9,7 +9,7 @@ import (\n\"strconv\"\n)\n-func ReadEUFile(path string) (EUCSL, error) {\n+func ReadEUFile(path string) ([]*EUCSLRow, error) {\nfd, err := os.Open(path)\nif err != nil {\nreturn nil, err\n@@ -19,7 +19,7 @@ func ReadEUFile(path string) (EUCSL, error) {\nreturn ParseEU(fd)\n}\n-func ParseEU(r io.Reader) (EUCSL, error) {\n+func ParseEU(r io.Reader) ([]*EUCSLRow, error) {\nreader := csv.NewReader(r)\nreader.Comma = ';'\n@@ -28,7 +28,8 @@ func ParseEU(r io.Reader) (EUCSL, error) {\nif err != nil {\nfmt.Println(\"we made an oopsie: \", err)\n}\n- for {\n+ // TODO: change this back to while\n+ for i := 0; i <= 4; i++ {\nrecord, err := reader.Read()\nif err != nil {\n// reached the last line\n@@ -51,42 +52,209 @@ func ParseEU(r io.Reader) (EUCSL, error) {\n// merge rows at this point\n// for each record we need to add that to the map\nlogicalID, _ := strconv.Atoi(record[EntityLogicalIdx])\n- row, err := unmarshalEUCSLRow(record)\n- if err != nil {\n- return nil, err\n- }\n-\n// check if entry does not exist\n- report[logicalID] = append(report[logicalID], row)\n+ if val, ok := report[logicalID]; !ok {\n+ fmt.Println(\"unmarshalling first row\")\n+ row := unmarshalFirstEUCSLRow(record)\n+ report[logicalID] = row\n+ } else {\n+ // we found an entry in the map and need to append\n+ fmt.Println(\"unmarshalling next row\")\n+ unmarshalNextEUCSLRow(record, val)\n}\n- return report, nil\n+\n+ }\n+ var totalReport []*EUCSLRow\n+ for _, row := range report {\n+ totalReport = append(totalReport, row)\n+ }\n+ return totalReport, nil\n}\n-func unmarshalEUCSLRow(csvRecord []string) (*EUCSLRow, error) {\n+func unmarshalFirstEUCSLRow(csvRecord []string) *EUCSLRow {\nrow := NewEUCSLRow()\nrow.FileGenerationDate = csvRecord[FileGenerationDateIdx]\nrow.Entity.ReferenceNumber = csvRecord[ReferenceNumberIdx]\n+ row.Entity.LogicalID, _ = strconv.Atoi(csvRecord[EntityLogicalIdx])\nrow.Entity.Remark = csvRecord[EntityRemarkIdx]\nrow.Entity.SubjectType.ClassificationCode = csvRecord[EntitySubjectTypeIdx]\nrow.Entity.Regulation.PublicationURL = csvRecord[EntityRegulationPublicationURLIdx]\n- row.NameAlias.WholeName = csvRecord[NameAliasWholeNameIdx]\n- row.NameAlias.Title = csvRecord[NameAliasTitleIdx]\n+ var newNameAlias *NameAlias\n+ if csvRecord[NameAliasWholeNameIdx] != \"\" {\n+ newNameAlias = new(NameAlias)\n+ newNameAlias.WholeName = csvRecord[NameAliasWholeNameIdx]\n+ }\n+ if csvRecord[NameAliasTitleIdx] != \"\" {\n+ if newNameAlias == nil {\n+ newNameAlias = new(NameAlias)\n+ }\n+ newNameAlias.Title = csvRecord[NameAliasTitleIdx]\n+ }\n+ row.NameAliases = append(row.NameAliases, newNameAlias)\n+\n+ var newAddress *Address\n+ if csvRecord[AddressCityIdx] != \"\" {\n+ newAddress = new(Address)\n+ newAddress.City = csvRecord[AddressCityIdx]\n+ }\n+ if csvRecord[AddressStreetIdx] != \"\" {\n+ if newAddress == nil {\n+ newAddress = new(Address)\n+ }\n+ newAddress.Street = csvRecord[AddressStreetIdx]\n+ }\n+ if csvRecord[AddressPoBoxIdx] != \"\" {\n+ if newAddress == nil {\n+ newAddress = new(Address)\n+ }\n+ newAddress.PoBox = csvRecord[AddressPoBoxIdx]\n+ }\n+ if csvRecord[AddressZipCodeIdx] != \"\" {\n+ if newAddress == nil {\n+ newAddress = new(Address)\n+ }\n+ newAddress.ZipCode = csvRecord[AddressZipCodeIdx]\n+ }\n+ if csvRecord[AddressCountryDescriptionIdx] != \"\" {\n+ if newAddress == nil {\n+ newAddress = new(Address)\n+ }\n+ newAddress.CountryDescription = csvRecord[AddressCountryDescriptionIdx]\n+ }\n+ if newAddress != nil {\n+ row.Addresses = append(row.Addresses, newAddress)\n+ }\n+\n+ var newBirthDate *BirthDate\n+ if csvRecord[BirthDateIdx] != \"\" {\n+ newBirthDate = new(BirthDate)\n+ newBirthDate.BirthDate = csvRecord[BirthDateIdx]\n+ }\n+ if csvRecord[BirthDateCityIdx] != \"\" {\n+ if newBirthDate == nil {\n+ newBirthDate = new(BirthDate)\n+ }\n+ newBirthDate.City = csvRecord[BirthDateCityIdx]\n+ }\n+ if csvRecord[BirthDateCountryIdx] != \"\" {\n+ if newBirthDate == nil {\n+ newBirthDate = new(BirthDate)\n+ }\n+ newBirthDate.CountryDescription = csvRecord[BirthDateCountryIdx]\n+ }\n+ if newBirthDate != nil {\n+ row.BirthDates = append(row.BirthDates, newBirthDate)\n+ }\n+\n+ var newIdentification *Identification\n+ if csvRecord[IdentificationValidFromIdx] != \"\" {\n+ newIdentification = new(Identification)\n+ newIdentification.ValidFrom = csvRecord[IdentificationValidFromIdx]\n+ }\n+ if csvRecord[IdentificationValidToIdx] != \"\" {\n+ if newIdentification == nil {\n+ newIdentification = new(Identification)\n+ }\n+ newIdentification.ValidTo = csvRecord[IdentificationValidToIdx]\n+ }\n+ if newIdentification != nil {\n+ row.Identifications = append(row.Identifications, newIdentification)\n+ }\n+\n+ return row\n+}\n- row.Address.City = csvRecord[AddressCityIdx]\n- row.Address.Street = csvRecord[AddressStreetIdx]\n- row.Address.PoBox = csvRecord[AddressPoBoxIdx]\n- row.Address.ZipCode = csvRecord[AddressZipCodeIdx]\n- row.Address.CountryDescription = csvRecord[AddressCountryDescriptionIdx]\n+func unmarshalNextEUCSLRow(csvRecord []string, row *EUCSLRow) {\n- row.BirthDate.BirthDate = csvRecord[BirthDateIdx]\n- row.BirthDate.City = csvRecord[BirthDateCityIdx]\n- row.BirthDate.CountryDescription = csvRecord[BirthDateCountryIdx]\n+ // NameAlias\n+ var newNameAlias *NameAlias\n+ if csvRecord[NameAliasWholeNameIdx] != \"\" {\n+ newNameAlias = new(NameAlias)\n+ newNameAlias.WholeName = csvRecord[NameAliasWholeNameIdx]\n+ }\n+ if csvRecord[NameAliasTitleIdx] != \"\" {\n+ if newNameAlias == nil {\n+ newNameAlias = new(NameAlias)\n+ }\n+ newNameAlias.Title = csvRecord[NameAliasTitleIdx]\n+ }\n+ if newNameAlias != nil {\n+ row.NameAliases = append(row.NameAliases, newNameAlias)\n+ }\n- row.Identification.ValidFrom = csvRecord[IdentificationValidFromIdx]\n- row.Identification.ValidTo = csvRecord[IdentificationValidToIdx]\n+ // Address\n+ var newAddress *Address\n+ if csvRecord[AddressCityIdx] != \"\" {\n+ newAddress = new(Address)\n+ newAddress.City = csvRecord[AddressCityIdx]\n+ }\n+ if csvRecord[AddressStreetIdx] != \"\" {\n+ if newAddress == nil {\n+ newAddress = &Address{}\n+ }\n+ newAddress.Street = csvRecord[AddressStreetIdx]\n+ }\n+ if csvRecord[AddressPoBoxIdx] != \"\" {\n+ if newAddress == nil {\n+ newAddress = &Address{}\n+ }\n+ newAddress.PoBox = csvRecord[AddressPoBoxIdx]\n+ }\n+ if csvRecord[AddressZipCodeIdx] != \"\" {\n+ if newAddress == nil {\n+ newAddress.ZipCode = csvRecord[AddressZipCodeIdx]\n+ }\n+ newAddress.ZipCode = csvRecord[AddressZipCodeIdx]\n+ }\n+ if csvRecord[AddressCountryDescriptionIdx] != \"\" {\n+ if newAddress == nil {\n+ newAddress = &Address{}\n+ }\n+ newAddress.CountryDescription = csvRecord[AddressCountryDescriptionIdx]\n+ }\n+ if newAddress != nil {\n+ row.Addresses = append(row.Addresses, newAddress)\n+ }\n- return row, nil\n+ // BirthDate\n+ var newBirthDate *BirthDate\n+ if csvRecord[BirthDateIdx] != \"\" {\n+ newBirthDate = new(BirthDate)\n+ newBirthDate.BirthDate = csvRecord[BirthDateIdx]\n+ }\n+ if csvRecord[BirthDateCityIdx] != \"\" {\n+ if newBirthDate == nil {\n+ newBirthDate = new(BirthDate)\n+ }\n+ newBirthDate.City = csvRecord[BirthDateCityIdx]\n+ }\n+ if csvRecord[BirthDateCountryIdx] != \"\" {\n+ if newBirthDate == nil {\n+ newBirthDate = new(BirthDate)\n+ }\n+ newBirthDate.CountryDescription = csvRecord[BirthDateCountryIdx]\n+ }\n+ if newBirthDate != nil {\n+ row.BirthDates = append(row.BirthDates, newBirthDate)\n+ }\n+\n+ var newIdentification *Identification\n+ if csvRecord[IdentificationValidFromIdx] != \"\" {\n+ newIdentification = new(Identification)\n+ newIdentification.ValidFrom = csvRecord[IdentificationValidFromIdx]\n+ }\n+\n+ if csvRecord[IdentificationValidToIdx] != \"\" {\n+ if newIdentification == nil {\n+ newIdentification = new(Identification)\n+ }\n+ newIdentification.ValidTo = csvRecord[IdentificationValidToIdx]\n+ }\n+\n+ if newIdentification != nil {\n+ row.Identifications = append(row.Identifications, newIdentification)\n+ }\n}\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader_eu_test.go", "new_path": "pkg/csl/reader_eu_test.go", "diff": "@@ -18,7 +18,6 @@ func TestReadEU(t *testing.T) {\ntestLogicalID := 13\n- // TODO: add tests for failure cases\nif euCSL[testLogicalID] == nil {\nt.Fatalf(\"expected a record at %d and got nil\", testLogicalID)\n}\n@@ -35,51 +34,41 @@ func TestReadEU(t *testing.T) {\nexpectedNameAliasTitle := \"\"\n// Address\n- expectedAddressCity := \"\"\n- expectedAddressStreet := \"\"\n- expectedAddressPoBox := \"\"\n- expectedAddressZipCode := \"\"\n- expectedAddressCountryDescription := \"\"\n+ // No address found for this record\nexpectedBirthDate := \"1937-04-28\"\nexpectedBirthCity := \"al-Awja, near Tikrit\"\nexpectedBirthCountryDescription := \"IRAQ\"\nassert.Greater(t, len(euCSL), 0)\n- assert.Greater(t, len(euCSL[testLogicalID]), 0)\n- assert.NotNil(t, euCSL[testLogicalID][0].Entity)\n- assert.NotNil(t, euCSL[testLogicalID][0].NameAlias)\n- assert.NotNil(t, euCSL[testLogicalID][0].Address)\n- assert.NotNil(t, euCSL[testLogicalID][0].BirthDate)\n- assert.NotNil(t, euCSL[testLogicalID][0].Identification)\n+ assert.NotNil(t, euCSL[testLogicalID].Entity)\n+ assert.NotNil(t, euCSL[testLogicalID].NameAliases)\n+ assert.NotNil(t, euCSL[testLogicalID].Addresses)\n+ assert.NotNil(t, euCSL[testLogicalID].BirthDates)\n+ assert.NotNil(t, euCSL[testLogicalID].Identifications)\n- assert.Equal(t, euCSL[testLogicalID][0].FileGenerationDate, expectedFileGenerationDate)\n+ assert.Equal(t, euCSL[testLogicalID].FileGenerationDate, expectedFileGenerationDate)\n// Entity\n- assert.Equal(t, euCSL[testLogicalID][0].Entity.ReferenceNumber, expectedReferenceNumber)\n- assert.Equal(t, euCSL[testLogicalID][0].Entity.Remark, expectedEntityRemark)\n- assert.Equal(t, euCSL[testLogicalID][0].Entity.SubjectType.ClassificationCode, expectedClassificationCode)\n- assert.Equal(t, euCSL[testLogicalID][0].Entity.Regulation.PublicationURL, expectedPublicationURL)\n+ assert.Equal(t, euCSL[testLogicalID].Entity.ReferenceNumber, expectedReferenceNumber)\n+ assert.Equal(t, euCSL[testLogicalID].Entity.Remark, expectedEntityRemark)\n+ assert.Equal(t, euCSL[testLogicalID].Entity.SubjectType.ClassificationCode, expectedClassificationCode)\n+ assert.Equal(t, euCSL[testLogicalID].Entity.Regulation.PublicationURL, expectedPublicationURL)\n// Name Alias\n- assert.Equal(t, euCSL[testLogicalID][0].NameAlias.WholeName, expectedNameAliasWholeName1)\n- assert.Equal(t, euCSL[testLogicalID][1].NameAlias.WholeName, expectedNameAliasWholeName2)\n- assert.Equal(t, euCSL[testLogicalID][2].NameAlias.WholeName, expectedNameAliasWholeName3)\n- assert.Equal(t, euCSL[testLogicalID][0].NameAlias.Title, expectedNameAliasTitle)\n+ assert.Equal(t, euCSL[testLogicalID].NameAliases[0].WholeName, expectedNameAliasWholeName1)\n+ assert.Equal(t, euCSL[testLogicalID].NameAliases[1].WholeName, expectedNameAliasWholeName2)\n+ assert.Equal(t, euCSL[testLogicalID].NameAliases[2].WholeName, expectedNameAliasWholeName3)\n+ assert.Equal(t, euCSL[testLogicalID].NameAliases[0].Title, expectedNameAliasTitle)\n// Address\n- assert.Equal(t, euCSL[testLogicalID][0].Address.City, expectedAddressCity)\n- assert.Equal(t, euCSL[testLogicalID][0].Address.Street, expectedAddressStreet)\n- assert.Equal(t, euCSL[testLogicalID][0].Address.PoBox, expectedAddressPoBox)\n- assert.Equal(t, euCSL[testLogicalID][0].Address.ZipCode, expectedAddressZipCode)\n- assert.Equal(t, euCSL[testLogicalID][0].Address.CountryDescription, expectedAddressCountryDescription)\n+ assert.Len(t, euCSL[testLogicalID].Addresses, 0)\n// BirthDate\n- assert.Equal(t, euCSL[testLogicalID][3].BirthDate.BirthDate, expectedBirthDate)\n- assert.Equal(t, euCSL[testLogicalID][3].BirthDate.City, expectedBirthCity)\n- assert.Equal(t, euCSL[testLogicalID][3].BirthDate.CountryDescription, expectedBirthCountryDescription)\n+ assert.Equal(t, euCSL[testLogicalID].BirthDates[0].BirthDate, expectedBirthDate)\n+ assert.Equal(t, euCSL[testLogicalID].BirthDates[0].City, expectedBirthCity)\n+ assert.Equal(t, euCSL[testLogicalID].BirthDates[0].CountryDescription, expectedBirthCountryDescription)\n// Identification\n- assert.Equal(t, euCSL[testLogicalID][0].Identification.ValidFrom, \"\")\n- assert.Equal(t, euCSL[testLogicalID][0].Identification.ValidTo, \"\")\n+ assert.Len(t, euCSL[testLogicalID].Identifications, 0)\n}\n" } ]
Go
Apache License 2.0
moov-io/watchman
refactors 1 to many into 1:1 on eu csl by merging fields on one record into arrays
428,971
10.11.2022 13:48:56
25,200
6c4e9aab0edcd142598e54294f96fdfec5f7de0a
adds some fixes around downloading eu csl datasheet
[ { "change_type": "MODIFY", "old_path": "cmd/server/download.go", "new_path": "cmd/server/download.go", "diff": "@@ -139,6 +139,7 @@ func (s *searcher) periodicDataRefresh(interval time.Duration, downloadRepo down\n\"DTC\": log.Int(stats.ITARDebarred),\n\"CMIC\": log.Int(stats.ChineseMilitaryIndustrialComplex),\n\"NS_MBS\": log.Int(stats.NonSDNMenuBasedSanctions),\n+ \"EU_CSL\": log.Int(stats.EUCSL),\n}).Logf(\"data refreshed %v ago\", time.Since(stats.RefreshedAt))\n}\nupdates <- stats // send stats for re-search and watch notifications\n@@ -210,7 +211,7 @@ func euCSLRecords(logger log.Logger, initialDir string) ([]*csl.EUCSLRow, error)\n// no error to return because we skip the download\nreturn nil, nil\n}\n- cslRecords, err := csl.ReadEUFile(file)\n+ cslRecords, _, err := csl.ReadEUFile(file)\nif err != nil {\nreturn nil, err\n}\n@@ -256,6 +257,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nlastDataRefreshFailure.WithLabelValues(\"EUCSL\").Set(float64(time.Now().Unix()))\nstats.Errors = append(stats.Errors, fmt.Errorf(\"EUCSL: %v\", err))\n}\n+\neuCSLs := precomputeCSLEntities[csl.EUCSLRow](euConsolidatedList, s.pipe)\n// csl records from US downloaded here\n@@ -294,7 +296,7 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nstats.ITARDebarred = len(dtcs)\nstats.ChineseMilitaryIndustrialComplex = len(cmics)\nstats.NonSDNMenuBasedSanctions = len(ns_mbss)\n-\n+ // EU - CSL\nstats.EUCSL = len(euCSLs)\n// record prometheus metrics\n@@ -311,7 +313,6 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) {\nlastDataRefreshCount.WithLabelValues(\"DTCs\").Set(float64(len(dtcs)))\nlastDataRefreshCount.WithLabelValues(\"CMICs\").Set(float64(len(cmics)))\nlastDataRefreshCount.WithLabelValues(\"NS_MBSs\").Set(float64(len(ns_mbss)))\n-\n// EU CSL\nlastDataRefreshCount.WithLabelValues(\"EUCSL\").Set(float64(len(euCSLs)))\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/main.go", "new_path": "cmd/server/main.go", "diff": "@@ -173,6 +173,7 @@ func main() {\n\"DTC\": log.Int(stats.ITARDebarred),\n\"CMIC\": log.Int(stats.ChineseMilitaryIndustrialComplex),\n\"NS_MBS\": log.Int(stats.NonSDNMenuBasedSanctions),\n+ \"EU_CSL\": log.Int(stats.EUCSL),\n}).Logf(\"data refreshed %v ago\", time.Since(stats.RefreshedAt))\n}\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/pipeline.go", "new_path": "cmd/server/pipeline.go", "diff": "@@ -36,6 +36,8 @@ type Name struct {\ncmic *csl.CMIC\nns_mbs *csl.NS_MBS\n+ eu_csl *csl.EUCSLRow\n+\ndp *dpl.DPL\nel *csl.EL\naddrs []*ofac.Address\n@@ -142,6 +144,21 @@ func cslName(item interface{}) *Name {\nns_mbs: v,\naltNames: v.AlternateNames,\n}\n+ case *csl.EUCSLRow:\n+ if len(v.NameAliases) >= 1 {\n+ var alts []string\n+ for _, nameAlias := range v.NameAliases {\n+ alts = append(alts, nameAlias.WholeName)\n+ }\n+ return &Name{\n+ Original: v.NameAliases[0].WholeName,\n+ Processed: v.NameAliases[0].WholeName,\n+ eu_csl: v,\n+ altNames: alts,\n+ }\n+ }\n+\n+ return &Name{}\n}\nreturn &Name{}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "cmd/server/search_eu_csl.go", "diff": "+// Copyright 2022 The Moov Authors\n+// Use of this source code is governed by an Apache License\n+// license that can be found in the LICENSE file.\n+\n+package main\n+\n+import (\n+ \"encoding/json\"\n+ \"net/http\"\n+\n+ moovhttp \"github.com/moov-io/base/http\"\n+ \"github.com/moov-io/base/log\"\n+ \"github.com/moov-io/watchman/pkg/csl\"\n+)\n+\n+// search EUCLS\n+func searchEUCSL(logger log.Logger, searcher *searcher) http.HandlerFunc {\n+ return func(w http.ResponseWriter, r *http.Request) {\n+ w = wrapResponseWriter(logger, w, r)\n+ requestID := moovhttp.GetRequestID(r)\n+\n+ limit := extractSearchLimit(r)\n+ filters := buildFilterRequest(r.URL)\n+ minMatch := extractSearchMinMatch(r)\n+\n+ name := r.URL.Query().Get(\"name\")\n+ resp := buildFullSearchResponseWith(searcher, euGatherings, filters, limit, minMatch, name)\n+\n+ logger.Info().With(log.Fields{\n+ \"name\": log.String(name),\n+ \"requestID\": log.String(requestID),\n+ }).Log(\"performing EU-CSL search\")\n+\n+ w.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n+ w.WriteHeader(http.StatusOK)\n+ json.NewEncoder(w).Encode(resp)\n+ }\n+}\n+\n+// TopEUCSL searches the EU Sanctions list by Name and Alias\n+func (s *searcher) TopEUCSL(limit int, minMatch float64, name string) []*Result[csl.EUCSLRow] {\n+ s.RLock()\n+ defer s.RUnlock()\n+\n+ s.Gate.Start()\n+ defer s.Gate.Done()\n+\n+ return topResults[csl.EUCSLRow](limit, minMatch, name, s.EUCSL)\n+}\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_handlers.go", "new_path": "cmd/server/search_handlers.go", "diff": "@@ -35,7 +35,7 @@ var (\nfunc addSearchRoutes(logger log.Logger, r *mux.Router, searcher *searcher) {\nr.Methods(\"GET\").Path(\"/search\").HandlerFunc(search(logger, searcher))\nr.Methods(\"GET\").Path(\"/search/us-csl\").HandlerFunc(searchUSCSL(logger, searcher))\n- // r.Methods(\"GET\").Path(\"/search/eu-csl\").HandlerFunc(searchEUCSL(logger, searcher))\n+ r.Methods(\"GET\").Path(\"/search/eu-csl\").HandlerFunc(searchEUCSL(logger, searcher))\n}\nfunc extractSearchLimit(r *http.Request) int {\n" }, { "change_type": "MODIFY", "old_path": "cmd/server/search_us_csl.go", "new_path": "cmd/server/search_us_csl.go", "diff": "@@ -65,6 +65,16 @@ func precomputeCSLEntities[T any](items []*T, pipe *pipeliner) []*Result[T] {\npipe.Do(alt)\naltNames = append(altNames, alt.Processed)\n}\n+ } else if name == \"NameAliases\" {\n+ alts, ok := elm.Field(i).Interface().([]*csl.NameAlias)\n+ if !ok {\n+ continue\n+ }\n+ for j := range alts {\n+ alt := &Name{Processed: alts[j].WholeName}\n+ pipe.Do(alt)\n+ altNames = append(altNames, alt.Processed)\n+ }\n}\n}\n@@ -198,14 +208,3 @@ func (s *searcher) TopNS_MBS(limit int, minMatch float64, name string) []*Result\nreturn topResults[csl.NS_MBS](limit, minMatch, name, s.NS_MBSs)\n}\n-\n-// TopEUCSL searches the Non-SDN Menu Based Sanctions list by Name and Alias\n-func (s *searcher) TopEUCSL(limit int, minMatch float64, name string) []*Result[csl.EUCSLRow] {\n- s.RLock()\n- defer s.RUnlock()\n-\n- s.Gate.Start()\n- defer s.Gate.Done()\n-\n- return topResults[csl.EUCSLRow](limit, minMatch, name, s.EUCSL)\n-}\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/download_eu.go", "new_path": "pkg/csl/download_eu.go", "diff": "@@ -6,38 +6,19 @@ package csl\nimport (\n\"fmt\"\n- \"net/url\"\n- \"os\"\n\"github.com/moov-io/base/log\"\n\"github.com/moov-io/watchman/pkg/download\"\n)\n-// where can I get a new token from?\n+// TODO: where can I get a new token from?\nconst uri = \"https://webgate.ec.europa.eu/fsd/fsf/public/files/csvFullSanctionsList_1_1/content?token=dG9rZW4tMjAxNw\"\n-// TODO: env???\n-var (\n- euCSLDownloadTemplate = func() string {\n- if w := os.Getenv(\"EU_CSL_DOWNLOAD_TEMPLATE\"); w != \"\" {\n- return w\n- }\n- return uri\n- }()\n-)\n-\nfunc DownloadEU(logger log.Logger, initialDir string) (string, error) {\ndl := download.New(logger, download.HTTPClient)\n- euCSLURL, err := buildEUDownloadURL(euCSLDownloadTemplate)\n- if err != nil {\n- return \"\", err\n- }\n-\n- fmt.Println(\"euCSLURL: \", euCSLURL)\n-\neuCSLNameAndSource := make(map[string]string)\n- euCSLNameAndSource[\"eu_csl.csv\"] = euCSLURL\n+ euCSLNameAndSource[\"eu_csl.csv\"] = uri\nfile, err := dl.GetFiles(initialDir, euCSLNameAndSource)\nif len(file) == 0 || err != nil {\n@@ -45,11 +26,3 @@ func DownloadEU(logger log.Logger, initialDir string) (string, error) {\n}\nreturn file[0], nil\n}\n-\n-func buildEUDownloadURL(urlStr string) (string, error) {\n- euCSLURL, err := url.Parse(fmt.Sprintf(urlStr, \"eu_csl_processed.csv\"))\n- if err != nil {\n- return \"\", err\n- }\n- return euCSLURL.String(), nil\n-}\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/download_eu_test.go", "new_path": "pkg/csl/download_eu_test.go", "diff": "@@ -71,10 +71,3 @@ func TestEUDownload_initialDir(t *testing.T) {\nt.Fatalf(\"unknown file: %v\", file)\n}\n}\n-\n-func Test_buildEUDownloadURL_parseError(t *testing.T) {\n- url, err := buildEUDownloadURL(\"\\\\\\\\://api.trade.gov/blah/blah/%s\")\n- if err == nil {\n- t.Errorf(\"expected error, found %s\", url)\n- }\n-}\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/eu_csl.go", "new_path": "pkg/csl/eu_csl.go", "diff": "@@ -17,108 +17,108 @@ type EUCSL map[int]*EUCSLRow\n// type EUCSLSheet []*EUCSLRow\ntype EUCSLRow struct {\n- FileGenerationDate string\n- Entity *Entity\n- NameAliases []*NameAlias\n- Addresses []*Address\n- BirthDates []*BirthDate\n- Identifications []*Identification\n+ FileGenerationDate string `json:\"fileGenerationDate\"`\n+ Entity *Entity `json:\"entity\"`\n+ NameAliases []*NameAlias `json:\"nameAliases\"`\n+ Addresses []*Address `json:\"addresses\"`\n+ BirthDates []*BirthDate `json:\"birthDates\"`\n+ Identifications []*Identification `json:\"identifications\"`\n}\ntype Entity struct {\n- LogicalID int\n- ReferenceNumber string // EntityNumber\n- UnitiedNationsID string\n- DesignationDate string\n- DesignationDetails string\n- Remark string // Remark - other remarks exist but this one is most pertinent\n- SubjectType *SubjectType // Type\n+ LogicalID int `json:\"logicalId\"`\n+ ReferenceNumber string `json:\"referenceNumber\"`\n+ // UnitiedNationsID string\n+ // DesignationDate string\n+ // DesignationDetails string\n+ Remark string `json:\"remark\"`\n+ SubjectType *SubjectType `json:\"subjectType\"`\nRegulation *Regulation\n}\ntype SubjectType struct {\n- SingleLetter string\n- ClassificationCode string\n+ // SingleLetter string\n+ ClassificationCode string `json:\"classificationCode\"`\n}\ntype Regulation struct {\n- Type string\n- OrganizationType string\n- PublicationDate string\n- EntryInfoForceDate string\n- NumberTitle string\n- Programme string\n- PublicationURL string // SourceListURL\n+ // Type string\n+ // OrganizationType string\n+ // PublicationDate string\n+ // EntryInfoForceDate string\n+ // NumberTitle string\n+ // Programme string\n+ PublicationURL string `json:\"publicationURL\"`\n}\ntype NameAlias struct { // AltNames\n- LastName string\n- FirstName string\n- MiddleName string\n- WholeName string // Name\n- NameLanguage string\n- Gender string\n- Title string // Title\n- Function string\n- LogicalID int64\n- RegulationLanguage string\n- Remark string\n- Regulation *Regulation\n+ // LastName string\n+ // FirstName string\n+ // MiddleName string\n+ WholeName string `json:\"wholeName\"`\n+ // NameLanguage string\n+ // Gender string\n+ Title string `json:\"title\"`\n+ // Function string\n+ // LogicalID int64\n+ // RegulationLanguage string\n+ // Remark string\n+ // Regulation *Regulation\n}\ntype Address struct { // addresses\n- City string // keep\n- Street string // keep\n- PoBox string // keep\n- ZipCode string // keep\n- Region string\n- Place string\n- AsAtListingTime string\n- ContactInfo string\n- CountryIso2code string\n+ City string `json:\"city\"`\n+ Street string `json:\"street\"`\n+ PoBox string `json:\"poBox\"`\n+ ZipCode string `json:\"zipCode\"`\n+ // Region string\n+ // Place string\n+ // AsAtListingTime string\n+ // ContactInfo string\n+ // CountryIso2code string\nCountryDescription string // keep\n- LogicalID int64\n- RegulationLanguage string\n- Remark string\n- Regulation *Regulation\n+ // LogicalID int64\n+ // RegulationLanguage string\n+ // Remark string\n+ // Regulation *Regulation\n}\ntype BirthDate struct {\nBirthDate string // keep\n- Day int64\n- Month int64\n- Year int64\n- YearRangeFrom string\n- YearRangeTo string\n- Circa string\n- CaldendarType string // TODO: this could be an enum\n- ZipCode string\n- Region string\n- Place string\n- City string // keep?\n- CountryIso2code string\n- CountryDescription string // Nationality?\n- LogicalID int64\n- Regulation *Regulation\n+ // Day int64\n+ // Month int64\n+ // Year int64\n+ // YearRangeFrom string\n+ // YearRangeTo string\n+ // Circa string\n+ // CaldendarType string // TODO: this could be an enum\n+ // ZipCode string\n+ // Region string\n+ // Place string\n+ City string `json:\"city\"`\n+ // CountryIso2code string\n+ CountryDescription string `json:\"countryDescription\"`\n+ // LogicalID int64\n+ // Regulation *Regulation\n}\ntype Identification struct {\n- Regulation *Regulation\n- Number int64\n- KnownExpired bool\n- KnownFalse bool\n- ReportedLost bool\n- RevokedByIssuer bool\n- LogicalID int64\n- Diplomatic string // TODO: not sure about this field\n- IssuedBy string\n- IssuedDate string\n- ValidFrom string // StartDate\n- ValidTo string // EndDate\n- NameOnDocument string\n- TypeCode string\n- TypeDescription string\n- Region string\n- CountryIso2code string\n- CountryDescription string\n- RegulationLanguage string\n- Remark string\n+ // Regulation *Regulation\n+ // Number int64\n+ // KnownExpired bool\n+ // KnownFalse bool\n+ // ReportedLost bool\n+ // RevokedByIssuer bool\n+ // LogicalID int64\n+ // Diplomatic string // TODO: not sure about this field\n+ // IssuedBy string\n+ // IssuedDate string\n+ ValidFrom string `json:\"validFrom\"`\n+ ValidTo string `json:\"validTo\"`\n+ // NameOnDocument string\n+ // TypeCode string\n+ // TypeDescription string\n+ // Region string\n+ // CountryIso2code string\n+ // CountryDescription string\n+ // RegulationLanguage string\n+ // Remark string\n}\n// header indicies\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader_eu.go", "new_path": "pkg/csl/reader_eu.go", "diff": "@@ -9,27 +9,36 @@ import (\n\"strconv\"\n)\n-func ReadEUFile(path string) ([]*EUCSLRow, error) {\n+func ReadEUFile(path string) ([]*EUCSLRow, EUCSL, error) {\nfd, err := os.Open(path)\nif err != nil {\n- return nil, err\n+ return nil, nil, err\n}\ndefer fd.Close()\n- return ParseEU(fd)\n+ rows, rowsMap, err := ParseEU(fd)\n+ if err != nil {\n+ return nil, nil, err\n+ }\n+\n+ return rows, rowsMap, nil\n}\n-func ParseEU(r io.Reader) ([]*EUCSLRow, error) {\n+func ParseEU(r io.Reader) ([]*EUCSLRow, EUCSL, error) {\nreader := csv.NewReader(r)\n+ // sets comma delim to ; and ignores \" in non quoted field and size of columns\n+ // https://stackoverflow.com/questions/31326659/golang-csv-error-bare-in-non-quoted-field\n+ // https://stackoverflow.com/questions/61336787/how-do-i-fix-the-wrong-number-of-fields-with-the-missing-commas-in-csv-file-in\nreader.Comma = ';'\n+ reader.LazyQuotes = true\n+ // reader.FieldsPerRecord = -1\nreport := make(EUCSL)\n_, err := reader.Read()\nif err != nil {\n- fmt.Println(\"we made an oopsie: \", err)\n+ fmt.Println(\"failed to read csv: \", err)\n}\n- // TODO: change this back to while\n- for i := 0; i <= 4; i++ {\n+ for {\nrecord, err := reader.Read()\nif err != nil {\n// reached the last line\n@@ -42,10 +51,11 @@ func ParseEU(r io.Reader) ([]*EUCSLRow, error) {\nerrors.Is(err, csv.ErrQuote) {\ncontinue\n}\n- return nil, err\n+ return nil, nil, err\n}\nif len(record) <= 1 {\n+ fmt.Println(\"record is <= 1\", record)\ncontinue // skip empty records\n}\n@@ -54,13 +64,11 @@ func ParseEU(r io.Reader) ([]*EUCSLRow, error) {\nlogicalID, _ := strconv.Atoi(record[EntityLogicalIdx])\n// check if entry does not exist\nif val, ok := report[logicalID]; !ok {\n- fmt.Println(\"unmarshalling first row\")\nrow := unmarshalFirstEUCSLRow(record)\nreport[logicalID] = row\n} else {\n// we found an entry in the map and need to append\n- fmt.Println(\"unmarshalling next row\")\nunmarshalNextEUCSLRow(record, val)\n}\n@@ -69,7 +77,7 @@ func ParseEU(r io.Reader) ([]*EUCSLRow, error) {\nfor _, row := range report {\ntotalReport = append(totalReport, row)\n}\n- return totalReport, nil\n+ return totalReport, report, nil\n}\nfunc unmarshalFirstEUCSLRow(csvRecord []string) *EUCSLRow {\n@@ -93,7 +101,9 @@ func unmarshalFirstEUCSLRow(csvRecord []string) *EUCSLRow {\n}\nnewNameAlias.Title = csvRecord[NameAliasTitleIdx]\n}\n+ if newNameAlias != nil {\nrow.NameAliases = append(row.NameAliases, newNameAlias)\n+ }\nvar newAddress *Address\nif csvRecord[AddressCityIdx] != \"\" {\n@@ -168,7 +178,6 @@ func unmarshalFirstEUCSLRow(csvRecord []string) *EUCSLRow {\n}\nfunc unmarshalNextEUCSLRow(csvRecord []string, row *EUCSLRow) {\n-\n// NameAlias\nvar newNameAlias *NameAlias\nif csvRecord[NameAliasWholeNameIdx] != \"\" {\n" }, { "change_type": "MODIFY", "old_path": "pkg/csl/reader_eu_test.go", "new_path": "pkg/csl/reader_eu_test.go", "diff": "@@ -8,17 +8,21 @@ import (\n)\nfunc TestReadEU(t *testing.T) {\n- euCSL, err := ReadEUFile(filepath.Join(\"..\", \"..\", \"test\", \"testdata\", \"eu_csl.csv\"))\n+ euCSL, euCSLMap, err := ReadEUFile(filepath.Join(\"..\", \"..\", \"test\", \"testdata\", \"eu_csl.csv\"))\nif err != nil {\nt.Fatal(err)\n}\n- if euCSL == nil {\n+ if euCSL == nil || euCSLMap == nil {\nt.Fatal(\"failed to parse eu_csl.csv\")\n}\n+ if len(euCSL) == 0 {\n+ t.Fatal(\"failed to convert map to sheet\")\n+ }\n+\ntestLogicalID := 13\n- if euCSL[testLogicalID] == nil {\n+ if euCSLMap[testLogicalID] == nil {\nt.Fatalf(\"expected a record at %d and got nil\", testLogicalID)\n}\nexpectedFileGenerationDate := \"28/10/2022\"\n@@ -41,34 +45,34 @@ func TestReadEU(t *testing.T) {\nexpectedBirthCountryDescription := \"IRAQ\"\nassert.Greater(t, len(euCSL), 0)\n- assert.NotNil(t, euCSL[testLogicalID].Entity)\n- assert.NotNil(t, euCSL[testLogicalID].NameAliases)\n- assert.NotNil(t, euCSL[testLogicalID].Addresses)\n- assert.NotNil(t, euCSL[testLogicalID].BirthDates)\n- assert.NotNil(t, euCSL[testLogicalID].Identifications)\n+ assert.NotNil(t, euCSLMap[testLogicalID].Entity)\n+ assert.NotNil(t, euCSLMap[testLogicalID].NameAliases)\n+ assert.NotNil(t, euCSLMap[testLogicalID].Addresses)\n+ assert.NotNil(t, euCSLMap[testLogicalID].BirthDates)\n+ assert.NotNil(t, euCSLMap[testLogicalID].Identifications)\n- assert.Equal(t, euCSL[testLogicalID].FileGenerationDate, expectedFileGenerationDate)\n+ assert.Equal(t, euCSLMap[testLogicalID].FileGenerationDate, expectedFileGenerationDate)\n// Entity\n- assert.Equal(t, euCSL[testLogicalID].Entity.ReferenceNumber, expectedReferenceNumber)\n- assert.Equal(t, euCSL[testLogicalID].Entity.Remark, expectedEntityRemark)\n- assert.Equal(t, euCSL[testLogicalID].Entity.SubjectType.ClassificationCode, expectedClassificationCode)\n- assert.Equal(t, euCSL[testLogicalID].Entity.Regulation.PublicationURL, expectedPublicationURL)\n+ assert.Equal(t, expectedReferenceNumber, euCSLMap[testLogicalID].Entity.ReferenceNumber)\n+ assert.Equal(t, expectedEntityRemark, euCSLMap[testLogicalID].Entity.Remark)\n+ assert.Equal(t, expectedClassificationCode, euCSLMap[testLogicalID].Entity.SubjectType.ClassificationCode)\n+ assert.Equal(t, expectedPublicationURL, euCSLMap[testLogicalID].Entity.Regulation.PublicationURL)\n// Name Alias\n- assert.Equal(t, euCSL[testLogicalID].NameAliases[0].WholeName, expectedNameAliasWholeName1)\n- assert.Equal(t, euCSL[testLogicalID].NameAliases[1].WholeName, expectedNameAliasWholeName2)\n- assert.Equal(t, euCSL[testLogicalID].NameAliases[2].WholeName, expectedNameAliasWholeName3)\n- assert.Equal(t, euCSL[testLogicalID].NameAliases[0].Title, expectedNameAliasTitle)\n+ assert.Equal(t, expectedNameAliasWholeName1, euCSLMap[testLogicalID].NameAliases[0].WholeName)\n+ assert.Equal(t, expectedNameAliasWholeName2, euCSLMap[testLogicalID].NameAliases[1].WholeName)\n+ assert.Equal(t, expectedNameAliasWholeName3, euCSLMap[testLogicalID].NameAliases[2].WholeName)\n+ assert.Equal(t, expectedNameAliasTitle, euCSLMap[testLogicalID].NameAliases[0].Title)\n// Address\n- assert.Len(t, euCSL[testLogicalID].Addresses, 0)\n+ assert.Len(t, euCSLMap[testLogicalID].Addresses, 0)\n// BirthDate\n- assert.Equal(t, euCSL[testLogicalID].BirthDates[0].BirthDate, expectedBirthDate)\n- assert.Equal(t, euCSL[testLogicalID].BirthDates[0].City, expectedBirthCity)\n- assert.Equal(t, euCSL[testLogicalID].BirthDates[0].CountryDescription, expectedBirthCountryDescription)\n+ assert.Equal(t, expectedBirthDate, euCSLMap[testLogicalID].BirthDates[0].BirthDate)\n+ assert.Equal(t, expectedBirthCity, euCSLMap[testLogicalID].BirthDates[0].City)\n+ assert.Equal(t, expectedBirthCountryDescription, euCSLMap[testLogicalID].BirthDates[0].CountryDescription)\n// Identification\n- assert.Len(t, euCSL[testLogicalID].Identifications, 0)\n+ assert.Len(t, euCSLMap[testLogicalID].Identifications, 0)\n}\n" }, { "change_type": "MODIFY", "old_path": "pkg/download/client.go", "new_path": "pkg/download/client.go", "diff": "@@ -143,18 +143,25 @@ func (dl *Downloader) createLogger(filename, downloadURL string) log.Logger {\nfunc (dl *Downloader) retryDownload(dir, filename, downloadURL string) error {\n// Allow a couple retries for various sources (some are flakey)\nfor i := 0; i < 3; i++ {\n- req, err := http.NewRequest(\"GET\", downloadURL, nil)\n+ req, err := http.NewRequest(http.MethodGet, downloadURL, nil)\nif err != nil {\nreturn dl.Logger.Error().LogErrorf(\"error building HTTP request: %v\", err).Err()\n}\nreq.Header.Set(\"User-Agent\", fmt.Sprintf(\"moov-io/watchman:%v\", watchman.Version))\n+ // in order to get passed europes 406 (Not Accepted)\n+ req.Header.Set(\"accept-language\", \"en-US,en;q=0.9\")\nresp, err := dl.HTTP.Do(req)\nif err != nil {\n+ fmt.Println(\"err while doing client request: \", err)\ntime.Sleep(100 * time.Millisecond)\ncontinue // retry\n}\n+ if resp.StatusCode < 200 || resp.StatusCode >= 300 {\n+ fmt.Println(\"we experienced a problem in the dl: \", resp.StatusCode)\n+ }\n+\n// Copy resp.Body into a file in our temp dir\nfd, err := os.Create(filepath.Join(dir, filename))\nif err != nil {\n" } ]
Go
Apache License 2.0
moov-io/watchman
adds some fixes around downloading eu csl datasheet