Problem Foundation:

Identify 4 best locations where client (leading cardiac hospital in Kochi) can place bill boards with hospital’s emergency numbers and Ambulance service details for promoting the hospital

Decision problem: Where should the hospital place the Bill boards in city.

Research Objectives: Explore the types/categories who are prospect consumers for the hospital and Idetify the locations where there is high proximity of such consumers

Selecting the City: Cochin

Cochin

We selected Cochin as City for the analysis because of following reasons:

  1. in 2012 Survey by Saffola, Cochin has 32% of consumers with higher levels of Cholestrol, which is highest among cities in india.
  2. Cochin is second highest in Obesity levels in India with 75% of people being overweight.
  3. These are the 2 sigificant reasons for cardiovascular diseases, hence we picked Cochin as City for Analysis, as potentially it will have need for more Cardiac hospitals

Source: Saffola Survey - Times of India

Consumer profile of Cardiac hospital

There are 2 Major consumers for Hospitals:

  1. Patients who take preventive care, like Medical tests and prevetive checkup. The consumers who use these services are normally affluent clas consumers.
  2. Patients who suffer Cardiac diseases,these patients are generally aged and are in critical need of Emergency and Ambulace services. These cosumers are from all income classes

These are 2 main categories of patients who would be target audience for bill boards

Entity List

Before Identify the entity list for searching the places / consumers, we need to identify the causes and extract Etities.

Main reasons for cardiac diseases are:

  1. Poor diet: High dependence on processed and fried foods and a menu lacking vegetables, fruits and whole grains would make people vulnerable to heart diseases
  2. Erratic lifestyles: “Most urban youngsters consume too much fatty oily food, and this is coupled with a fastpaced sedentary lifestyle
  3. Smoking: continues to cause heart problems with studies stating that one among six youngsters in the country smokes.

Based on above reasons the potential etities which would be suitable are selected as below:

  1. Malls : This is the source for high density and also the potential place for Affluent consumers, This a potential entity for preventie care consumers.
  2. Hospitals : This is the Entity to identify consumers who are in need of Hospital services.
  3. Meals Takeaway & Restautants : These 2 entities identify consumers with 2 of our main reasons(Poor Diet & Erratic Life styles), this entity helps identifying locations of such consumers.

Code and Analysis

location of KochiThe location of Kochi is 9.9700° N, 76.2800° E (We assumed this is the Location of hospital) and the total area of Kochi is 94.88 Square KM. Inorder to get optional locations we picked 10 Miles (~15 Kilometers) as Radius for analysis. As this is Cardiac hospital it may not be advisable to promote beyond 10 miles distance from Hospital.

Include the necessary libraries

options(warn=-1)
library("RCurl")
library("jsonlite")
library("plotGoogleMaps")
library("geosphere")

Search using Google API for Malls, Hospitals, Meal_takeaways ad Restaurants in 10 Miles radius around the hospital.

Step 1: Collect the data

key = "AIzaSyAUVDc3LzW6pVgcAkP2k4EoH_JX5noq-m8"
# malls search
url = paste0("https://maps.googleapis.com/maps/api/place/radarsearch/json?&query=malls+in+cochin&types=shopping_mall&minprice=4andmaxprice=4,ma&location=9.9700,76.2800&radius=10000&key=",key)
doc <- getURL(url)
x <- jsonlite::fromJSON(doc)
malls = x$results$geometry$location
# hospitals
url = paste0("https://maps.googleapis.com/maps/api/place/radarsearch/json?&query=hospitals+in+kochi&types=hospital&minprice=4andmaxprice=4&location=9.9700,76.2800&radius=10000&key=",key)
doc <- getURL(url)
x <- jsonlite::fromJSON(doc)
hospitals = x$results$geometry$location
#meal_takeaway
url = paste0("https://maps.googleapis.com/maps/api/place/radarsearch/json?&query=meals+take+away+in+kochi&types=meal_takeaway&minprice=4andmaxprice=4&location=9.9700,76.2800&radius=10000&key=",key)
doc <- getURL(url)
x <- jsonlite::fromJSON(doc)
meal_takeaway = x$results$geometry$location
#Restauraunt
url = paste0("https://maps.googleapis.com/maps/api/place/radarsearch/json?&query=restauraunts+in+kochi+malls&types=restraraunts&minprice=4andmaxprice=4&location=9.9700,76.2800&radius=10000&key=",key)
doc <- getURL(url)
x <- jsonlite::fromJSON(doc)
restaurants = x$results$geometry$location

Aggregate all the results and write the results into one csv file, the file will be placed in your default mydocuments folder

