Skip to content

Donation Thermometer

dzoladz edited this page Sep 28, 2021 · 1 revision

The website has a "thermometer"-like visualization tracking whether donations to Diversity Scholarships are hitting some of the matching funds provided by generous organizational donors: donation thermometer

We configure this thermometer by setting angel-fund.thermometer to true and providing the "key" to a Google Spreadsheet under angel-fund.spreadsheet-key in _data/conf.yml. The spreadsheet key is visible in its URL: https://docs.google.com/spreadsheets/d/${key}/edit#gid=0 and its data is pulled and processed by the assets/js/thermometer.js script. Styles for the thermometer are likewise in their own file, assets/css/thermometer.css

Google Spreadsheet

The Spreadsheet needs to follow a very particular format for thermometer.js to be able to parse it properly. The easiest way to create it is to copy the past year's spreadsheet (see the 2019 one for example). It follows this format:

  • there are three worksheets (in this order): Donations, Goals, and Total
  • Donations must have a header row and three columns: reference number (not used but still must be included or offsets will be wrong), amount (integer or floating point), and fund tag (must match a "fund" under the Goals spreadsheet)
  • Goals must have a header row and three columns: fund label (shown on the website), fund code (the matching identifier used under Donations), and goal (integer or floating point)
  • Total has only a single cell in the upper left (A1) position that shows the total donated so far (it can be an =SUM() equation)

Other notes:

  • The spreadsheet must be published to the web (File > Publish to the web) so the script can access it without authentication
  • Due to this, no personal information should be included in it, only anonymous donation sums
  • The header rows are skipped over by the script; the meaning of data in cells is inferred from their position
  • Concentra staff have typically been the ones manually updating it as donations come in
  • Any number of matching goals are supported, each gets its own thermometer
  • Technically, the donations.fund_code <-> goals.fund_code match is case insensitive

The "Total" worksheet is probably not necessary, it can be derived by summing up all donations. I (Eric P) originally included it in case there was a need to have a donation that was not listed in the Donations worksheet but did contribute to the overall total.