{"id":3540,"date":"2017-04-16T11:12:51","date_gmt":"2017-04-16T07:12:51","guid":{"rendered":"https:\/\/nayarweb.com\/blog\/?p=3540"},"modified":"2017-04-20T21:56:54","modified_gmt":"2017-04-20T17:56:54","slug":"analysing-car-market-trends-using-big-data-tools-in-mauritius","status":"publish","type":"post","link":"https:\/\/nayarweb.com\/blog\/2017\/analysing-car-market-trends-using-big-data-tools-in-mauritius\/","title":{"rendered":"Analysing Car Market Trends using Big Data Tools in Mauritius"},"content":{"rendered":"<p>Who hasn&#8217;t heard of <em>Big Data<\/em> in the 21th century? Big Data in itself isn&#8217;t much of a great deal as knowing how to extract useful information from the data. It is the analytics part which is the killer feature of Big Data. It comprises of both science and art!<\/p>\n<figure id=\"attachment_3550\" aria-describedby=\"caption-attachment-3550\" style=\"width: 620px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3550 size-full\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/91390eda10efeac6736888d66d118932_L.jpg\" alt=\"\" width=\"620\" height=\"431\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/91390eda10efeac6736888d66d118932_L.jpg 620w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/91390eda10efeac6736888d66d118932_L-300x209.jpg 300w\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" \/><figcaption id=\"caption-attachment-3550\" class=\"wp-caption-text\">source: www.fudzilla.com<\/figcaption><\/figure>\n<p>The first step of Big Data solutions is to gather data. There are lots of ways in which you can achieve this. <em>Manual Data Entry<\/em> can still be done but you&#8217;ll require quite an army of minions for that. But I was\u00a0not &#8220;evil&#8221; enough to convince the minions to work for me. So I had to find other ways: Facebook Graph API allows you to get feeds from your\u00a0wall, car groups you&#8217;re in.<\/p>\n<blockquote><p>{<br \/>\n<span class=\"_5smc\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;message&#8221;: <span class=\"_5sma\">&#8220;Renault Scenic<br \/>\nRs138,000 &#8211; Vacoas, Plaines Wilhems, Mauritius<\/span><\/span><\/p>\n<p>For sale Renault Scenic Year 2005,STEPTRONIC gearbox,fully executive,1500 cc Petrol,never accidented,comes with digital dashboard,armrest,electric mirrors,alloy wheels and panoramic sunroof&#8221;,<br \/>\n<span class=\"_5smc\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;updated_time&#8221;: <span class=\"_5sma\">&#8220;2017-04-16T05:57:29+0000&#8221;<\/span>,<br \/>\n<\/span><span class=\"_5smc\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&#8220;id&#8221;: <span class=\"_5sma\">&#8220;<a href=\"https:\/\/developers.facebook.com\/tools\/explorer\/133562073354009?method=GET&amp;path=1485532378330237%2Ffeed&amp;version=v2.8#\">14851777<\/a>&#8220;<\/span><\/span><\/p>\n<p>},<\/p><\/blockquote>\n<p>Good news is that the data is in JSON format. Bad news is that the message field contains unstructured data. We have to extract the informations we want from it. I use <span style=\"color: #3366ff;\"><a style=\"color: #3366ff;\" href=\"https:\/\/nayarweb.com\/collectiva\">Collectiva Beta<\/a><\/span> service (from nayarweb.com) for data processing.<\/p>\n<figure id=\"attachment_3543\" aria-describedby=\"caption-attachment-3543\" style=\"width: 939px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/nayarweb.com\/collectiva\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3543 size-full\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.35.30-AM.png\" alt=\"\" width=\"939\" height=\"693\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.35.30-AM.png 939w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.35.30-AM-300x221.png 300w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.35.30-AM-768x567.png 768w\" sizes=\"auto, (max-width: 939px) 100vw, 939px\" \/><\/a><figcaption id=\"caption-attachment-3543\" class=\"wp-caption-text\">Collectiva Beta<\/figcaption><\/figure>\n<p>Let&#8217;s extract the Make, Model, Price, Location and Year from the data. I use grok patterns on the message field.<\/p>\n<blockquote><p>Make and Model:\u00a0^%{NOTSPACE:make} %{NOTSPACE:model}<\/p>\n<p>Year:\u00a0(y(ea)*r|an(n*e*))\\s*\\:*\\s*(?&lt;year;int&gt;[0-9]+) \/\/ works with an 96, year 2003, yr : 14, anne 2000<\/p>\n<p>Price &amp; Location:\u00a0(((Rs|\\$|\u00a3|\u20b9)(?&lt;price_string&gt;([0-9,])*))|FREE)( &#8211; %{GREEDYDATA:location_string})?<\/p><\/blockquote>\n<p>Now we\u00a0can just throw data at it. Some will get properly parsed, some not. But with enough data, you can still get some pretty graphs. In the future, hopefully I get an AI do the extracting for me.<\/p>\n<p>Let&#8217;s get to the pretty parts now: graphs.<\/p>\n<h2>Which car makes\u00a0are the most sold in Mauritius?<\/h2>\n<p>Easy: A Bar Chart<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3545\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.51.48-AM.png\" alt=\"\" width=\"930\" height=\"678\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.51.48-AM.png 930w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.51.48-AM-300x219.png 300w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.51.48-AM-768x560.png 768w\" sizes=\"auto, (max-width: 930px) 100vw, 930px\" \/><\/p>\n<h3>How many models are within each make?<\/h3>\n<p>No need to have another graph. We just split the\u00a0split bars for\u00a0models. Voila!<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-3546\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.54.28-AM-1024x640.png\" alt=\"\" width=\"640\" height=\"400\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.54.28-AM-1024x640.png 1024w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.54.28-AM-300x188.png 300w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.54.28-AM-768x480.png 768w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-10.54.28-AM.png 1081w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<h3>How much do the car models depreciate in Mauritius?<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-3547\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.00.53-AM-1024x615.png\" alt=\"\" width=\"640\" height=\"384\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.00.53-AM-1024x615.png 1024w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.00.53-AM-300x180.png 300w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.00.53-AM-768x461.png 768w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.00.53-AM.png 1079w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>Notice that it is graphing the 50th percentile which is also known as median. <em>Means<\/em>\u00a0are kinda useless because a single outlier can cause the graphs to be very skewed by a lot. We can show the 10th, 50th, 90th percentile on the same graph so that you can compare whether the car you&#8217;re buying falls between the accepted market price. Let&#8217;s say you want a Volkswagen Polo<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-3548\" src=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.06.05-AM-1024x476.png\" alt=\"\" width=\"640\" height=\"298\" srcset=\"https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.06.05-AM-1024x476.png 1024w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.06.05-AM-300x140.png 300w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.06.05-AM-768x357.png 768w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.06.05-AM-1272x592.png 1272w, https:\/\/nayarweb.com\/blog\/wp-content\/uploads\/2017\/04\/Screen-Shot-2017-04-16-at-11.06.05-AM.png 1440w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>You can see the same lines above are not split into 3 lines. I don&#8217;t have much variation here because I&#8217;ve been collecting data for only 4 days. The lines are supposed to smoothen over time and the accuracy will increase.<\/p>\n<h3>Wanna\u00a0see the Big Picture? Welcome the Pi Chart<\/h3>\n<p>In this graph, I aggregated the data into Make, Model, Year and Price. All in 1 graph. It&#8217;s like magic nah?<\/p>\n<p><iframe loading=\"lazy\" title=\"carpi\" width=\"640\" height=\"480\" src=\"https:\/\/www.youtube.com\/embed\/ZsSeFvaB3DQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h3>Want to get into Big Data World?<\/h3>\n<p>If you have big databases sitting around, like for supermarket, warehouse, manufacturing and agriculture, or you run an SME or NGO and would like to benefit from the insights of Big Data tools feel free to contact me for a quotation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Who hasn&#8217;t heard of Big Data in the 21th century? Big Data in itself isn&#8217;t much of a great deal as knowing how to extract useful information from the data. It is the analytics part which is the killer feature of Big Data. It comprises of both science and art! The first step of Big &hellip; <a href=\"https:\/\/nayarweb.com\/blog\/2017\/analysing-car-market-trends-using-big-data-tools-in-mauritius\/\" class=\"continue-reading\">Continue reading <span class=\"screen-reader-text\">Analysing Car Market Trends using Big Data Tools in Mauritius<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[210],"tags":[224,229,225,228,64],"class_list":["post-3540","post","type-post","status-publish","format-standard","hentry","category-technology","tag-big-data","tag-collectiva","tag-elasticsearch","tag-kibana","tag-mauritius"],"_links":{"self":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/3540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/comments?post=3540"}],"version-history":[{"count":5,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/3540\/revisions"}],"predecessor-version":[{"id":3551,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/posts\/3540\/revisions\/3551"}],"wp:attachment":[{"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/media?parent=3540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/categories?post=3540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nayarweb.com\/blog\/wp-json\/wp\/v2\/tags?post=3540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}