malls$type = "Mall"
hospitals$type = "Hospital"
meal_takeaway$type = "meal_takeaway"
restaurants$type = "restaurants"
data = rbind(malls,hospitals,meal_takeaway,restaurants)
write.csv(data,"kochi_places.csv", row.names = F)
dim(data)
## [1] 711   3

As you can see total of 711 locations in Cochin are Identified with above criteria

Step 2: Explore the data

Plot the all 711 locations on Google Maps to explore the areas with highest Density

#sample = all aggregated data
sample = data
coordinates(sample) <-~ lng +lat # Create cordinates
proj4string(sample) = CRS('+proj=longlat +datum=WGS84') # Add Projections

m<-mcGoogleMaps(sample,zcol = "type", mapTypeId='ROADMAP') # Plot on Google maps

Results

Need to zoom the map by 2 notches to see the exact map as image

Step 3: Identify the areas of interest for Placing the bill boards

As you ca see the areas with highest density of ay of the entities would be potential areas for advertising.

Below mapshows the areas with top highest density

Results

The Top 4 ares are:

  1. Shanmugam Road / Park Avenue , Cochin : Latitude 9.97715 Longitude 76.27732
  2. Megamart Area, Diwans Road Cochin : Latitude 9.96541 Longitude 76.28420
  3. Elamkulam Junction, Sahodan Ayyappa Road, Cochin : Latitude 9.96781 Longitude 76.30490
  4. KB Jacob Road Locality, Near Fort Kochi, Cochin : Latitude 9.96578 Longitude 76.24211

Step 4: Interpretation

  1. Shanmugam Road / Park Avenue , Cochin is one of the potential area, this locality has ample Malls and hospitals which make it one of the potential areas
  2. Megamart Area, Diwans Road Cochin , Cochin This area is again significant with ample presense of malls such as Megamart, Hospitals like lakshmi hospital and quite a few restaurats like krishna inn etc.
  3. Elamkulam Junction, Sahodan Ayyappa Road, Cochin This is one of the most populous area with malls, offices and has high proximity of affluent class people which has more potential for preventive category cosumers.
  4. KB Jacob Road Locality, Near Fort Kochi, Cochin This seems one of the most populous as well as affluet areas with good number of restautants and shoppig areas.

Step 5: Plot Selected Bill board areas on Graph

Use R Leaftlet Library to plot the selected Bill board areas on Map

library("leaflet")
m = leaflet() %>%
  addTiles() %>%
  addMarkers(lat=9.9700, lng=-76.2800, popup="Billboard Areas")
  cities <- read.csv(textConnection("
City,Lat,Long,Pop
                                  SelectedArea1,9.97715,76.27732,20
                                  SelectedArea2,9.96541,76.28420,20
                                  SelectedArea3,9.96781,76.30490,20
                                  SelectedArea4,9.96578,76.24211,20
                                  Hospital,9.9700,76.2800,20
                                  "))
leaflet(cities) %>% addTiles() %>%
  addCircles(lng = ~Long, lat = ~Lat, weight = 1,
             radius = ~sqrt(Pop) * 30, popup = ~City)

Step 6: Calculate distances

Caluclate the distance between each bill board area selected to ensure they are far enough

area1 <- c(9.97715,76.27732)
area2 <- c(9.96541,76.28420)
area3 <- c(9.96781,76.30490)
area4 <- c(9.96578,76.24211)
hospital <- c(9.9700,76.2800)
splaces = rbind(area1,area2,area3,area4,hospital) 
# calculate distances
dist_mat = matrix(0,nrow(splaces),nrow(splaces))
for (i in 1:nrow(splaces)){
  for (j in 1:nrow(splaces)){
    dist_mat[i,j] = distCosine(splaces[i,],splaces[j,], r=6378173)/1000    
  }
}

dist_mat
##           [,1]      [,2]     [,3]     [,4]      [,5]
## [1,] 0.0000000 0.8262232 3.080081 3.931094 0.3530577
## [2,] 0.8262232 0.0000000 2.305196 4.685474 0.4829907
## [3,] 3.0800808 2.3051957 0.000000 6.989996 2.7724729
## [4,] 3.9310938 4.6854740 6.989996 0.000000 4.2193946
## [5,] 0.3530577 0.4829907 2.772473 4.219395 0.0000000

As shown in the results, the Bill board areas selected are far from each other at a distace of 0.3 miles to 7 miles

Caluclate the distance between each all the 711 etity points selected and create a clustering Dendogram

Including the entire distance calculations for all 711 entities is slowing the markdown drastically. hence we excluded it from the markdown and shared it in R Code.

Conclusion

  1. Kochi is selected as city of study as it has high probability of cardiac cases
  2. Studied the 2 major consumer segments who are potential consumers
  3. Identified 4 entities and explored the locations of highest density of those entities and plotted on Map
  4. Top 4 areas with highest density are identified for placing the Bill boards.

….