Skip to content

Commit c241ce1

Browse files
committed
fix colab links as needed, add CI check for colab link
1 parent e43002f commit c241ce1

6 files changed

Lines changed: 35 additions & 5 deletions

File tree

notebooks/advanced_topics/gcs_aws_direct_access.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"colab_type": "text"
2424
},
2525
"source": [
26-
"<a href=\"https://colab.research.google.com/github/ImagingDataCommons/IDC-Tutorials/blob/master/noteboooks/advanced_topics/gcs_aws_direct_access.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
26+
"<a href=\"https://colab.research.google.com/github/ImagingDataCommons/IDC-Tutorials/blob/master/notebooks/advanced_topics/gcs_aws_direct_access.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
2727
]
2828
},
2929
{

notebooks/advanced_topics/idc_on_aws/idc-on-aws-tutorial.ipynb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"<a href=\"https://colab.research.google.com/github/ImagingDataCommons/IDC-Tutorials/blob/master/notebooks/advanced_topics/idc_on_aws/idc-on-aws-tutorial.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
8+
],
9+
"id": "17e6bac3-1823-4ddd-8f38-343406dbe974"
10+
},
311
{
412
"cell_type": "markdown",
513
"id": "325cda63-60b6-49b5-b4db-dd5ea2a62ed4",

notebooks/analysis/mhubai_tutorial.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"colab_type": "text"
2929
},
3030
"source": [
31-
"<a href=\"https://colab.research.google.com/github/MHubAI/examples/blob/main/notebooks/PW41_tutorial.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
31+
"<a href=\"https://colab.research.google.com/github/ImagingDataCommons/IDC-Tutorials/blob/master/notebooks/analysis/mhubai_tutorial.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
3232
]
3333
},
3434
{

notebooks/collections_demos/rms_mutation_prediction/RMS-Mutation-Prediction-Expert-Annotations_BigQuery.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"<a href=\"https://colab.research.google.com/github/ImagingDataCommons/IDC-Tutorials/blob/master/notebooks/collections_demos/rms_mutation_prediction/RMS-Mutation-Prediction-Expert-Annotations_exploration.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
7+
"<a href=\"https://colab.research.google.com/github/ImagingDataCommons/IDC-Tutorials/blob/master/notebooks/collections_demos/rms_mutation_prediction/RMS-Mutation-Prediction-Expert-Annotations_BigQuery.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
88
]
99
},
1010
{
@@ -202,7 +202,7 @@
202202
" </tr>\n",
203203
" </tbody>\n",
204204
"</table>\n",
205-
"<p>680 rows × 3 columns</p>\n",
205+
"<p>680 rows \u00d7 3 columns</p>\n",
206206
"</div>\n",
207207
" <div class=\"colab-df-buttons\">\n",
208208
"\n",

notebooks/labs/idc_mhub_miccai23.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@
815815
"colab_type": "text"
816816
},
817817
"source": [
818-
"<a href=\"https://colab.research.google.com/github/MHubAI/examples/blob/miccai23/notebooks/MICCAI23_tutorial.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
818+
"<a href=\"https://colab.research.google.com/github/ImagingDataCommons/IDC-Tutorials/blob/master/notebooks/labs/idc_mhub_miccai23.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
819819
]
820820
},
821821
{

test/src/check_notebook_standards.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
2. Include a "## Acknowledgments" section
55
3. Reference the IDC-Tutorials repository for additional tutorials
66
4. Include an "Updated: <Month> <Year>" field
7+
5. Include a correct Colab badge link pointing to the notebook's own path
78
"""
89

910
import json
@@ -28,6 +29,11 @@
2829

2930
IDC_TUTORIALS_URL = "github.com/ImagingDataCommons/IDC-Tutorials"
3031

32+
COLAB_PREFIX = "https://colab.research.google.com/github/ImagingDataCommons/IDC-Tutorials/blob/master/"
33+
COLAB_LINK_RE = re.compile(
34+
r'https://colab\.research\.google\.com/github/[^">\s]+'
35+
)
36+
3137

3238
def get_markdown_sources(notebook_path):
3339
"""Return a list of concatenated source strings for each markdown cell."""
@@ -48,6 +54,7 @@ def get_markdown_sources(notebook_path):
4854
def check_notebook(notebook_path):
4955
"""Check a single notebook for required standards. Returns list of issues."""
5056
issues = []
57+
rel_path = notebook_path.relative_to(NOTEBOOKS_DIR.parent)
5158
cells = get_markdown_sources(notebook_path)
5259
all_text = "\n".join(cells)
5360

@@ -69,6 +76,21 @@ def check_notebook(notebook_path):
6976
if not UPDATED_RE.search(all_text):
7077
issues.append("Missing 'Updated: <Month> <Year>' field (e.g., 'Updated: Feb 2026')")
7178

79+
# Check 5: Colab badge link exists and points to correct path
80+
expected_colab_url = COLAB_PREFIX + str(rel_path)
81+
colab_links = COLAB_LINK_RE.findall(all_text)
82+
if not colab_links:
83+
issues.append("Missing Colab badge link")
84+
else:
85+
# Check the first colab link (the badge) points to this notebook
86+
badge_link = colab_links[0]
87+
if badge_link != expected_colab_url:
88+
issues.append(
89+
f"Colab badge link mismatch:\n"
90+
f" found: {badge_link}\n"
91+
f" expected: {expected_colab_url}"
92+
)
93+
7294
return issues
7395

7496

0 commit comments

Comments
 (0)