Contact Tracing COVID-19 With An Open Source App Built on CockroachDB

Contact Tracing COVID-19 With An Open Source App Built on CockroachDB

The thought of developing a solution for “epidemic management” was not what Quarano engineers had in mind this time last year. In fact, Quarano’s story started just a few months ago at a government-sponsored hackathon in Germany. At the hackathon, over 40,000+ participants were asked to build applications and services to help manage and decrease the spread of COVID-19. 

As we now know, contact tracing is an important tactic of managing a crisis. The Quarano team focused their project on making the COVID-19 documentation process more effective.

COVID-19 Management in Germany

The German government operates on a Health Authority basis meaning that each region in Germany has its own authority that makes its own rules for tracing the virus. Health Authorities used (and in some cases are still using) pen and paper to record people’s symptoms and who they have been in contact with. 

Not only is this manual documentation method inefficient and unreliable, it also significantly slows down the process of tracking the virus.

After the 48-hour hackathon, the team had a prototype for Quarano which would become an open-source application for epidemic management. The application helps German health departments trace the spread of COVID-19, organize quarantines, and offer health services for citizens. While their initial mission was to help the German government, Quarano can actually be used by anyone, anywhere.

From the beginning, the team at Quarano knew that they needed a secure, stable, and modern foundation for their application. These requirements initiated the search for a distributed database that would serve as the foundation of their infrastructure. 

Safe, scalable application application

After designing the prototype, the team knew that they were dealing with the most sensitive kind of data and would have to host the application in an extremely secure environment.

Deutsche Telekom, a German telecom, donated the hardware that includes state of the art encryption and resides in Germany. Next, they had to find an encrypted database solution that could be hosted as a cluster in their private cloud.

They wanted the application to have the ability to easily scale to new regions should other authorities want to use it. The application is under an open source license (EUPL-12) meaning that it is free of charge. As such, all the technologies that make up Quarano needed to be open source including the infrastructure and database.

A summary of Quarano’s requirements include:

  • Built-in encryption
  • Ability to scale
  • Great performance
  • Open source foundation

The Quarano team started evaluating distributed databases, testing various performance metrics. Eventually they came across CockroachDB, a cloud-native distributed SQL database. After some initial testing, they were impressed by CockroachDB’s ability to scale and were interested in it’s geo-partitioning capabilities, should their product grow beyond Germany.

An application backend built on a reliable infrastructure 

The Quarano backend is a Spring Boot based application exposing a REST API to track cases of COVID-19 infections. The application backend uses a standard Maven project based on a series of open-source technologies. This system allows patients to log a diary of symptoms which is then monitored by the Health Authorities. (For detailed information, view Quarano’s GitHub page). 

The application collects a lot of data about users (age, gender, symptoms, location, etc), and this metadata is managed and stored in CockroachDB. Because CockroachDB has built-in encryption, Quarano did not have to implement a supplemental encryption solution. The database’s data model is managed with Flyway migration scripts to keep different development and customer environments in sync. 

Diagram of the Quarano application backend

As mentioned above, Deutsche Telekom donated the hardware that hosts CockroachDB. The multi-region deployment uses 3 nodes (one per region) in Germany and each region has 4 vCPUs. This 3-node deployment ensures that Quarano will will always be on and available, even if they encounter a node failure.

Quarano multi-region deployment of CockroachDB in Germany

If Quarano were to add an additional Health Authority located in a new region, they would simply scale CockroachDB by adding more nodes. When a node is pointed at the cluster, it instantly rebalances the data across all of the nodes to incorporate this new resource. With the addition of a new node, they could also scale out the volume of transactions the single logical database can handle. As they add nodes, they are able to scale both reads and writes which would ensure that Quarano is performant. 

Now, if the application’s reach expands beyond Germany, that’s when the team at Quarano would leverage CockroachDB’s geo-partitioning features. Geo-partitioning allows Quarano to tie data to a location at the row level. The purpose of this feature is to help Quarano meet latency requirements by keeping data close to its users, and to comply with data regulations like the GDPR that require data to reside in a particular geographic jurisdiction. 

Distributed technology for contact tracing 

Just 10 short weeks after the initial Hackathon, Quarano was live. The team has made tremendous progress in developing the application and is planning to sign additional Health Authorities in the future. They are currently working on adding more functionality to the app itself to make it more user friendly for citizens, not just healthcare workers.

Quarano Contact Tracing Application

Since the team at Quarano built their application on a distributed, reliable, modern infrastructure, they will have no problem scaling to accommodate new users in the future. We look forward to watching Quarano achieve its mission of helping Germany (& beyond) slow the spread of COVID-19!