Skip to content

Scripts and Automation

Alexander Refsum Jensenius edited this page Jun 21, 2026 · 3 revisions

Python scripts live in scripts/. Install dependencies:

python3 -m venv venv
source venv/bin/activate
pip install -r scripts/requirements.txt

Paths default to site/ (see scripts/repo_paths.py). Full details: scripts/README.md in the repo.

Directory and data sync

Script Purpose
enrich_directory_from_nva.py Refresh people from NVA/ORCID (affiliation, tags, bio, publications, portrait, other projects)
sync_results_from_nva.py Sync MishMash publications to site/_data/mishmash_results.yml
fill_missing_nva_orcid.py Add missing urls.nva / urls.orcid only
validate_directory.py Validate directory entries, roles, and bidirectional cross-links
generate_directory_governance.py Generate people/institutions from board, council, WP leaders
sync_directory_reciprocity.py Fix reciprocity in directory cross-links; normalise path-style slug lists
import_directory_survey_csv.py Import survey CSV into directory entries
merge_tags.py Merge similar tags using config/tag_merge_map.yml

Nightly CI

.github/workflows/enrich-directory-people.yml runs daily (05:00 UTC) and may push to main:

  1. enrich_directory_from_nva.py --discover-nva --discover-nva-loose --max-works 10
  2. sync_results_from_nva.py
  3. sync_directory_reciprocity.py
  4. merge_tags.py
  5. validate_directory.py
  6. Commit changes under site/_directory/, site/_data/, and site/assets/images/portraits/

NVA credentials: config/README.md — never commit JSON credential files. GitHub Actions uses repository secrets NVA_CLIENT_ID and NVA_CLIENT_SECRET.

Enrich behaviour highlights

  • Active affiliations only — inactive NVA affiliations are ignored
  • Selected works — excludes lectures, media, and works where the person is NVA role Supervisor
  • Other projects — active NVA projects only (ended projects filtered out)
  • name and title — never overwritten by sync

Event fetching

Script Purpose
fetch_uio_events.py Scrape UiO/Ritmo event pages → site/_events/
fetch_rss_to_events.py RSS feed → event Markdown
fetch_partner_ai_events.py Crawl partner sites → site/_data/partner_events.yml

Institution helpers

Script Purpose
sync_institution_wikipedia.py Wikipedia summaries for institutions
sync_institution_websites.py Institution website URLs
sync_institution_summaries.py Sync institution summary text
link_institution_logos.py / download_partner_logos.py Logo assets

Images and assets

Script Purpose
make_portraits_transparent.py Remove portrait backgrounds
convert_portraits_to_greyscale.py Greyscale portraits
compress_large_portraits.py Compress oversized portraits
combine_image_slices.py Combine two images side by side
make_qr_code.py QR codes for internal pages
generate_bubble_gifs.sh Animated bubble logo variants

Chat / knowledge base

Script Purpose
build_knowledge_base.py Build JSON knowledge base for the AI chat interface

Tests

python3 scripts/test_tag_merge.py
python3 scripts/test_directory_sync.py
python3 scripts/test_nva_result_types.py
python3 scripts/test_nva_publication_contributors.py
python3 scripts/test_nva_api_auth.py   # requires NVA credentials

Config files

File Purpose
config/tag_merge_map.yml Canonical tag names and variants to merge
config/nva-credentials.prod.json NVA API credentials (gitignored)

Clone this wiki locally