HealthCheck SDK

The Android HealthCheck SDK provides an API and SDK for using Secure Multiparty Computation (SMC) to estimate the transmission- and complication- risks relating to the SARS-CoV-2 coronavirus. Secure Multiparty Computation allows third parties to compute on sensitive data, without the unprotected data ever leaving the phone or browser. Depending on how you set things up, for example, only the data source (e.g. the patient who provided their symptoms) can see the results of the computation.


1. Requirements

The minimum requirements for the Android HealthCheck SDK are:

  • Android 4.4 (API level 19) or higher
  • Java 8 or higher
  • Gradle 3.4.0 or higher

2. Install and configure the SDK

Installing the SDK is simple if you're familiar with using external libraries or SDKs. To install the SDK using Gradle and JitPack, add the following lines to the project's top-level build.gradle file.

dependencies {
  implementation 'com.github.enyalabs:healthcheckSDKAndroid:v1.0.2'
}

You also need to add JitPack repository to your home directory build.gradle file.

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Alternatively, you can download the .aar file from the link below. Copy this file into your libs/ folder, and make sure you include the library in your build.gradle file as well.

Download .aar



3. Grant system permissions to the HealthCheck SDK

The SDK requires system permissions. These permissions allow the SDK to communicate with the FeverIQ server. To grant system permissions, add the following line to your AndroidManifest.xml file.

< uses-permission android:name="android.permission.INTERNET" />

4. Basic usage

The Android HealthCheck SDK makes privacy-preserving COVID risk estimation effortless and straightforward. These are only a few simple steps to computing your first risk estimate:

Step 1: Configure the SDK

Specify your API_KEY to configure the SDK. It can be obtained from the Health Check Premium Settings page.

import com.healthcheck.healthchecksdk.HealthCheckSDK;

HealthCheckSDK.api_key(API_KEY);

Step 2: Provide the client data

Please make sure your input type is HashMap<String, HashMap<String, Object>>. The demo input is following:

final HashMap<String, HashMap<String, Object>> input = new HashMap<>();

HashMap<String, Object> demographic = new HashMap<>();

demographic.put("Age", 30);

/* MKS units - kg/m2 - rounded to Int */
demographic.put("Bmi", 10);
demographic.put("Gender", "Male");

/*Celsius - you are responsible for converting from Fahrenheit if needed*/
demographic.put("TemperatureC", 36.8);

/*Have YOU traveled out of state lately?*/
demographic.put("Travel_Self", false);

/*Have you had close contact with someone else who has traveled out of state lately?*/
demographic.put("Travel_CloseContact", false);

HashMap<String, Object> symptoms = new HashMap<>();

symptoms.put("Fever", false);
symptoms.put("Unexplained Fatigue", false);
symptoms.put("Dry Cough", false);
symptoms.put("Sneezing", false);
symptoms.put("Aches", false);
symptoms.put("Runny Nose", true);
symptoms.put("Sore Throat", false);
symptoms.put("Diarrhea", false);
symptoms.put("Headache", false);
symptoms.put("Trouble Breathing", false);
symptoms.put("Loss of smell", false);
symptoms.put("Unexplained Allergies", true);
symptoms.put("Hallucinations", false);
symptoms.put("Vomiting", false);
symptoms.put("Blue Toes", false);
symptoms.put("Skipped Meals", false);
symptoms.put("COVID-19 in household", false);
symptoms.put("COVID-19 test result", false);
symptoms.put("COVID-19 test type", "PCR");

HashMap<String, Object> comorbidities = new HashMap<>();

comorbidities.put("Asthma", false);
comorbidities.put("Cancer", false);
comorbidities.put("Chronic Kidney Disease", false);
comorbidities.put("COPD", false);
comorbidities.put("Cystic Fibrosis", false);
comorbidities.put("Diabetes", false);
comorbidities.put("Heart Disease", false);
comorbidities.put("Hepatitis", false);
comorbidities.put("High Blood Pressure", false);
comorbidities.put("HIV", false);
comorbidities.put("Liver Cirrhosis", false);
comorbidities.put("Organ Transplant", false);
comorbidities.put("SCID", false);
comorbidities.put("Sickle Cell", false);
comorbidities.put("Smoking/Vaping", false);


input.put("demographic", demographic);
input.put("symptoms", symptoms);
input.put("comorbidities", comorbidities);

Note: Please make sure you use the same data structure. The SDK will set undefined/missing objects to false.

Step 3: Compute

Finally, compute the risk estimate:

JSONObject SDKResult = null;
try {
  SDKResult = HealthCheckSDK.main();
} catch (IOException e) {
  e.printStackTrace();
} catch (JSONException e) {
  e.printStackTrace();
}
assert SDKResult != null;
Log.i("SDKResult", SDKResult.toString());

We recommend not running the HealthCheck SDK in the main thread. A better solution is to create a new thread and run SDKResult = HealthCheckSDK.main(); there.

Thread thread = new Thread(new Runnable() {

  @Override
  public void run() {
    try  {
      /* Run code */
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

});
    
thread.start();

5. The computation result

The HealthCheck SDK returns multiple risk scores, risk levels and other important flags which can be used to determine the computation time and other things. An example of a successful return is:

{
  personalScore: 3.5,        /*risk to self if infected*/
  personalRisk: 'Normal',    /*risk to self if infected {Normal, Elevated, High}*/
  testScore: 0.129,          /*main SARS scoring algo - if > CP1_ct1, elevated likelihood of testing positive if tested*/
  transmissionRisk: 'Normal',/*{Normal, Elevated, High}*/
  recommendToTest: false,    /*Should you get tested?*/
  quarantineScore: 0,        /*quarantine length suggestion*/
  quarantineDuration: 0,     /*days of suggested quarantine*/
  timesStamp: 1593546575820, /*unix time when estimates were generated*/
  integrityHash: 'fa5f6c9ffa5f6c9ffa5f6c9f', /*used for regulatory compliance*/
  uniqueComputeID: '74213c74-39c6-4c36-bbdd-15216f24ac96', /*unique identifier of computation*/
  status: 201,
}

Note: The data type of result is JSONObject.

The status code of a successful computation is 201 and of a failed computation is 404. Calculations may fail due to setting errors (see error messages). Typically, 404 errors arise when the API Token has not been set or has been set incorrectly.