Call for Code 2020

Call for Code 2020


Take advantage of the decentralized, blockchain-based platfrom MiPasa - and build an innovative data-driven application that can help bring life back to normal around the world. Utilize MiPasa’s open data hub to help decision makers make better informed decisions.

Enable developers to build innovative apps that utilize authenticated data sources in the effort to bring life back to normal across the world.

A powerful and scalable platform is required to tackle the ongoing battle with 2020 SARS COV-2 (COVID-19 or “Novel Coronavirus”) that can help validate information, verify data at scale and have the technology, empower and makes it a real change.”

For example, a number of mathematicians and researchers have been working hard to build complex data analyses and predictive models of the solutions. Inconsistencies across data sources will lead to unreliable solutions that may stunt progress and prolong recovery.

HACERA, who was amongst the first players in the Fabric Blockchain Ecosystem since 2016, teamed up with IBM to deploy MiPasa globally for this very reason.

MiPasa is a distributed and secure open verifiable data hub which was designed from the ground up to provide a source of truth for data that engineers all over the world can depend on while building innovative solutions for this time of crisis.

Learning Objectives

In this tutorial, you’ll learn how to use the MiPasa platform to quickly build a simple data analysis application.

This gives developers a launchpad to quickly get started building out unique solutions backed by integrated and up-to-date public health data feeds.


  • Register for a MiPasa account
  • Confirm your e-mail

Estimated Time

This tutorial should take approximately 15-30 minutes to complete.


Flow Diagram


1. Adding Code: Hello World example

  1. Navigate to
  2. Sign in with the account that you registered earlier
  3. Go to Code, then pick New Code
  4. (Optionally) pick the name for your script
  5. Click Save

If you did not change anything, initial code will look like this:

print("Your First Code")

And the output will be:

Your First Code

2. Adding MiPasa data to your Code

  1. Navigate to There, you will have a list of all datasets available to use. Each dataset has multiple files — all of them can be accessed from your code.

  2. In this example, we will use ECDC data feed and produce case distribution charts per country, as well as a simple text table with the exact number of cases for the latest date. If we look at the ECDC dataset, we can see that it has several files. Remember these files, as we will use them in our code later.

    • Source.csv: this is the raw source, as it gets uploaded to our platform
    • Output_ECDC_Cases.csv: this is the table of COVID-19 cases by country, in a normalized format
    • Output_ECDC_Deaths.csv: this is the table of deaths of COVID-19 by country, in a normalized format

3. Using MiPasa SDK to write a simple application

  1. Navigate to your newly created Code script. Tip: You can easily find it at your space.

  2. Use MiPasa SDK and create a client. Note: when using MiPasa SDK in our integrated Code editor, you don’t need an API Key.

import mipasa
client = mipasa.Client()
  1. Retrieve the CSVs for Cases and Deaths tables, by filenames that we have seen in pt.2:

    ecdc = client.get_feed_by_name('ECDC')
    ecdc_cases = ecdc.get_file('Output_ECDC_Cases.csv').get_as_csv()
    ecdc_deaths = ecdc.get_file('Output_ECDC_Deaths.csv').get_as_csv()
  2. Convert the data from both tables to the format that we will need for the charts. For this tutorial, we will need only the data for all countries for the latest date, sorted by number of cases.

import dateutil.parser

# find latest date in the table. table is not sorted, so we have to scan it
latest_date = ecdc_cases[1][2]
for row in ecdc_cases[1:]:
  if not row[2]:
  if dateutil.parser.isoparse(row[2]) > dateutil.parser.isoparse(latest_date):
    latest_date = row[2]

#this is the same CSV, but with only the latest date present
ecdc_cases = [ecdc_cases[0]] + [x for x in ecdc_cases[1:] if x[2] == latest_date]

# this is the same CSV, but with only the latest date present
ecdc_deaths = [ecdc_deaths[0]] + [x for x in ecdc_deaths[1:] if x[2] == latest_date]

# this is the same CSV, but sorted by number of cases (descending)
ecdc_cases = [ecdc_cases[0]]+sorted(ecdc_cases[1:], key=lambda x: int(x[3]), reverse=True)
  1. Produce some text output: we print the total count of COVID-19 cases per country known to ECDC to the console, before generating the charts.

    print('ECDC latest date: %s' % latest_date)
    print('Cases by country:')
    print('%-24s %-12s %-8s %-8s' % ('Date', 'Country', 'Cases', 'Deaths'))
    for case in ecdc_cases[1:]:
      deaths = [x for x in ecdc_deaths if x[1] == case[1] and x[2] == case[2]]
      deaths_num = deaths[0][3] if deaths else '0'
      print('%-24s %-12s %-8s %-8s' % (case[2], case[1], case[3], deaths_num))
  2. Use Matplotlib to produce visual charts based on the same data:

    import matplotlib.pyplot as plt
    def output_chart(name, table):
      countries = {}
      for row in table[1:]:
        countries[row[1]] = int(row[3])
      ko = sor k in countries]
      top_cases = sorted(ko, key=lambda x: countries[x], reverse=True)[:6]
      other = 0
      for k in ko:
        if k not in top_cases:
          other += countries[k]
      labels = top_cases + ['Other']
      sizes = [countries[k] for k in top_cases] + [other]
      explode = [0] * (len(top_cases)+1)
      fig1, ax1 = plt.subplots()
      ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
              shadow=True, startangle=90)
    output_chart('Cases (ECDC)', ecdc_cases)
    output_chart('Deaths (ECDC)', ecdc_deaths)




This tutorial and work was contributed by HACERA

We would like to thank the following IBMers also contributed to the development of this starter kit and tutorial: Porter Stowell, Paige Krieger, Aishwarya Badanidiyoor, as well as of course to Jerry Cuomo and Gari Singh from IBM, for their continued support and great partnership.