Web Programming - Short Introduction

Optional Challenge: Parameterize the Data Viewer

Now we have a web site that consumes a Python service. But it does so only for data from The Netherlands. This section contains an optional challenge for those of you that have interest (and time!) to take it a bit further: to create a parameterized version where the users can make their own choice of country to show the bar chart for. This would make the Data Viewer page you created earlier quite a bit more useful...!

The Challenge

We will not tell you step-by-step how to do this, you should try to be creative and pull together all the techniques you have learned to achieve the following:

  • The web page should offer the users a list that lets them choose between several countries. It is up to you how you create this list, there are many options ranging from
    • Simple (create a fixed list of a few options), to
    • Complicated (getting the country list from the actual DB);
  • Based on the choice of country, the chart should show population numbers per province of that country.
  • Based on that same choice, the map should show the provinces of the country chosen.

A Solution

There are many different ways this can be achieved. One possible solution is in the listings below, it will be revealed later...