Imports task classes from the installed pyhealth package and writes
data/tasks.json. Run this whenever a task class is added or renamed.
Prerequisites: pyhealth installed in your active Python environment.
# From the pyhealth.github.io repo root:
python scripts/extract_metadata.py
# Custom output path:
python scripts/extract_metadata.py --output data/tasks.jsonOutput goes to data/tasks.json by default.
- Add the task class to
PyHealth/pyhealth/tasks/. - Run the script to regenerate
data/tasks.json. - Add one entry to
data/tasks_extra.json(see format below). - Commit both JSON files — the site renders from them automatically.
Each entry is one Python class found in pyhealth/tasks/:
{
"class_name": "MortalityPredictionMIMIC3",
"task_name": "MortalityPredictionMIMIC3",
"description": "Task for predicting mortality using MIMIC-III...",
"input_schema": {"conditions": "sequence", "procedures": "sequence"},
"output_schema": {"mortality": "binary"},
"output_type": "binary",
"source_file": "pyhealth/tasks/mortality_prediction.py"
}output_type is inferred from output_schema values. Classes that set their
schema dynamically in __init__ will have null here — override via
tasks_extra.json.
Controls which tasks appear on the site and in what order. Fields:
| Field | Required | Description |
|---|---|---|
class_name |
Yes | Python class name — used to join with tasks.json |
display_name |
Yes | Human-readable title shown on the card |
display_class |
No | Short name shown in the code snippet (defaults to class_name) |
datasets |
Yes | Array of dataset pill labels, e.g. ["MIMIC-III"] |
description |
Yes | One-sentence description for the card |
colab_url |
No | Colab notebook URL |
docs_url |
No | ReadTheDocs URL (defaults to the tasks index page) |
output_type |
No | Override auto-detected type (needed when schema is set in __init__) |
Minimal entry:
{
"class_name": "MyNewTask",
"display_name": "My New Task",
"datasets": ["MIMIC-IV"],
"description": "One sentence for the website card.",
"colab_url": "https://colab.research.google.com/drive/..."
}The site fetches JSON via fetch(), so it must be served over HTTP:
cd /path/to/pyhealth.github.io
python -m http.server 8080
# open http://localhost:8080/tasks.htmlThis script scans the blogs/ folder and writes the blog index used by the
site.
- Input:
blogs/YYYY-MM-DD/*.md(uses the first.mdfile in each dated folder) - Output:
data/blogs.json - What it computes: title/author (from frontmatter or
# ...), preview text,word_count, andread_time_min(based on words-per-minute).
Run it whenever you:
- add a new blog post folder,
- rename the
.mdfile inside a post folder, - or change post content and want
preview/word_count/read_time_minupdated.
# From the pyhealth.github.io repo root:
python scripts/build_blog_index.pyblog_list.htmlloadsdata/blogs.jsonto render the list.blog.html?post=YYYY-MM-DDloadsdata/blogs.jsonto find the markdown filename, then fetchesblogs/YYYY-MM-DD/<file>.mdand converts the Markdown to HTML in the browser.
Because the site uses fetch(), preview via an HTTP server:
cd /path/to/pyhealth.github.io
python -m http.server 8080
# open http://localhost:8080/blog_list.htmlTo open a specific post:
http://localhost:8080/blog.html?post=YYYY-MM-DD