Skip to content

Generalize alerts secondary datasets beyond Mapeo - #563

Merged
conservationtimothy merged 4 commits into
mainfrom
feat/alerts-secondary-dataset-544
Aug 4, 2026
Merged

Generalize alerts secondary datasets beyond Mapeo#563
conservationtimothy merged 4 commits into
mainfrom
feat/alerts-secondary-dataset-544

Conversation

@conservationtimothy

Copy link
Copy Markdown
Contributor

Goal

Make the Alerts Dashboard secondary layer data-source agnostic: any compatible geospatial table can be configured and rendered, with generic “secondary dataset” terminology instead of Mapeo-specific naming, while existing Mapeo-backed alerts views keep working. Closes #544

Screenshots

Screenshot 2026-07-31 at 14 35 44 Screenshot 2026-07-31 at 14 32 03 Screenshot 2026-07-31 at 14 28 06 Screenshot 2026-07-31 at 14 27 31

What I changed and why

  • Renamed the Mapeo-specific alerts surface to generic secondary naming throughout: mapeoDatasecondaryData, MAPEO_CATEGORY_IDSSECONDARY_CATEGORY_IDS, mapeoDocIdsecondaryDocId, layer mapeo-datasecondary-data, feature_type: "mapeo"feature_type: "secondary"
  • Treats Mapeo as one possible secondary source rather than a hardcoded special case at the configuration boundary
  • Category filtering is now optional: data is fetched whenever a secondary table is set, and the allowlist is only applied when category IDs are present
  • Hex document IDs are auto-detected for Mapbox hashing, replacing the isMapeoData flag
  • Secondary dataset selector is now limited to geospatial tables
  • Legacy mapeoDocId, MAPEO_CATEGORY_IDS, and feature_type: "mapeo" are accepted via migration or silent URL rewrite so existing views and deep links continue to work

How I convinced myself this is right

I confirmed the generic flow works for any compatible geospatial table while existing Mapeo-backed views remain unchanged through backward compatibility and targeted tests.

What I'm not doing here

  • Rendering secondary datasets on the Map view (config allows it; map API still primary-only)
  • Toast when rewriting legacy mapeoDocId URLs
  • Renaming warehouse table mapeo_data or Mapeo schema docs/fixtures

Basically nothing extrenous

LLM use disclosure

Cursor Grok 4.5 with me driving

@rudokemper rudokemper left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This accomplishes the glorified "Find & Replace All" for "Mapeo" -> "secondary". But it is missing an important piece of the puzzle which I described in one of my comments. I think we should have another PR (targeting this branch) handle the required changes to config to allow users to pick their filter column, and specify values to include on the alerts dashboard.

Once the dust on all this has settled, we can rethink overall config UX in #435

Comment thread server/utils/index.ts
/**
* Warehouse tables that expose both `g__type` and `g__coordinates` (plottable secondary datasets).
*/
export const getGeospatialTableNames = async (): Promise<string[]> => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of this could have been its own PR. Think of how easier it would be to review this overall large PR, AND to follow the commit history of this project. I strongly recommend thinking about this for future PRs.

emit("updateConfig", {
SECONDARY_CATEGORY_IDS: values,
MAPEO_CATEGORY_IDS: undefined,
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The concept of a "category" is unique to Mapeo.

If we are generalizing to any secondary dataset, then we need more general language and handling.

Currently, for Mapeo data, we hardcode a category field somewhere, and then in config, allow the user to pick the categories for which they want data to show on the map:

Image

Now we actually need two fields:

  1. "Filter data by column" (to replaced hard-coded category field for Mapeo)
  2. "Pick the values to show on the map" (the current equivalent of "Mapeo Category IDs to show on the alerts map")

We actually already have a "Filter data by column" field - we just don't use it for the alerts dashboard.

Confusingly, we also have a "Which values to filter out from the column" which does the opposite of what we need for (2).

But we can reuse the existing "Filter data by column" field, and then turn "Category IDs to show from the secondary dataset on the alerts map" into that?

Maybe this should be a follow-on PR, though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened a PR #566

Comment thread components/shared/MapLegend.vue Outdated
Comment on lines +98 to +99
item.name === "Secondary data"
? $t("secondaryData")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Whatever the name of the secondary dataset table is should show here, instead of "Secondary Data" which is not helpful to the end user.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2026-08-03 at 19 19 29 Done

@conservationtimothy
conservationtimothy force-pushed the feat/alerts-secondary-dataset-544 branch from 71c81aa to 8366d8e Compare August 3, 2026 18:34
@conservationtimothy
conservationtimothy merged commit 386fedf into main Aug 4, 2026
4 checks passed
@conservationtimothy
conservationtimothy deleted the feat/alerts-secondary-dataset-544 branch August 4, 2026 06:29
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.

Generalize alerts secondary datasets beyond Mapeo

2 participants