From 455c060e572ba296df0c50d359128136b2312351 Mon Sep 17 00:00:00 2001 From: anon Date: Thu, 5 Nov 2026 19:23:11 +0100 Subject: [PATCH] feat(catalog): add tissue/disease facet-hierarchy columns to schema The hub cut emits tissue_system/_id, tissue_organ/_id, disease_class/_id and disease_group/_id (computed from the pinned UBERON/MONDO node graphs + anchor tables). Declare them as nullable string columns so the client carries them. --- src/sddb/_catalog_schema.py | 11 +++++++++++ tests/test_catalog_schema.py | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/sddb/_catalog_schema.py b/src/sddb/_catalog_schema.py index c114ff0..d657fe6 100644 --- a/src/sddb/_catalog_schema.py +++ b/src/sddb/_catalog_schema.py @@ -22,6 +22,17 @@ "disease": "string", "disease_id": "string", "development_stage": "string", + # Facet hierarchy, computed at the cut from the pinned UBERON/MONDO node graphs + the hub's ordered + # anchor tables (first anchor by id over the term + its ancestors wins; self-anchor is its own organ). + # Unmapped tissue -> system "other tissues"; unmapped disease -> "other conditions"; unknown stays null. + "tissue_system": "string", + "tissue_system_id": "string", + "tissue_organ": "string", + "tissue_organ_id": "string", + "disease_class": "string", + "disease_class_id": "string", + "disease_group": "string", + "disease_group_id": "string", # technology "technology": "string", "assay": "string", diff --git a/tests/test_catalog_schema.py b/tests/test_catalog_schema.py index 19e0777..c643cb5 100644 --- a/tests/test_catalog_schema.py +++ b/tests/test_catalog_schema.py @@ -226,6 +226,25 @@ def test_obs_unit_and_segmentation_columns_present(): assert col not in schema.REQUIRED_COLUMNS +def test_facet_hierarchy_columns_present(): + # tissue_system/organ + disease_class/group (+ UBERON/MONDO ids) the cut computes from the pinned + # ontology node graphs + anchor tables; nullable strings, not required. + from sddb import _catalog_schema as schema + + for col in ( + "tissue_system", + "tissue_system_id", + "tissue_organ", + "tissue_organ_id", + "disease_class", + "disease_class_id", + "disease_group", + "disease_group_id", + ): + assert schema.CATALOG_COLUMNS[col] == "string" + assert col not in schema.REQUIRED_COLUMNS + + _NEW_DATASET_COLUMNS = { "sample_title": "string", "timepoint": "string",