Hamagen — Fight Coronavirus and Preserve Privacy

Oded Leiba
3 min readMar 23, 2020

Israel’s Ministry of Health is releasing a new mobile app, Hamagen, for fighting COVID19 by checking for intersections between the geographical routes of the user and of infected people. It’s open source, completely voluntary and preserves the privacy of the user. I reviewed the code of the application before it was publicly released.

The Coronavirus crisis forces us as humanity to collect the best of our efforts, minds, and technological tools to beat down this elusive enemy.
If anything has changed since the last major pandemic in the shape of the Spanish flu in 1918, it is our ability to share information and collaborate.

A common strategy to face the virus and combat its inherent exponential growth is to flatten the curve: practice methods such as social distancing, “trace, test and treat”.
As may seem immediately clear, it is economically infeasible to test an entire population. Also, actions such as social distancing are very heavy “hammers”, which take a huge toll on a country’s economy.
In order to identify infected candidates and separate them from the rest of the population as soon as possible, physical routes of confirmed cases are being published on a regular basis. At the early outbreak phase, the primary method to extract such information is by an epidemiological investigation. The hour-by-hour routes are published on the Ministry of Health website and citizens are asked to compare their own courses to those of the infected.

An example of a daily announcement of the Israeli Ministry of Health: hour-by-hour course of Patient no. 264 (Hebrew)

It is soon figured out, that it doesn’t scale to meet the virus spread. People aren’t able to keep up with the need to scan all new infected routes. Moreover, the patients have limited memory (and precision) as human beings.

As of today, many countries facing the Coronavirus have already taken measures to extract the infected patients’ whereabouts from their digital footprints. Some of which are China, South Korea, Singapore, and USA.

Israel was no different. From a relatively early stage, the Israeli government has given a green light to the Shin Bet (its domestic security service) to track citizens’ movements to efficiently notify infection suspects that they are required to self-quarantine immediately.

As a democracy exiting its third general elections within a single year, still under a transitional government, this step sparked a huge debate. In fact, Israel’s supreme court of justice has pushed back the execution of such civilians’ tracking due to privacy violations.

As a person who cares a lot about individual liberty and privacy in particular, this imposes a large conflict.
Such a tracking tool can save lives, but on the other hand, many lives throughout history were sacrificed to gain freedom from such exact oppressive scenarios.

An app like Hamagen solves it.

On this app, users opt-in to activate their mobile GPS, and their information never leaves their device.
Instead, the app fetches the relevant infected people’s routes from the MoH servers and looks for overlaps locally. If it finds an overlap with a sick person’s location in time, it notifies the user and provides him with the updated instructions.
From the infected citizen perspective, data is also shared voluntarily, anonymized and mixed with other infected people.
For fairness, it should be noted that such an opt-in approach may potentially gather less geographical information regarding patients and miss possible candidates for quarantine (however, gathered locations may be more precise due to GPS activation rather than relying on cellular networks). Also, fetching the sick people’s records should be done with care in order not to overwhelm the device’s bandwidth and memory.

Fetching the infected patients’ records and checking locally for intersections (source: Github).

I was fortunate enough to code review the application before it was publicly released and attest that no geographical information is leaked.
The project draws its power from the consent of the community, and to complement its voluntary nature it is open source and warmly welcomes contributions.

These are hard times.
However, I am inspired by our ability as people to harness our everyday skills to cooperate and work towards solutions, without cutting corners on our hard-earned society values and freedom.

--

--