Griffins Proposal

From Analytics Practicum
Jump to navigation Jump to search
Home Project Report Project Management Deliverables


Final Report

Final Report and Poster
Poster

Overview

The Health Promotion Board (HPB) was established as a statutory board under the Ministry of Health in 2001 with a vision to build a nation of healthy people. HPB organises many Health Promotion programmes and requires many tools to assist them in planning to ensure efficient outreach and maximize public resources. HPB is also tasked under the Healthy Living Master Plan, to enable Singaporeans to have access to healthy living at the “doorstep” of every home, workplace and school, by 2020.

Motivation

Currently, the process to calculate the accessibility of healthy living amenities at HPB is highly manual. The HPB staff are required to do perform analysis within selected areas for their outreach programmes, and this is largely done on excel spreadsheets. In addition, new colleagues typically have difficulties picking up technical skills related to GIS (such as using QGIS), and hence, are very reliant on a small group of staff that with the technical skills, to perform geospatial queries.

Objectives

Our project aims to provide a custom GIS platform, named Healthy360, that will reduce manual data entry, is easy to use, and will enable the staff to gain greater insights into the data they currently possess.

Healthy360 will be in the form of an interactive and visual web application that utilises GIS functions for geospatial planning and analysis and will allow the user to do the following:

  1. Check HPB’s KPI, i.e. obtain the percentage of dwelling units that has access to x number of amenities at x buffer distance
  2. Obtain the number of amenities surrounding each HDB block at a set buffer distance or at varying distance for each amenity
  3. Identify HDB blocks that are classified under high, medium and low risk

These functions aim to allow HPB staff to identify blocks with limited accessibility and plan for more healthy living amenities in the vicinity.

Literature Review

The concept of measuring accessibility of amenities from specified points has been explored is various projects.

One of the past projects done by SMU Geospatial Analytics students is highly similar to Healthy360. The application by Team Blank seeks to identify service gaps in the planning area of Bedok. Users can choose a particular service and select the buffer distance. The application will then output the number of blocks located within the selected buffer distance of the amenity selected. If more than one amenity is selected, the application will classify blocks that are located within the buffer of both amenities to be “Best Match” and the rest to be “Good Match”.

However, calculations to check for the number of blocks are not done on the fly. Instead, it is pre-calculated and saved as an attribute in the .js layers. Healthy360o aims to improve on this application and adopt on-the-fly calculations. This will provide the user with the flexibility to change .js layers and still be able to obtain an output. In addition, performing the calculations on-the-fly will mean a more lightweight application.

Team Blank’s application: 200m buffers around bus stops and libraries
Team Blank’s application: 200m buffers around bus stops and libraries


Another application done by a SMU Geospatial Analytics student, Sim Jing Xiang, contains functions that is similar to Healthy360o as well. His application seeks to help property developers identify areas to build new properties like shopping centre. The application allows the user to select a service type, shopping mall or library, and a buffer distance. A buffer is then set from the centroid of every planning area, and the number of services that falls within the buffer is calculated. The more services the buffered area has, the darker the colour of the buffer. Although this application performs the calculation on the fly, creating the buffer from the centroid of each planning area is not ideal. This is because the central region of Singapore has planning areas that smaller sized, whereas areas in the north and the west have huge planning areas. As a result, the distribution of the buffer circles are not even, and locations in the central area tend to have higher density of amenities. Healthy360o aims to make improvements by buffering from individual HDB blocks instead.

Sim Jing Xiang’s application: 2.4km buffers to identify areas with high density of libraries
Sim Jing Xiang’s application:: 2.4km buffers to identify areas with high density of libraries



Data

All datasets used in Healthy360o are obtained from HPB and data.gov.sg, and can be assumed to be valid and accurate. Healthy360o contains the following point layers and polygon layers
Point layers

  • Healthier dining options (Restaurants, Fast food, Coffeeshop, Foodcourt)
  • Smoking Cessation Areas
  • National Parks
  • Malls with physical activities
  • HDB Blocks

Polygon layers

  • Choropleth map of HDB blocks by planning area
  • Choropleth map of dwelling units by planning area


The point layers’ datasets came in the form of .csv with only postal codes. To obtain the spatial coordinates, the postal codes were geocoded using OneMap API, and the xy coordinates under the SVY21 projection were retrieved. The coordinates could be retrieved from all the postal codes with the exception of 1 HDB building. The .csv files were then exported as .shp files using QGIS, with xy coordinates projected to wgs4326, to allow for distance calculation at a later stage.

Exporting the coordinates of the points using QGIS in-built functions
Exporting the coordinates of the points using QGIS in-built functions


Using QGIS, the styling of the layers were also edited, to reduce the hassle of coding it from scratch. The link to the layer’s markers and pop-up box content are added as new attributes, under the column “icon_exp” and “html_exp” respectively.

The HDB point dataset provided by HPB contains the planning area which it falls within. This is used to calculate the number of dwelling units and blocks of each planning area using pivot table in excel. This data is then matched to the planning area polygon .shp file in QGIS. A choropleth map is then generated under the jenks method.

The QGIS2Leaflet package was then applied from QGIS to output the layers in .js format.

Sample of js file
Sample of js file


Features and Methodology

Feature 1: Calculate number and percentage of units with access to amenities

HPB requires an application that allows the user to set the minimum number of amenity needed within a set distance from the HDB. The user will be allowed to vary the minimum number and distance for each amenity. The application will then check if the conditions is met for every HDB block, and return the number and percentage of HDB blocks and the dwelling units (within each HDB block), that meets the criteria set.

Healthy360 provides the interface to do the above. Users are able to select from a dropdown list, the minimum number of amenities needed within a fixed buffer distance.

Pop-up window for user to set criteria for calculating the KPI

On backend, without a localhost, all calculations are done on the fly. The application loops through each individual HDB Block in the .js file, and for each individual block, it loops through each type of the amenity, and each of the point from each amenity type. Each individual point is retrieved from the .js using .eachlayer, a leaflet.js function.

It then computes the distance between each point to each HDB block, and compares the distance to the user’s selection. Distance is calculated using .distanceTo, another leaflet.js function. If it is smaller or equals to the distance selected, it adds one to counter of that amenity type, and loops until all the points have been exhausted.

For healthier dining options, it is slightly more complex, for it has three types of dining amenities, restaurant or fast food, food court and coffeeshop, under the same layer, i.e. within the same js file. When checking for healthier dining options, an additional check is placed at the end to check if the type of healthier dining matches the user’s selection, before adding one to the counter.

Function that iterates through every point in the HDB layer, and then subsequently every point in healthier dining layer
Function that iterates through every point in the HDB layer, and then subsequently every point in healthier dining layer


The counter for each individual amenity is then compared to the user's selection, if it is greater than or equal to what the user chose, the number of dwelling units in that HDB block would be added to the counter for total dwelling units.

if else condition to check which amenities’ conditions are met
if else condition to check which amenities’ conditions are met


After looping through all the HDB blocks, the number stored in the dwelling units counter would be divided by the total number of dwelling units and a percentage will be returned to the user. A .csv file of the blocks that fulfils the criteria set can also be generated and downloaded.

Number and percentage of the households are displayed on the sidebar. User can specify the name of the .csv file to be download
Number and percentage of the households are displayed on the sidebar. User can specify the name of the .csv file to be download


Sample of CSV file, data here is merely a mock sample due to confidentiality of the data
Sample of CSV file, data here is merely a mock sample due to confidentiality of the data


Feature 2: Identify number of amenities around a single HDB block

This feature allows the user to search for an address, done using GoogleMaps API, set the buffer distance and query for the number of amenities around it. Healthy360 allows users to drag the marker as well, should GoogleMaps be unable to return a result or if they are unsure of the address.

The user also has the option to set a standard buffer distance for all the amenities, or vary the distance per amenity.

Search box for address is located on the sidebar. Dropdown list located just below it allows user to set a fixed buffer distance for all amenities, and this is reflected on the map as a red buffer zone. Else, users can click on "Modify Individual Buffer Distance" to set varying buffer distances for each amenity
Search box for address is located on the sidebar. Dropdown list located just below it allows user to set a fixed buffer distance for all amenities, and this is reflected on the map as a red buffer zone. Else, users can click on "Modify Individual Buffer Distance" to set varying buffer distances for each amenity. The results are then displayed on the side bar as well


Pop up box when user clicks on "Modify Individual Buffer Distance
Pop up box when user clicks on "Modify Individual Buffer Distance


Once selected, the application loads the amenities’ layers on backend and loops through each point. The distance between the point and the selected HDB block is then calculated and compared to the user’s selection. This process is the same as the KPI calculation.

Feature 3: Identifying and displaying risk levels of the HDB blocks

In categorising the risk level of the HDB blocks, HPB has set a criteria that observes 3 categories.

  • Obesity: Nutrition (Healthier dining options)
    • Restaurants or fastfood
    • Food court
    • Coffeshops
  • Obesity: Physical Activity
    • Health promoting malls
    • Sundays at the park
  • Tobacco Control
    • Smoking cessation areas

A HDB block is classified under low risk, if fulfils the conditions set in 2 of the 3 categories. It is classified under medium risk, if it fulfils the conditions set in 1 of the 3 categories. It is classified under high risk, if it does not fulfil any of the conditions set in all the categories.

This function is linked with the KPI calculation function in the web application. The conditions for each layer is taken to be the same conditions used to calculate the KPI, i.e. the minimum number of amenities that should exist within the selected buffer distance. As long as at least one layer from each category is selected, the risk level will be computed at the end of each loop through the HDB layer. A geojson object is then created and plotted to the map. Each HDB point is a single geojson object.

Risk level of HDB blocks visualised on the map. The number of each amenity is displayed in the pop up as well, to give users a better understanding of why this block is classified as low risk.
Risk level of HDB blocks visualised on the map. The number of each amenity is displayed in the pop up as well, to give users a better understanding of why this block is classified as low risk.


Code to calculate the risk of the HDB and plot it on the map is inserted within the KPI feature function, at the end of the loop through each HDB block
Code to calculate the risk of the HDB and plot it on the map is inserted within the KPI feature function, at the end of the loop through each HDB block



Process Map


Code to calculate the risk of the HDB and plot it on the map is inserted within the KPI feature function, at the end of the loop through each HDB block


Technologies
Code to calculate the risk of the HDB and plot it on the map is inserted within the KPI feature function, at the end of the loop through each HDB block


Technology Description
Bootstrap An open-source framework for front-end development to add aesthetics to our web application.
D3.js Manipulate data using HTML, SVG, and CSS to allow interaction and animation for our map.
GeoJSON An open standard format designed for construction of simple geographical features with their non-spatial attributes based on JSON.
Leaflet.js An open-source JavaScript library for interactive maps to help us add in the needed interactions.
OpenStreetMap.org A free to use map of the world under an open licence which will be used for our mapping in our web application.
QGIS A free and open sourced geographic information system to create, edit, visualise, analyse and edit geospatial information.


Areas of further development


Composite value in calculating risk levels
In calculating the risk levels of the HDB flats, a more comprehensive method can also be developed. Different weightage can be given to each amenity, depending on its importance to providing healthy living standards. For instance, parks and gyms can be given a weight of 0.9 (out of 1) while fruit stalls or smoking cessation points can be given a lower score of 0.6. The scores can then be added up and compared against a benchmark, to rate the risk level of each HDB flat.

Other uses
Currently, the scope of the project is limited to HDB blocks (i.e. public housing). But given the address search bar and draggable marker, the functionalities of Healthy360o can be extended to private housing and even business units. Entrepreneurs looking to set up a salad shop or heathlier dining restaurant, can use Healthy360o to check for areas of high risk and seek to set up a shop in the vicnity.

The application can also be used to identify areas are higher crime rates, by replacing the data layers with data layers of crime. The relevant authorities can then use the data to send more police patrol to the area.