Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Validate illustrations

on:
pull_request:
branches: [main]

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Validate icons and EHLDs
run: |
docker run --rm \
-v ${{ github.workspace }}/icons:/data/icons \
-v ${{ github.workspace }}/ehld:/data/ehld \
public.ecr.aws/reactome/illustration-validator:latest \
java -jar ./target/illustration-validator-jar-with-dependencies.jar \
-e false \
-d /data/icons \
-s /data/ehld
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ SVG icons and EHLD diagrams for [Reactome](https://reactome.org/) pathway diagra
- `icons/` - SVG icons and XML metadata files (R-ICO-XXXXXX.svg and .xml)
- `ehld/` - EHLD diagram SVGs (R-HSA-XXXXXX.svg)
- `download_illustrations.py` - Script to download icons and EHLDs from Figma and validate them
- `references.txt` - Valid reference database names for the icon validator
- `categories.txt` - Valid category names for the icon validator
- `VERSION` - Current release version number

## Prerequisites

Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
96
8 changes: 0 additions & 8 deletions categories.txt

This file was deleted.

22 changes: 1 addition & 21 deletions download_illustrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
ICONS_DIR = os.path.join(SCRIPT_DIR, "icons")
EHLD_DIR = os.path.join(SCRIPT_DIR, "ehld")
REFERENCES_FILE = os.path.join(SCRIPT_DIR, "references.txt")
CATEGORIES_FILE = os.path.join(SCRIPT_DIR, "categories.txt")

VALIDATOR_IMAGE = "public.ecr.aws/reactome/illustration-validator:latest"

Expand Down Expand Up @@ -197,16 +195,7 @@ def download_ehlds(token):
page_id = get_export_page_id(token, EHLD_FILE_KEY)
print(f"Found '{EXPORT_PAGE_NAME}' page (id: {page_id})")

# EHLDs are direct children of the Export page (frames, depth=1 is enough)
url = f"https://api.figma.com/v1/files/{EHLD_FILE_KEY}/nodes?ids={page_id}&depth=1"
resp = requests.get(url, headers=figma_headers(token))
resp.raise_for_status()
page_data = resp.json()["nodes"][page_id]["document"]
nodes = [
{"id": c["id"], "name": c["name"].strip()}
for c in page_data.get("children", [])
if c["name"].strip().startswith("R-HSA-")
]
nodes = get_nodes_on_page(token, EHLD_FILE_KEY, page_id, "R-HSA-")
print(f"Found {len(nodes)} EHLD diagrams")
if not nodes:
print("No EHLDs found!")
Expand All @@ -232,21 +221,12 @@ def validate(do_icons, do_ehlds):
print("VALIDATING")
print("=" * 60)

for f in [REFERENCES_FILE, CATEGORIES_FILE]:
if not os.path.exists(f):
print(f"Error: {f} not found. Cannot run validation.")
return False

cmd = [
"docker", "run", "--rm",
"-v", f"{REFERENCES_FILE}:/app/references.txt",
"-v", f"{CATEGORIES_FILE}:/app/categories.txt",
]

validator_args = [
"java", "-jar", "./target/illustration-validator-jar-with-dependencies.jar",
"-r", "/app/references.txt",
"-c", "/app/categories.txt",
"-e", "false",
]

Expand Down
7 changes: 1 addition & 6 deletions ehld/R-HSA-109582.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions ehld/R-HSA-1226099.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading