Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

covid-tracker-group/backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Covid tracker backend

Running tests

go get github.com/golang/mock/mockgen
go generate ./...
go test ./...

Data

Observation data

Observation data is stored as a collection of files: one for every device, as identified by an authorisation code. Each file is a CSV file with the following fields:

Field Type Description
processed_at integer UNIX timestamp this record was processed and stored
day_number integer Day Number the Daily Tracing Key was used
key string BASE64 encoded Daily Tracing Key

The filename is <authorisation code>.csv. This allows for very efficient deletion of expired authorisation codes.

Authorisation codes

Valid authorisation codes are stored as a collection of files, one for each authorisation code. The filesystem modification timestamp is used as code creation timestamp. This approach is chosen for two reasons:

  1. The Go runtime does not expose the creation timestamp in FileInfo, so we use the modification timestamp as a proxy.
  2. This allows is to efficiently expire codes without having to open and read many files.

In order to allow validation the creation timestamp is also stored inside the file as a UNIX timestamp in text format.

Deployment

The first step is to prepare some directories where data will be stored

Directory Description
<data-dir>/records Storage for daily tracing key data
<data-dir>/tokens Storage for daily tracing authorisation tokens

The default data directory is /var/lib/covid-tracker, but you can specify a different location with the -data option to all commands.

Health API server

The health API server must be deployed as part of a chain of HTTP servers:

+--------------+      +--------------+      +---------------+
|              |      |              |      |               |
|  SIAM proxy  +----->+  Health API  | +--> | Front-end app |
|              |      |  server      |      |               |
+--------------+      +--------------+      +---------------+

The SIAM proxy will handle authentication and authorisation. Authorised requests will be forwarded to the Health API server. This will handle API calls internally, and hand of all other (GET) requests to the front-end app. It can do this in two ways: either by proxying to another webserver (like webpack-dev-server during development), or by serving files from the filesystem.

Definitions

  • day number: the number of seconds since Unix Epoch Time divided by 86400. Please note that this means a day in this context does not match a day in local time (or in any other timezone). This definition is taken from the Apple/Google specification.

  • daily tracing key: a 16-byte number used to generate Rolling Proximity Identifiers, as broadcast over BLE. This definition is taken from the Apple/Google specification.

  • medical practitioner: a person or organisation who is legally allowed to run Covid tests.

  • test authorisation token: an token that is generated by a licensed health practioner and given to a person to allow reporting a positive Corona test result.

  • tracing authentication token: an access token that must be used to submit daily tracing keys.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages