COVID-19 Analytics using InterSystems IRIS
Tags: analytics, covid19, visualisation, database
Published: 2021-01-27 08:38:40

Hi colleagues!

Every day Johns Hopkins University publishes new data on coronavirus COVID-19 pandemic status.

I built a [simple InterSystems IRIS Analytics dashboard](http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19) using InterSystems IRIS Community Edition in docker deployed on GCP Kubernetes which shows key measures of the disease outbreak.

[![](/sites/default/files/inline/images/images/screenshot_2020-03-28_12_58_33.png)](http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19)

This dashboard is an example of how information from CSV could be analyzed with IRIS Analytics and deployed to GCP Kubernetes in a form of InterSystems IRIS Community Edition.

Added the [interactive map of the USA](http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19/USA.dashboard):

[![](https://community.intersystems.com/sites/default/files/inline/images/images/covid_usa.gif)](http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19/USA.dashboard)

<!--break-->

The [next dashboard shows the timeline](http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19/Daily.dashboard):

[![](/sites/default/files/inline/images/images/screenshot_2020-03-28_20_48_27.png)](http://34.77.54.254:52773/dsw/index.html#/IRISAPP/Covid19/Daily.dashboard)

<!--break-->

And can be filtered by country. E.g. here is [in the USA:](http://34.77.54.254:52773/dsw/index.html#!/d/Covid19/Daily.dashboard?ns=IRISAPP&FILTERS=TARGET:*;FILTER:%5BDay%5D.%5BH1%5D.%5BMonth%5D.%26%5BNOW%5D~%5BCountryRegion%5D.%5BH1%5D.%5BCountryRegion%5D.%26%5BUS%5D)

[![](/sites/default/files/inline/images/images/screenshot_2020-03-28_21_05_49.png)](http://34.77.54.254:52773/dsw/index.html#!/d/Covid19/Daily.dashboard?ns=IRISAPP&FILTERS=TARGET:*;FILTER:%5BDay%5D.%5BH1%5D.%5BMonth%5D.%26%5BNOW%5D~%5BCountryRegion%5D.%5BH1%5D.%5BCountryRegion%5D.%26%5BUS%5D)

The source code of the application is [available on Open Exchange.](https://openexchange.intersystems.com/package/covid-19-analytics)

How does it work?

Demo runs using InterSystems IRIS Community Edition docker container and exposes InterSystems IRIS BI dashboards using DeepSee Web representation layer via MDX2JSON REST API. Its deployed on GCP and operates using Google Kubernetes Engine (GKE).

**How it was developed** 

The data is taken from the [Johns Hopkins repository](https://github.com/CSSEGISandData/COVID-19) in CSV form.

Classes, cubes, and initial pivots were generated via [Analyzethis](https://openexchange.intersystems.com/package/AnalyzeThis) module, thanks @Peter.Steiwer<span>!</span>

Import method then was introduced using the CSVTOCLASS method, thanks @Eduard.Lebedyuk!

<span>Dashboards are rendered with <a href="https://openexchange.intersystems.com/package/DeepSeeWeb">DeepSee Web (DSW)</a> module.</span>

IRIS BI [artifacts (pivots, dashboards)](https://github.com/evshvarov/covid-19/tree/master/src/dfi) were exported by [ISC.DEV](https://openexchange.intersystems.com/package/ISC-DEV) module:

<pre>IRISAPP> d ##class(dev.code).workdir("/irisdev/app/src")

IRISAPP> d ##class(dev.code).export("*.dfi")</pre>

The code has been developed using [VSCode ObjectScript](https://openexchange.intersystems.com/package/VSCode-ObjectScript), thanks @Dmitry.Maslennikov.

**Building docker image for development and deployment**  
All the deployment sits in [Dockerfile](https://github.com/evshvarov/covid-19/blob/master/Dockerfile). With Dockerfile we build an image with data, web apps and modules installed and properly setup and then we deploy the image to GCP Kubernetes.

This Dockerfile is a modified version of this [Template Dockerfile](https://github.com/intersystems-community/objectscript-docker-template/blob/master/Dockerfile) which is described very well [in this article](https://community.intersystems.com/post/dockerfile-and-friends-or-how-run-and-collaborate-objectscript-projects-intersystems-iris).

So I will stop only on new parts. 

<pre>17 COPY  data files</pre>

here we copy CSV files from data folder to the container

<pre>set pfile = "/opt/irisapp/files/covid-"_$tr($zd($h-1),"/","-")_".csv", rc=0 \
  do ##class(AnalyzeThis.Generated.covid03162020).Import(,pfile,",", ,1,.rc) \
  write "imported records: "_rc \
  do ##class(%DeepSee.Utils).%BuildCube("covid03162020") \</pre>

This code imports the latest data and builds a cube.

<pre>zpm "install dsw" \</pre>

Here we install DeepSee Web.

<pre>do EnableDeepSee^%SYS.cspServer("/csp/irisapp/") \</pre>

This enables IRIS Analytics (DeepSee) for /csp/irisapp web app.

<pre>zn "%SYS" \
  write "Modify MDX2JSON application security...",! \
  set webName = "/mdx2json" \
  set webProperties("AutheEnabled") = 64 \
  set webProperties("MatchRoles")=":%DB_IRISAPP" \
  set sc = ##class(Security.Applications).Modify(webName, .webProperties) \
  if sc&amp;lt;1 write $SYSTEM.OBJ.DisplayError(sc)</pre>

This code is needed to make the analytics web app be available without credentials.

COPY irisapp.json /usr/irissys/csp/dsw/configs/

And this command helps to set DSW configuration.

**Deployment to Kubernetes**

The deployment procedure is being processed by Github Actions - and [this workflow](https://github.com/evshvarov/covid-19/blob/master/.github/workflows/workflow.yaml) handles it on every commit to the repository.

Github workflow uses Dockerfile we built on a previous step along with [Terraform](https://github.com/evshvarov/covid-19/tree/master/terraform) and [Kubernetes](https://github.com/evshvarov/covid-19/tree/master/k8s) settings. 

The procedure is identical to the one described in [this article](https://community.intersystems.com/post/deploying-intersystems-iris-solution-gke-using-github-actions) by @Mikhail.Khomenko.

**How to run and develop it locally**

You are very welcome to run, develop  and collaborate with this project.

To run it locally using docker do:

Clone/git pull the repo into any local directory

    $ git clone https://github.com/intersystems-community/objectscript-docker-template.git
    

Open the terminal in this directory and run:

    $ docker-compose build
    

<ol start="3">
  <li>
    Run the IRIS container:
  </li>
</ol>

    $ docker-compose up -d

Once the container is built up and running open the application on:

<pre>localhost:yourport/dsw/index.html#!/d/Covid19/Countries.dashboard?ns=IRISAPP</pre>

**How to Develop**

This repository is ready to code in VSCode with the ObjectScript plugin. Install <a href="https://code.visualstudio.com/" rel="nofollow">VSCode</a>, <a href="https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker" rel="nofollow">Docker</a> and <a href="https://marketplace.visualstudio.com/items?itemName=daimor.vscode-objectscript" rel="nofollow">ObjectScript</a> plugin and open the folder in VSCode.

**How to Contribute**

Fork [the repository](https://github.com/evshvarov/covid-19), make changes and send Pull Requests. [See the video for more information.](https://www.youtube.com/watch?v=1x0hC_MlRfg&t=4s)

Would love to see your contribution!