{"id":1307,"date":"2017-10-25T15:53:17","date_gmt":"2017-10-25T19:53:17","guid":{"rendered":"http:\/\/www.michelecoscia.com\/?page_id=1307"},"modified":"2019-01-21T05:16:12","modified_gmt":"2019-01-21T09:16:12","slug":"health-crawler","status":"publish","type":"page","link":"https:\/\/www.michelecoscia.com\/?page_id=1307","title":{"rendered":"Health Crawler"},"content":{"rendered":"<h2 style=\"text-align: center;\"><strong>Health Crawler<\/strong><\/h2>\n<p style=\"text-align: center;\">implemented by me<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1310 size-full\" src=\"http:\/\/www.michelecoscia.com\/wp-content\/uploads\/2017\/10\/wbcrawl-logo.png\" alt=\"\" width=\"344\" height=\"195\" srcset=\"https:\/\/www.michelecoscia.com\/wp-content\/uploads\/2017\/10\/wbcrawl-logo.png 344w, https:\/\/www.michelecoscia.com\/wp-content\/uploads\/2017\/10\/wbcrawl-logo-300x170.png 300w\" sizes=\"auto, (max-width: 344px) 85vw, 344px\" \/><\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.michelecoscia.com\/wp-content\/uploads\/2017\/10\/wb_crawl.zip\"><strong>Download Data &amp; Code<\/strong><\/a><\/p>\n<p>This is the data and code companion for the paper &#8220;<a href=\"https:\/\/link.springer.com\/article\/10.1140\/epjds\/s13688-018-0141-0\">Mapping the International Health Aid Community Using Web Data<\/a>&#8221; by me, Katsumasa Hamaguchi, Maria Elena Pinglo, and Antonio Giuffrida, published in the EPJ Data Science journal.<\/p>\n<p>The release has two folders: &#8220;data&#8221; and &#8220;code&#8221;.<\/p>\n<p>The &#8220;data&#8221; folder contains six files. The first three contains our cleaned inputs: the entity lists.<\/p>\n<p>&#8211; countries.csv. A three column file, connecting each country ID (first column) to the country name (second column). If the country name has aliases, these are listed in the third column.<br \/>\n&#8211; keywords.csv. The file connects each keyword ID (first column) the the keyword name (second column). Columns three to six indicate whether the keyword is part of one of four macro categories.<br \/>\n&#8211; organizations.csv. The file connects each organization id (first column) to the organization&#8217;s name (second column), acronym (third column), website&#8217;s URL (fourth column), and possible aliases (fifth column).<\/p>\n<p>The other three files contain the data, sliced differently.<\/p>\n<p>&#8211; data_clean.csv. The file has five columns:<br \/>\n&#8211; &#8220;organization&#8221;: the ID of the organization from which we obtain the observation.<br \/>\n&#8211; &#8220;entity 1 type&#8221; &amp; &#8220;entity 2 type&#8221;: these columns inform on how to interpret the following two columns. Since all IDs are numeric, the ID 1 could refer to either organization 1, issue 1, or country 1. If &#8220;entity 1 type&#8221; is &#8220;countries&#8221;, it means that a value of &#8220;3&#8221; in the &#8220;entity 1&#8221; column refers to country 3.<br \/>\n&#8211; &#8220;entity 1&#8221; &amp; &#8220;entity 2&#8221;: the columns report the ID of the connected entities. Check the entity type columns for how to interpret these values.<br \/>\n&#8211; &#8220;score&#8221;: the WS score of the entity pair, meaning the log number of pages in which the entities co-occur.<\/p>\n<p>&#8211; data_clean_bycountry.csv. The file has the same structure as the previous one, with the only difference being the first columns. Instead of reporting the organization ID &#8212; meaning the website from which the data comes &#8212; the first column here represents the country ID: the country to which the data refers. This means that the last column &#8212; &#8220;score&#8221; &#8212; is the aggregation of the WS scores across all websites.<\/p>\n<p>&#8211; data_clean_citations.csv. The file has four columns:<br \/>\n&#8211; &#8220;source&#8221;: the ID of the organization making the citation.<br \/>\n&#8211; &#8220;target type&#8221;: this column informs on how to interpreting the &#8220;target&#8221; column in the same way &#8220;entity 1 type&#8221; &amp; &#8220;entity 2 type&#8221; do in the &#8220;data_clean.csv&#8221; file.<br \/>\n&#8211; &#8220;target&#8221;: the ID of the entity being cited by the organization.<br \/>\n&#8211; &#8220;score&#8221;: the WS score of the citation, meaning the log number of pages in which the target is mentioned.<\/p>\n<p>In all data files, the type &#8220;organization_links&#8221; refers to an &#8220;organization&#8221;. The difference is that an &#8220;organization&#8221; is a mention by name (or acronym), while an &#8220;organization_links&#8221; is a mention by hyperlink.<\/p>\n<p>The &#8220;code&#8221; folder contains four files and a subfolder. The csv files are the same input file contained in the data folder: countries.csv, keywords.csv, organizations.csv. The Python script wbcrawl_manager.py is used to launch the crawler. The script assumes that you have created a file called &#8220;batch&#8221;. This file should contain a list of organization IDs, one per line. The script will spawn a different process per ID, crawling the corresponding website. If launched in a machine with sufficient processors and memory, &#8220;batch&#8221; can contain all the organization IDs, thus launching the entire crawl process in parallel.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>!!!IMPORTANT NOTE!!!<\/strong><\/span> The crawler REQUIRES the usage of the PhantomJS binary, which is NOT included in this package. One can download it from http:\/\/phantomjs.org\/, and place it in the code folder. This might create compatibility issues if run in a system different from the development one. The crawler should run with no issues on Ubuntu 16.04.<\/p>\n<p>The crawler assumes that you have properly installed the Scrapy library (https:\/\/scrapy.org\/). In fact, the crawler is nothing more than a standard Scrapy project. The Scrapy version used to crawl the webpages is 1.3.2. I cannot guarantee that other Scrapy versions will work without issues. Other required nonstandard Python library are:<\/p>\n<p>&#8211; Selenium<br \/>\n&#8211; BeautifulSoup<br \/>\n&#8211; Six<\/p>\n<p>Most of the code is standard Scrapy code. The custom parts of the crawler are mostly in wb_crawl\/spiders\/health_spider.py, which contains the logic of the crawler.<\/p>\n<p>If you are going to use the crawler for your own personal project, <em><strong>PLEASE<\/strong><\/em> edit the USER_AGENT (line 19 in wb_crawl\/settings.py) and include your contact information.<\/p>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.michelecoscia.com\/wp-content\/uploads\/2017\/10\/wb_crawl.zip\"><strong>Download Data &amp; Code<\/strong><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Health Crawler implemented by me Download Data &amp; Code This is the data and code companion for the paper &#8220;Mapping the International Health Aid Community Using Web Data&#8221; by me, Katsumasa Hamaguchi, Maria Elena Pinglo, and Antonio Giuffrida, published in the EPJ Data Science journal. The release has two folders: &#8220;data&#8221; and &#8220;code&#8221;. The &#8220;data&#8221; &hellip; <a href=\"https:\/\/www.michelecoscia.com\/?page_id=1307\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Health Crawler&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":25,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1307","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/pages\/1307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1307"}],"version-history":[{"count":6,"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/pages\/1307\/revisions"}],"predecessor-version":[{"id":1623,"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/pages\/1307\/revisions\/1623"}],"up":[{"embeddable":true,"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=\/wp\/v2\/pages\/25"}],"wp:attachment":[{"href":"https:\/\/www.michelecoscia.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}