All Projects → MohGovIL → rn-contact-tracing

MohGovIL / rn-contact-tracing

Licence: MIT license
React Native Library For Contact Tracing Over BLE (Bluetooth Low Energy) To Fight COVID-19 Pandemic

Programming Languages

java
68154 projects - #9 most used programming language
swift
15916 projects
javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language
Starlark
911 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to rn-contact-tracing

Bluetooth-ble-beamer-and-scanner-for-tracing-corona-virus-infected-individual
Bluetooth ble beacon beamer and scanner for tracing corona virus infected person similar to Trace Together app
Stars: ✭ 26 (-54.39%)
Mutual labels:  bluetooth-low-energy, covid-19, covid19
rcvr-app
recover provides localities a privacy-compliant, safe, and easy way for their guests to check in. See https://www.recoverapp.de/ for more details.
Stars: ✭ 43 (-24.56%)
Mutual labels:  covid-19, covid19, contact-tracing
CoronaVirusOutbreakAPI
A tiny and small program to crawler and analyze outbreak of COVID-19 in world and every country using PHP.
Stars: ✭ 20 (-64.91%)
Mutual labels:  covid-19, covid19
COVID-19-Tweet-Classification-using-Roberta-and-Bert-Simple-Transformers
Rank 1 / 216
Stars: ✭ 24 (-57.89%)
Mutual labels:  covid-19, covid19
cli-corona
📈 Track COVID-19 (2019 novel Coronavirus) statistics via the command line.
Stars: ✭ 14 (-75.44%)
Mutual labels:  covid-19, covid19
covid19-visualized
COVID-19 World update with data Visualization (Include Indonesia cases)
Stars: ✭ 23 (-59.65%)
Mutual labels:  covid-19, covid19
cowin-vaccine-booking
The app enables tracking coivid vaccine availability and automatically book a vaccination slot. This is based on Cowin API and supports the recently added Captcha code of Cowin.
Stars: ✭ 150 (+163.16%)
Mutual labels:  covid-19, covid19
covid19
Visualize and compare COVID 19 growth rates of different countries
Stars: ✭ 22 (-61.4%)
Mutual labels:  covid-19, covid19
rcvr-api
Recover Cologne Api, kneipen kontakt tracer. recover provides localities a privacy-compliant, safe, and easy way for their guests to check in. See https://www.recoverapp.de/ for more details.
Stars: ✭ 14 (-75.44%)
Mutual labels:  covid19, contact-tracing
awesome-covid19-resources
Awesome list of COVID19 resources
Stars: ✭ 54 (-5.26%)
Mutual labels:  covid-19, covid19
rid-covid
Image-based COVID-19 diagnosis. Links to software, data, and other resources.
Stars: ✭ 74 (+29.82%)
Mutual labels:  covid-19, covid19
ios
CoThings's iOS application. CoThings is a realtime counter for shared things.
Stars: ✭ 13 (-77.19%)
Mutual labels:  bluetooth-low-energy, covid-19
covid19-stream-processors
Stream Information & Example Applications for Processing JHU and CovidTracking.com COVID-19 data available as streams over Solace
Stars: ✭ 35 (-38.6%)
Mutual labels:  covid-19, covid19
app
CovidTrace mobile app.
Stars: ✭ 19 (-66.67%)
Mutual labels:  covid-19, contact-tracing
covid19africa
Africa open COVID-19 data working group
Stars: ✭ 47 (-17.54%)
Mutual labels:  covid-19, covid19
coviddata
Daily COVID-19 statistics by country, region, and city
Stars: ✭ 49 (-14.04%)
Mutual labels:  covid-19, covid19
iorestoacasa.work
Frontend of the video calling platform iorestoacasa.work
Stars: ✭ 36 (-36.84%)
Mutual labels:  covid-19, covid19
Coronavirus
Java API Wrapper for tracking coronavirus (COVID-19, SARS-CoV-2) via https://git.io/Jvoep
Stars: ✭ 16 (-71.93%)
Mutual labels:  covid-19, covid19
SPREAD
Spread visualizes how viruses and other pathogens are spreading in time and space. It creates compellable shareable, interactive and time-animated visualization.
Stars: ✭ 9 (-84.21%)
Mutual labels:  covid-19, covid19
covid19cuba-app
Mobile application of Covid19 Cuba Data project implemented with Flutter
Stars: ✭ 41 (-28.07%)
Mutual labels:  covid-19, covid19

RN-Contact-Tracing

NPM version License CI


WIP Library - Don't Use in Production


About

This is a react-native library for tracing close contact between 2 mobile devices by exchanging ephemeral tokens over BLE (Bluetooth Low Energy).

The library will do the following:

  1. Advertise message with specific service_uuid and generated ephemeral token
  2. Scan for for BLE signals with a specific service_uuid and store the relevant scanned data into local device storage
  3. Provide simple API for JS to init these tasks in background and retrieve the scanned tokens
  4. Integrate with a module that will provide ephemerally encrypted tokens (might be optional part of the lib)

There is a chance this lib will be updated after Google & Apple will release the full Contact Tracing API solution.

Challanges

  1. iOS limitation of using ble while the app in the background - link 
  2. Estimate the distance between 2 devices without violating user's privacy, using the data we can send over the ble

Working plan

Functionality Android iOS
Scan in foreground
Advertise in foreground
Scan in background TODO
Advertise in background TODO
Save scanned data into local DB
Return scanned data to JS
Pass scannng & advertising configuration from JS (intervals..)
Integration with tokens provider TODO TODO
Tests TODO TODO
Features for rssi calibration (GPS, Proximity) WIP TODO

Getting started

Example Project

The Example project can be used as a reference of how to use the rn-contact-tracing API and as a helpful tool to fine-tune the scanning/advertising configuration

How to run the example project

npm install
cd example/ios
pod install
For Android - npm run android 
For iOS - npm run ios

In Android - Click on Request Location Permission button

Installation

yarn add rn-contact-tracing

or

npm install rn-contact-tracing --save

Android - Steps to manually link the library

android/settings.gradle

include ':rn-contact-tracing'
project(':rn-contact-tracing').projectDir = new File(rootProject.projectDir, '../node_modules/rn-contact-tracing/lib/android')

android/app/build.gradle

dependencies {
   ...
   implementation project(":rn-contact-tracing")
}

android/app/src/main/.../MainApplication.java

On top, where imports are:

    import moh.gov.il.specialble.SpecialBlePackage;

Add the RNLocationPackage class to your list of exported packages.

@Override
protected List<ReactPackage> getPackages() {
    return Arrays.asList(
            List<ReactPackage> packages = new PackageList(this).getPackages();
            ...
            packages.add(new SpecialBlePackage());
            ...
    );
}

Supported Platforms

  • iOS 10+
  • Android API 21+

Methods

Summary


Details

setConfig(config)

   SpecialBle.setConfig(config);

Sets configuration options that will be used in scanning & advertising tasks.

Parameters:

Name Type Required Description
config object Yes See below.

Supported options:

  • serviceUUID - the ServiceUUID which identify the BLE broadcast you are going to advertise and scan for.
  • scanDuration - scanning duration in milisec
  • scanInterval - the time in milisec between every scan
  • advertiseDuration - advertising duration in milisec (up to 180000ms)
  • advertiseInterval - the time in milisec between every advertising
  • token - temporary token to advertise (for testing)

For Android

  • advertiseTXPowerLevel - advertise TX power level docs
  • scanMatchMode - match mode for Bluetooth LE scan filters hardware match docs
  • notificationTitle - the title of the foreground service notification
  • notificationContent - the content of the foreground service notification

getConfig(callback)

   SpecialBle.getConfig((config) => {
    ....
   })

Gets the scanning & advertising configuration options that are currently defined in the library


startBLEService(config)

SpecialBle.startBLEService(config);

Starts BLE background task scanning for a specific - config is optional


stopBLEService()

SpecialBle.stopBLEService();

Stops the background service and all the tasks the service executing


startBLEScan(config)

SpecialBle.startBLEScan(config);

Starts BLE scanning in foreground - config is optional


stopBLEScan()

SpecialBle.stopBLEScan();

Starts BLE scanning


advertise(config)

SpecialBle.advertise(config);

Starts BLE advertising in foreground - config is optional


stopAdvertise()

SpecialBle.stopAdvertise();

Stops BLE advertising


getScansByKey(token, callback)

 SpecialBle.getScansByKey(token, (scans) => {
    ...
 })

Get list of scans events for a specific token, each object contains:

  • scan_id - unique id
  • scan_timestamp - epoch time of the scan event in
  • public_key - token key
  • scan_address - scaned device address
  • scan_rssi - rssi strength
  • scan_tx - tx strength
  • scan_protocol - the protocol used to scan the data (currently GAP/GATT)

getAllDevices()

 SpecialBle.getAllDevices((devices) => {
       setDevices(devices)
   })

Get list of unique devices that were scanned, each object contains:

  • device_first_timestamp - epoch time of the first scan event
  • device_last_timestamp - epoch time of the last scan event
  • public_key - token key
  • device_address - scaned device address
  • device_rssi - rssi strongest value
  • device_tx - tx strongest value
  • device_protocol - the protocol used to scan the data (currently GAP/GATT)

exportAllScansCsv()

 SpecialBle.exportAllScansCsv();

Export the full Scans events DB to csv file


exportAllDevicesCsv()

SpecialBle.exportAllDevicesCsv();

Export the full Devices DB to csv file


cleanDevicesDB()

SpecialBle.cleanDevicesDB();

Clear all scanned devices


cleanScansDB()

SpecialBle.cleanScansDB();

Clear all scans


Events from Native to JS

  • scanningStatus - event can be true/false
  • advertisingStatus - event can be true/false
  • foundDevice - event has 2 params: {event.device_name, event.device_address}
  • error - {event.error_message}

Why did we build this lib?

Due to COVID-19 pandemic, several groups and health authorities released apps that will help to identify and notify people that are at risk of exposure.

Some of these apps are written with RN and based on tracking user location which is not enough such as Hamagen, and they willing to add BLE based functionality.

There are lots of great libs that expose ble functionality for RN, i.e react-native-ble-plx & react-native-ble-manager but we wanted reduce the amount of dependancies as much as possible and exectue very specfic BLE functionality in background.

In addition, we looked at several great apps written for the same purpose in native, but each one of them is not written in a way that we could use as a stand-alone library. OpenTrace) - includes the full business logic (UI..) that we don't want to use. DP^3T Project - include cryptography logic that we prefer to replace

Privacy (what do we advertise and save to DB)

TBD

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].