Skip to content

Instantly share code, notes, and snippets.

@robherley
Created April 6, 2021 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robherley/d13740ddcd63b91e3234b074312448ac to your computer and use it in GitHub Desktop.
Save robherley/d13740ddcd63b91e3234b074312448ac to your computer and use it in GitHub Desktop.
vaccine checker
const axios = require("axios");
const _ = require("lodash");
const URL =
"https://am-i-eligible.covid19vaccine.health.ny.gov/api/get-providers";
const PAYLOAD = {
address: "11746",
applicationId: "5617632692458176706",
dob: "03/02/1997",
miles: "100",
};
const main = async () => {
const { data } = await axios.post(URL, PAYLOAD);
const sorted = _.sortBy(data, (d) => parseInt(d.address.distanceInMiles, 10));
const filtered = _.filter(sorted, (d) => d.availableAppointments == "AA");
const mapped = _.map(filtered, (d) => ({
name: d.providerName,
distance: d.address.distanceInMiles,
location: d.address.city,
brand: d.vaccineBrandFullName,
url: d?.webUrl || d?.["3rdPartyURL"],
}));
console.table(mapped);
};
main().catch((err) => console.error("unable to process request:", err));
┌─────────┬────────────────────────────────────────────┬──────────┬────────────────┬──────────┬─────────────────────────────────┐
│ (index) │ name │ distance │ location │ brand │ url │
├─────────┼────────────────────────────────────────────┼──────────┼────────────────┼──────────┼─────────────────────────────────┤
│ 0 │ 'SUNY Binghamton' │ '259.9' │ 'Johnson City' │ 'Pfizer' │ 'https://virtualqueue9.ny.gov' │
│ 1 │ 'SUNY Polytechnic Institute' │ '301.1' │ 'Utica' │ 'Pfizer' │ 'https://virtualqueue10.ny.gov' │
│ 2 │ 'SUNY Corning Community College' │ '341.8' │ 'Corning' │ 'Pfizer' │ 'https://virtualqueue25.ny.gov' │
│ 3 │ 'State Fair Expo Center: NYS Fairgrounds ' │ '345.3' │ 'Syracuse' │ 'Pfizer' │ 'https://virtualqueue3.ny.gov' │
│ 4 │ 'Plattsburgh International Airport' │ '427.8' │ 'Plattsburgh' │ 'Pfizer' │ 'https://virtualqueue.ny.gov' │
│ 5 │ 'SUNY Potsdam ' │ '447.5' │ 'Potsdam' │ 'Pfizer' │ 'https://virtualqueue7.ny.gov' │
└─────────┴────────────────────────────────────────────┴──────────┴────────────────┴──────────┴─────────────────────────────────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment