Front page of the web dashboard, with user logged in.
Form on the web dashboard, used to create trackers for vaccine appointments.
Tracker list, showing the automatically geocoded long street address and lat/long coordinates, used to find pharmacies in radius.
Backend Pharmacy Data Update Sequence
A look at using the discord bot to manage vaccine trackers.
Many friends and I were trying to schedule vaccine appointments for locations near us, but found it difficult to find appointments: During normal hours we often got "sniped" by other people who checked the sites more often than us, and other vaccines would only replenish appointments late at night, between 1 and 3 AM.
What it does
VaxFinder's core is its backend: every 15 seconds, it fetches data for over 29,000 locations from vaccinespotter.org, and adds their lat/long coordinates to a KD-tree for fast lookup when finding radiuses later on. It then checks every user's active trackers to see if their tracking radius contains a pharmacy location that has appointments available. If this is true, it then sends a phone call describing the closest location of a vaccine appointment that meets their tracker's criteria.
Users can create trackers either through the web dashboard or by using the Discord bot. The web dashboard is authenticated using a Discord account so that data for a user is consistent across both frontends.
How I built it
The application server is made of 7 main components:
- The database classes, which abstract object data into SQL queries, which are processed in an SQLite database.
- The custom Nominatim client, which provides free and fast geocoding, translating the user's entered street address into detailed latitude/longitude coordinates.
- The vaccine aggregator, which programmatically fetches and merges pharmacy location and appointment data from all 50 states.
- The finder component, which builds a KD-tree compatible with spherical coordinates with the location data, and allows near-instant queries of which locations are within a radius of a certain point, making vaccine tracking possible.
- The notifier classes, which, when a tracker has detected that appointments are within its radius, sends out a phone call to the user informing them.
- The webserver, a frontend to the VaxFinder tracker database, allowing users to create and manage trackers and associate them with their discord account.
- The Discord bot, another frontend, allows users to create and manage trackers with a "terminal" user flow.
To create a project of this complexity within a small time period, I wrote this with TypeScript for Node.js, using Twilio APIs for phone calls, and the Handlebars templating engine to render the web dashboard.
Challenges I ran into & Accomplishments that I'm proud of
Because VaxFinder needs to update every 15 seconds, the entire sequence of aggregation to notification needs to be very efficient and fast. Optimization of the vaccine aggregation system decreased aggregation times from over 5 minutes to under 2 seconds. Using a KD-tree to make spherical coordinates easily searchable saved greatly on processing time, which now only takes several milliseconds.
What I learned
There were many firsts for me when writing this application. This was the first time I dealt with using TypeScript to make an actual application, used handlebars and express together to render webpages, used Twilio APIs to make phone calls, and used a KD-tree to optimized spherical lookups.
What's next for VaxFinder
I plan to support queries for the type of vaccine that the user wants (Pfizer, Moderna, etc.) Of course, this would decrease the number of appointments that are available to them, but it would be helpful, for example, for people who are under 18 who at the moment can only take Pfizer. I also plan to improve the web dashboard to streamline the user experience, and allow VaxFinder to direct users to the appointment pages of various available local pharmacies.