The Anatomy of a Covid Appointment Bot

- 8 mins

When covid vaccine appointments were initially rolled out, they were difficult to book, requiring users to navigate confusing forms, refresh pages and pray for openings. To ease the frustration for nearby friends & family, I created a python script to automate the steps to find covid appointments. Things snowballed from there into this twitter bot. The bot ran for 3 months, generated 12,349 tweets, 106,353 clicks and cost $1.25/day.

TL;DR; I created a twitter bot to help people find available covid appointments, it served a purpose by minimizing the pain of finding appointments and maintaining accurate searches required constant maintenance.

The general business logic to find a covid appointment was relatively simple. Look for a covid appointment, collect available appointment data, then post a tweet if necessary.

Technical Notes

Vaxstter Code

Vaxster code to manage the search logic + Helper code to manage Terraform & twitter…

Vaxster code
.
├── clinic.py                           Manages generic business logic
├── clinic_libs                         Collection of selenium scripts designed to navigate individual clinics
│   ├── __init__.py
│   ├── costco.py                       Selenium steps to check costco
│   ├── cvs.py                          Selenium steps to check cvs
│   ├── goleta_valley_cottage_frame.py  Selenium steps to check a local hospital v1
│   ├── goleta_valley_cottage_v1.py     Selenium steps to check a local hospital v2, needed after the hospital refactored some links
│   ├── mhealthcheckin_v1.py            Selenium steps to check albertsons/ralphs/savon v1
│   ├── mhealthcheckin_v2.py            Selenium steps to check albertsons/ralphs/savon v2, needed after mhealthcheckin refactored their UI
│   ├── santa_barbara_medcenter.py      Selenium steps to check a local clinic in Santa Barbara
│   ├── slocounty_ca_gov.py             Selenium steps to check San Luis Obispo
│   └── walgreens.py                    Selenium steps to check walgreens
├── config.yml                          YAML file for clinic information
├── county.py                           Manages counties, forks parallel selenium threads
├── requirements.txt
├── state.py                            Intended to manage multiple states but I never managed to move beyond California
└── vaxster.py                          Mostly reads YAML settings then kicks off states.py

Helper code
.
├── collect_stats.py                    Collect click stats from cutt.ly, post results to twitter
├── terraform
│    ├── main.tf
│    ├── outputs.tf
│    ├── provider.tf
│    ├── user_data.tpl                   Commands to set up a new EC2 instance: add AWS creds, install chrome driver, clone git repo, etc.
│    └── variables.tf
└── twitter_helper.py                   Create tweets using the twitter API

The evolution of clinic searches

Clinics went through some not so obvious changes over time, where demand and supply fluctuated dramatically. Here’s a brief description of how that went.

Maintenance

Maintenance was the biggest surprise. At best, every new clinic was a few lines in a YAML file. At worst, every new clinic was a new python class. To expand on that, here’s a generalization of the different types of clinics

Keeping searching running and able to deliver accurate appointment data was an ongoing chore. Part of me thinks the govt dropped the ball by not rolling out a nationwide covid appointment booking website, but that now seems like a near impossible task.

Lessons learned

rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora