Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 2.22 KB

File metadata and controls

69 lines (48 loc) · 2.22 KB

Sage Bionetworks & Synapse QR Codes

A GitHub Pages site that generates QR codes for Sage Bionetworks and Synapse URLs. New URLs are discovered automatically each month via a scraper, and can also be added manually.

Live site

Once deployed, the page is available at your GitHub Pages URL (e.g. https://<org>.github.io/synapse-qr-codes/).

How it works

  • index.html loads URL data from urls.json and renders QR codes client-side
  • scrape_urls.py crawls sitemaps and key pages on synapse.org and sagebionetworks.org to discover new URLs
  • A GitHub Actions workflow (.github/workflows/update-urls.yml) runs the scraper on the 1st of each month and commits any changes

Adding URLs manually

All URLs live in urls.json. To add a new one:

  1. Open urls.json
  2. Find the appropriate section by id:
    • syn — synapse.org subdomains (e.g. https://genie.synapse.org)
    • sage — sagebionetworks.org subdomains (e.g. https://tower.sagebionetworks.org)
    • pages — sagebionetworks.org top-level pages (e.g. https://sagebionetworks.org/careers)
    • comm — sagebionetworks.org community pages (e.g. https://sagebionetworks.org/community/htan)
  3. Add a new entry to that section's items array:
{
  "url": "https://example.synapse.org",
  "desc": "Short description of the page"
}
  1. Commit and push. GitHub Pages will redeploy automatically.

Items within each section are sorted alphabetically by URL. The scraper preserves manually added entries and their descriptions.

Adding a new section

To create an entirely new section, add a new object to the top-level array in urls.json:

{
  "section": "Display Name for Section",
  "id": "short-id",
  "items": [
    { "url": "https://...", "desc": "Description" }
  ]
}

Running the scraper locally

pip install requests
python scrape_urls.py

Or with uv:

uv run --with requests scrape_urls.py

The scraper merges new URLs into urls.json without removing existing entries. It prints a summary to stderr and outputs NEW_URLS_FOUND=true or false to stdout.

Triggering the scraper manually on GitHub

Go to Actions > Update QR Code URLs > Run workflow to trigger a scrape outside the monthly schedule.