CoTrack.js is a javascript library that allows developers to easily add COVID-19 tracking to their website just by copying and pasting 5 lines of code. It is fast, efficient, secure, user-friendly, and developer-friendly. If CoTrack.JS was added to a few medium-traffic sites, it would immediately expand COVID-19 tracking to tens or hundreds of millions of people! That would be an extraordinarily difficult achievement to accomplish for an app or an api.

CoTrack.JS Github: https://github.com/GeorgeShao/CoTrackJS/

CoTrack.JS Website: https://cotrackjs.online/

Inspiration

I was inspired to create this project when I noticed the major problems in many COVID-19 tracking solutions. COVID-19 tracking apps would heavily drain your battery due to WiFi and GPS use, and their data collection and privacy policies were unclear, often with companies selling your data, or not securely storing it. Currently, the best solution is Google's COVID-19 tracking api, which is still in development. The problem with this is that app developers will have to take time to learn how to use an entirely new API. With thousands more people being infected with and dying from COVID-19 every day, every hour matters. In this critical time, the last thing you want developers doing is spending a few weeks reading api documentation and attempting to learn new apis instead of deploying solutions to solve problems in the real world. This motivated me to create CoTrack.JS, a javascript library that allows developers to add COVID-19 tracking to their websites by just copying and pasting 5 lines of code. Instead of spending weeks learning, implementing, and testing new apis to track COVID-19, using CoTrack.JS, you can add the COVID-19 tracking feature in less than a minute.

What it does

CoTrack.JS is a javascript library that allows developer to add COVID-19 tracking to their website by simply copying and pasting 5 lines of code. Once that has been done, the website now has full COVID-19 tracking functionality!

How I built it

I started with Firebase Hosting, using it as both a website host and a CDN (content delivery network) to distribute my javascript library. Then I changed the DNS records and linked Firebase Hosting to the domain "cotrackjs.online", a domain that I got from Domain.com. I then used the Firebase Realtime Database to store all the Locality Sensitive Hashed user data. Last of all, I added Google reCAPTCHAs on the website, and I used Firebase Cloud Functions as a node.js serverless backend for the reCAPTCHA in order to help prevent spam.

How it works (detailed explanation - part 1) - Getting & securely storing user data

Every time a user visits a website that has CoTrack.JS enabled (meaning it has the 5 lines of code copied and pasted), even if the website has been loaded in the background and their phone is turned off, CoTrack.JS will frequently retrieve the user’s IP address, latitude, and longitude. All of this data is then fed through a simplified Locality Sensitive Hashing algorithm. The Locality Sensitive Hashing algorithm allows CoTrack.JS to securely store user data. The hashed data is then stored on a Firebase Realtime Database.

How it works (detailed explanation - part 2) - Checking if you have been in contact with a COVID-19 patient

Whenever a user goes onto the https://cotrackjs.online/ website (which is hosted by Firebase Hosting) and clicks the "check covid-19 contact" button to see if they have been in contact with someone with COVID-19, the website firsts verifies the human identity of the user with a Google reCAPTCHA. I used Firebase Cloud Functions as the node.js serverless backend for the reCAPTCHA. If the reCAPTCHA is successfully completed, the website retrieves data from the Firebase Realtime Database and uses the Locality Sensitive Hashing algorithm to efficiently compare large datasets in order to determine how close the user was to reported COVID-19 patients, and how likely it was that the user made contact with a patient.

How it works (detailed explanation - part 3) - Reporting yourself as having COVID-19

Whenever a user goes onto the https://cotrackjs.online/ website (which is hosted by Firebase Hosting) and clicks the "report case" button to tell the website that they have been verified to have COVID-19, the website firsts verifies the human identity of the user with a Google reCAPTCHA. I used Firebase Cloud Functions as the node.js serverless backend for the reCAPTCHA. If the reCAPTCHA is successfully completed, the website marks you as a COVID-19 patient in the Firebase Realtime Database.

Challenges I ran into

The largest issue I had was that I had had zero experience in javascript/html/css. Thankfully, it was surprisingly relatively easy to learn. I have never worked with Firebase before, so it took a short while to learn - but it was beautifully simple afterwards! I had plenty of issues with Firebase, all of which I managed to solve. The Locality Simplified Hashing algorithm was very confusing, but I managed to create a simplified version that was less secure but good enough for my use case, since I already had redundancy built-in to ensure that personal data would stay secure and private.

Accomplishments that I'm proud of

I'm proud that I was able to learn a good amount of javascript, html, and css quickly when I had nearly no knowledge of it just 24 hours ago. I'm very proud that I was able to get Firebase Hosting, Firebase Realtime Database, and Firebase Cloud Functions working perfectly as intended! Since it was my first time working with Firebase, I didn't expect it to be this beautifully simple. I'm proud that I was able to get the Google reCAPTCHA working properly as well. Overall, out of the 12 hackathons I've now been to, this project is almost certainly the one which I'm most proud of because I learned so many new things and got everything completely working!

What I learned

  1. Javascript, html, css (i knew essentially nothing before)
  2. Firebase Hosting (it blew my mind that you could deploy a web app in 3 commands!)
  3. Firebase Cloud Functions (it was okay)
  4. Firebase Realtime Database (struggled a lot, but it was surprisingly relatively easy to work with)
  5. Google reCAPTCHA (very easy to work with, quite straightforward)
  6. Locality Sensitive Hashing (very confusing, still don't fully understand)

What's next for CoTrack.JS

I plan to improve and polish this project then release CoTrack.JS as an actual javascript library. I want to migrate the javascript library to a dedicated CDN (most likely Google Cloud CDN). I want to add new features to it and improve the performance.

Built With

+ 6 more
Share this project:

Updates