Skip to content

feat: add demographic faceted filters to study table #190

@NoopDog

Description

@NoopDog

Summary

Add sex, race/ethnicity, and computed ancestry as faceted filter columns in the study table UI. Values use canonical labels — the normalization is already done by the search API (#189).

Context

The search API now returns a demographics field on each study with normalized categories:

{
  "demographics": {
    "sex": {
      "n": 981,
      "categories": [
        { "label": "Male", "count": 654, "percent": 66.7 },
        { "label": "Female", "count": 327, "percent": 33.3 }
      ]
    }
  }
}

Because dbGaP studies are submitted independently by thousands of research groups, demographic labels vary across studies (e.g., "Female", "F", "female", "Woman"). The API normalizes these into a small set of canonical categories via demographic_mappings.json:

  • Sex: Male, Female, Other/Unknown (3 values)
  • Race/Ethnicity: American Indian or Alaska Native, Asian, Black or African American, Hispanic or Latino, Multiple, Native Hawaiian or Other Pacific Islander, Other, Unknown/Not Reported, White (9 values)
  • Computed Ancestry: African, African American, East Asian, European, Hispanic1, Hispanic2, Other, Other Asian or Pacific Islander, South Asian (9 values)

The frontend should use these canonical labels to drive the filters.

Implementation

  1. Populate filterable columns from each study's demographics.*.categories[].label — e.g., a study with sex.categories: [{label: "Male"}, {label: "Female"}] gets sex: ["Male", "Female"] as a multi-value filterable field, same pattern as platforms or dataTypes.
  2. Add faceted filters for sex, raceEthnicity, and computedAncestry to the filter sidebar, following the existing multi-value filter pattern.
  3. Group the 3 demographic filters under a "Demographics" section in the sidebar.

Acceptance criteria

  • Sex, race/ethnicity, and computed ancestry appear as filterable facets in the study table
  • Filter values are canonical labels (e.g., "Black or African American"), not raw study-specific labels
  • Filter counts reflect the number of studies with each canonical category
  • Selecting a filter value (e.g., "Female") shows only studies that have female participants
  • Studies without demographic data are handled gracefully (excluded from counts, not hidden from table)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions