The Relicans

Cover image for Hackathon Submission: Covid-19 Vaccination Data in GraphQL
Peter Mbanugo
Peter Mbanugo

Posted on

Hackathon Submission: Covid-19 Vaccination Data in GraphQL

What I built

I built an API that serves the vaccination rollout data provided in a CSV file over GraphQL. This API can be used to present vaccination statistics for educational purpose, as well as inform citizens on the progress of vaccination for a specific country.

Category Submission

Science and Observation

App Link

The app is available using this link. You get to try the API using a GraphQL Playground.

Link to Source Code

You can access the source code at github.com/pmbanugo/covid19-vaccination-graphql.

Permissive License

The permissive licensed used is BSD-2.

Screenshots

Here's a screenshot for a query to get the aggregated record for total vaccinations and people vaccinated across the world.

GraphQL Playground

The screenshots below show the performance data collected by New Relic's Node.js agent and Apollo GraphQL plugin for New Relic.

Web Transaction percentile & histogram

Web Transaction percentile

Web Transaction histogram

Apdex score currently below 1

Apdex score currently below 1

Throughput

Throughput

Transactions/Requests and Error Rate

Error rate

Node V8 Memory Usage

Node V8 Memory Usage

Errors

I'm using Apollo GraphQL server plugin to collect GraphQL specific trace data. I'm not sure if I can see more details regarding how the GraphQL resolvers are performing but at least I can see the errors.

Error Page

Description

A lean GraphQL API to get daily reported data about Covid-19 vaccine rollout across the world. The data is based on the CSV data gotten from Our World In Data.

Background

I am working on a demo project to show some graphing capabilities of a library and I chose to do something on Covid-19 vaccine rollout because once in a while I want to easily see what the state of the rollout is. There are a few REST API available, some hard to use and I do not always need all the records/fields return from some endpoint. I found the CSV data provided by Our World In Data to be nicely structured but they don't provide an API for it. Also, most other REST APIs are based on the data they provide. I wanted an API that makes it easy and possible to query specific fields as needed.

GraphQL is a good way to build an API that gives the client control over what kind of data they want back. There are currently no GraphQL API for this and I decided to build one.

This API can be used to present vaccination statistics for educational purpose, as well as inform citizens on the progress of vaccination for a specific country.

How I built it

The API is built using Node.js and Apollo GraphQL server. It fetches its data from a remote CSV file that gets updated daily and puts the data in-memory. The app is configured to run on docker and can be deployed on any platform that supports running containers.

I used the Node.js agent to collect metrics for the application, and also configured Apollo server plugin for the agent. Distributed tracing is enabled by setting NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=true environment variable in the docker file.

The API is running in a container deployed on Knative. I want to collect logs using FluentBit but I couldn't get it working properly with New Relic FluentBit integration. I left a comment in the help thread and I may update the application to support Fluent Bit if I get that resolved.

Additional Resources/Info

If you want to deploy the API yourself, you can find more details in the GitHub repository README. It should be just building and running the image, but you need to specify certain flags for New Relic and also exposing mapping the right port.

Discussion (0)