Introducing the New Zealand Trade Intelligence Dashboard

I’d like to introduce to you the New Zealand Trade Intelligence Dashboard. This is one of the New Zealand government shiny web apps that should have been mentioned in Peter Ellis’ post. If you are only interested in TRADE, you may go to ‘Commodity Intelligence’ section directly.

The dashboard is developed using R and the shinydashboard package, and it is my very first shiny app from designing to coding. As I have learnt a great deal during its development, I plan to write some follow-up posts on topics such as how to start your first shiny app, how to choose between shiny and shinydashboard, how to choose the best interactive graph/table packages, how to design your app and some tricks in using reactiveValues and some useful functions such as shinyjs::hide, shinyjs::show, shinyjs::disable and shinyjs::enable.

OK. Let’s cut to the chest and see what the dashboard can do for you (with a deliberate emphasis on the Commodity Intelligence tab because of its powerful analytical ability).

First impression

The dashboard has five panels on the left – main dashboard, market intelligence, commodity intelligence, FAQs and StatsNZ releases.

The main dashboard contains “spoon fed” information on trade, which does not require any user input.  On initial load, it only displays high level information in order to save loading time. More detailed trade information will be displayed after clicking the “Show more details” button.

Market intelligence

This tab requires a very simple user input — either one market, or multiple markets or one market group. Additional information on bilateral investment stocks and visitor movements are added. This is the MOST loved and used tab by colleagues from the Ministry of Foreign Affair and Trade.

I love this tab! Why? Because it offers superb analytical ability and flexibility (in my opinion), and it is super easy to use.

After clicking “Commodity Intelligence”, you will see three sub-tabs – Exports, Imports, and Intelligence by HS codes. I will focus on the first and the third one as Imports tab is pretty much identical to its counterpart except that global analysis is NOT available.

Exports –>  Pre-defined

After clicking “Exports”, you have two choices either Pre-defined or Self-defined.

Pre-defined means a list of commodities and services defined by Statistics New Zealand (this option does not give user any flexibility to form their own commodities). Those pre-defined ones are principle or key exports earners. You can search or just select as many as you want and then build a report.

The report has two-stages.

First, it will produce high level information for each commodity/service’s trend and growth performance, and then give user an opportunity to select ONE commodity/service for further analysis. Note that users can use the filter boxes above each column in the growth table to narrow down number of commodities. For example, users can filter commodities above certain export values, above certain CAGR5 (5 year compound annual growth rate) or above certain ABS5 (5 year absolute value change).

At the second stage, after you select ONE commodity, it will take quite a while (30 seconds, so just be patient) to produce the commodity’s market analysis both domestically (for NZ) and internationally (for the whole world). The global analysis part accounts for most of the waiting times because it downloads lots of data from UN Comtrade. Also be aware of the query limits of 100 per hour from UN Comtrade , which means the global analysis could be unavailable after reaching the limit. You may need to wait for another hour (There is a note at the very bottom of the page telling the number of query left and when the limit will be reset).

My favorite graph is the sankey plot that shows the trade flows from exporters to importers, which also gives user the option to show and hide EU-28 internal trade.

Exports –>  Self-defined

It is the coolest option! That is because users will have the flexibility to build their own commodity list based on all 2, 4, and 6 level HS codes.

Users have to follow some STRICT rules to build the HS codes to commodity name grouping/mapping.

  1. It has to be a CSV file

The first column has to be HS codes

  1. you can mix level 2, 4, 6 HS codes

  2. you can miss the “0” in front of Chapter 1 to 9 as the missing “0” will be auto-filled

  3. The second column has to be the description/name of the commodity

After successfully uploading your CSV file, you can build the report and the content of the report is identical to that of Export –> Pre-defined.

Here are two example CSV files. So give a try.

  1. Link to Statistics New Zealand Pre-defined commodity CSV file

  2. Link to the CVS file containing all level 6 HS code under Chapter 84, 85, and 86

Exports –>  Intelligence by HS Codes

This is the most convenient tab!

After selecting this tab, you will see a table with three columns – HS level, HS code, and Classification (HS description).

Regular expression rules are applied to each column via the filter boxes above. Users can search a commodity by simply typing the name in the search box or the filter box above Classification. For example, type firework in either search box or box above Classification column.

User can also use the table to generate a CSV file that can be used in Export –> Self-defined. Try this

  1. Type 6 in the box above the HS level column

  2. Type ^84 ^85 ^86 in the box above the HS code column. ^ means starting with. means or. 84 to 86 are the HS chapters
  3. Click show “All” to display the full table

  4. Click CSV button to download the table as a CSV file

  5. DELET the first column

  6. Now you can use this CSV file as an input for Self-defined analysis

To generate an instant report, users simply click on the interested rows in the table. SIMPLE AS!!

The shinydashboard package is awesome. It is very easy to learn for experienced R users. It offers a very simple structure to follow. The dashboard is also MOBILE compatible out of box, which is a big PLUS! The dashboard can be easily adapted to display any countries’ trade intelligence.

Related