Skip to content

📊 Expand indicator paths for x, size, color dimensions#5869

Open
Marigold wants to merge 5 commits into
masterfrom
data-indicatorpaths-xsizecolor
Open

📊 Expand indicator paths for x, size, color dimensions#5869
Marigold wants to merge 5 commits into
masterfrom
data-indicatorpaths-xsizecolor

Conversation

@Marigold
Copy link
Copy Markdown
Collaborator

@Marigold Marigold commented Mar 31, 2026

Closes #5665

Expand indicator paths for x, size, and color dimensions — previously only y was supported.

What changed

1. expand_config() / create_collection() now accept additional_indicators

Adds x/size/color indicators to every auto-generated view during expansion:

config = expand_config(
    tb=tb,
    indicator_names="deaths",
    additional_indicators={
        "size": "historical#population_historical",
        "color": "regions#owid_region",
    },
)

Short paths are expanded using the same logic as y indicators; paths with # or full catalog paths are kept as-is.

2. Collection.save() now auto-expands short paths added after creation

Previously, path expansion only ran once during create_collection(). If you added x/size/color indicators after that (e.g. after group_views), you had to hardcode full catalog paths. Now save() re-runs expand_paths() before validation — already-complete paths are safely skipped.

This enables the pattern from the issue:

# Before — hardcoded full paths:
view.indicators.size = Indicator(
    catalogPath="grapher/demography/2024-07-15/population/historical#population_historical"
)
view.indicators.color = Indicator(
    catalogPath="grapher/regions/2023-01-01/regions/regions#owid_region"
)

# After — short paths, auto-expanded at save():
view.indicators.set_indicator(
    size="historical#population_historical",
    color="regions#owid_region",
)

3. Updated real-world steps to use short paths

  • incomes_wid.py — the exact example from the issue
  • dummy.py — also used a full path for color

Testing

  • 6 new tests covering full paths, table#indicator paths, short slugs, all expand_path_mode values, invalid axis validation, and combined with common_view_config
  • All 137 collection tests pass (2 pre-existing integration failures unrelated to this change)

@owidbot
Copy link
Copy Markdown
Contributor

owidbot commented Mar 31, 2026

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs

Login: ssh owid@staging-site-data-indicatorpaths-xsizecol

chart-diff: ✅ No charts for review.
data-diff: ✅ No differences found

Automatically updated datasets matching excess_mortality|covid|fluid|flunet|country_profile|garden/ihme_gbd/2019/gbd_risk are not included

Edited: 2026-03-31 12:51:21 UTC
Execution time: 8.12 seconds

- Add additional_indicators param to expand_config/create_collection
- Auto-expand short paths in Collection.save() for post-creation indicators
- Update incomes_wid.py and dummy.py to use short paths

Closes #5665
@Marigold Marigold force-pushed the data-indicatorpaths-xsizecolor branch from d2fa7b1 to 297e20d Compare March 31, 2026 12:56
@Marigold Marigold marked this pull request as ready for review March 31, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MDIMs: Automatically expand indicator paths of dimensions other than y

2 participants