Analysing Car Market Trends using Big Data Tools in Mauritius

Who hasn’t heard of Big Data in the 21th century? Big Data in itself isn’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!

source: www.fudzilla.com

The first step of Big Data solutions is to gather data. There are lots of ways in which you can achieve this. Manual Data Entry can still be done but you’ll require quite an army of minions for that. But I was not “evil” 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 wall, car groups you’re in.

{
      “message”: “Renault Scenic
Rs138,000 – Vacoas, Plaines Wilhems, Mauritius

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”,
      “updated_time”: “2017-04-16T05:57:29+0000”,
      “id”: 14851777

},

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 Collectiva Beta service (from nayarweb.com) for data processing.

Collectiva Beta

Let’s extract the Make, Model, Price, Location and Year from the data. I use grok patterns on the message field.

Make and Model: ^%{NOTSPACE:make} %{NOTSPACE:model}

Year: (y(ea)*r|an(n*e*))\s*\:*\s*(?<year;int>[0-9]+) // works with an 96, year 2003, yr : 14, anne 2000

Price & Location: (((Rs|\$|£|₹)(?<price_string>([0-9,])*))|FREE)( – %{GREEDYDATA:location_string})?

Now we can 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.

Let’s get to the pretty parts now: graphs.

Which car makes are the most sold in Mauritius?

Easy: A Bar Chart

How many models are within each make?

No need to have another graph. We just split the split bars for models. Voila!

How much do the car models depreciate in Mauritius?

Notice that it is graphing the 50th percentile which is also known as median. Means are 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’re buying falls between the accepted market price. Let’s say you want a Volkswagen Polo

You can see the same lines above are not split into 3 lines. I don’t have much variation here because I’ve been collecting data for only 4 days. The lines are supposed to smoothen over time and the accuracy will increase.

Wanna see the Big Picture? Welcome the Pi Chart

In this graph, I aggregated the data into Make, Model, Year and Price. All in 1 graph. It’s like magic nah?

Want to get into Big Data World?

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.

Detecting Brute Force Attacks on Linux using Graylog/Elasticsearch

I noticed one of my servers is sending more logs than the other. `sshd` was the application sending the most amount of logs in the last 24 hours.

The logs look like these:

pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.31.116.52 user=root

Failed password for root from 116.31.116.52 port 14281 ssh2

message repeated 2 times: [ Failed password for root from 116.31.116.52 port 14281 ssh2]

Received disconnect from 116.31.116.52 port 14281:11: [preauth]

Disconnected from 116.31.116.52 port 14281 [preauth]

PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=116.31.116.52 user=root

Since the IPs are being logged, I can know from where these are coming. Let’s generate a map.

Well well well, 5437 occurrences from China. Gotta do something. Here’s frequency of the attacks this week.

It seems to have amplified today. Looking at the logs, we can see that the were trying different passwords for the user `root`. Lemme just disable password authentication for SSH.

$ vim /etc/ssh/sshd_config

Change the line

#PasswordAuthentication yes

to

PasswordAuthentication no

$ service ssh restart

And we can see the logs are no more appearing 😉

Do you wish to analyse your server logs too? Feel free to message me on Facebook or Twitter or LinkedIn

 

Goodbye AirAsia

Mauritian social medias are full of disapointment by the fact the AirAsia will stop it’s service in Mauritius soon.

“The suspension of the Mauritius route is a part of the company’s big plan in network restructuring aimed at improving operational efficiencies in term of aircraft utilizations”

There are rumours that this is due to pressure by some Mauritians groups

“the sudden decision could be due to peer pressure by local ethnic groups, lobbying to the authorities in Mauritius to stop the highly successful flights.” –theindependent.sg

As I am a common people, I don’t have the ability to know the real reason behind.

It’s a really sad thing that Middle class Mauritians won’t be able to afford holidays abroad as AirAsia was allowing. Is there anyone to standup for “ti-dimounes”?

Slavery still on in the Employment Rights Act of Mauritius

Stay in your job position for 8 hours. On top of that, add 1 hour more for lunch time. Makes 9 hours in the workplace already.

As the time of writing, February 2017, teleportation has not yet been invented — or at least not that common people know of. It takes around 1 hour to 3 hours to commute to our workplace. Stupid traffic jams. Cherry on the cake, Mauritian Ministers with their escorts have the guts (‘toupe monstre’) to halt other road users so they can drive in our tax-paid BMWs and on our tax-paid roads in front of us while we, uhm, watch them in their dark tinted windows. Why are they in such a hurry to travel to finally do nothing?

The 8 hour work day supposed to be like this (best case scenario):

But in reality, it’s very different:

Lot’s of people do over-times on top of the 8 hour work which further decreases their personal times and sleep. This leads to insomnia, depression.

I believe we have the rights to spend time with our children, energy to setup shop. To summarise, we need time to live!

How many for “30 hour work-week” in Mauritius?

Why it took me 13 Days to get a Mauritian Passport

You know what sucks? When you’re completing some formalities and some officials tell you that you lack a particular document and they send you home.

It happened to me when I was applying for a Mauritian Passport. The official government website says:

Day 1 (Wednesday)

Printed and filled the Passport form. Got my passport photos shot at a studio. Reached Police Station at 17:00 with all documents mentioned on the website. The officers told me the Immigration Office closes at 16:30. Go Home #1

Day 2 (Thursday)

Went at the Immigration Office again at 10:45. Officer says I do not have a proof of address document. I need to go home and fetch it. I told the officer that proof of address was not mentioned on the website. He replied the proof of address is required by the “Police” to sign the address section of the document.

But I had other plans later that day. Couldn’t afford to go home and come back again. Go Home #2

Day 3 (Friday)

Slept till late. Had to go to Friday prayers. Reached Police Station at 15:00. Brought my proof of address (CEB and Telecom bill). Made Police officer sign the proof of address section of the form. However, couldn’t submit the form to the Immigration Office because they only take applications from 09:00 – 14:30 (lunch time 12:00 – 13:00). Go Home #3

Day 4/5/6 (Saturday/Sunday/Monday)

Weekends and Public Holiday. The Immigration Offices are closed in Police Stations.

Day 7 (Tuesday)

Managed to submit the form to the Immigration office. Paid Rs 700. Got receipt with appointment on the following Monday between 14:30 – 16:00 to fetch it. They told me to come in person. Go Home #4

Day 8/9/10/11/12 (Wednesday – Sunday)

4 days waiting periods and weekends

Day 13 (Monday)

Finally the big day. Returned to work from holidays of 2 weeks. Had to take half day leave at work in the afternoon to go fetch the passport. Got the passport within 5 mins reaching the office. Go Home #5

 

Conclusion

If only the 50 million rupees website had hinted that the Police officers will be requiring a proof of address, it would have saved like a week of waiting and a half-day leave for a common citizen of Mauritius.

Emailing those guys seem not to be an options since the old “gov.mu” mail is still up on the website. Gotta call them when I the motivation to 🙁