Skip to content

HERD: add a custom repr/_repr_html_ so a read-back HERD does not appear empty #1508

Description

@rly

Motivation

HERD inherits the generic Container._repr_html_ (src/hdmf/container.py), which renders its six child tables (keys, files, entities, entity_keys, objects, object_keys) as nested collapsible sections. For a HERD read back from a file, these collapsibles can appear empty at first glance, which is confusing: the data is present and accessible via to_dataframe() and the individual tables, but the default display does not surface it.

This is a real, documented usability problem. The PyNWB HERD tutorial currently has to warn users about it:

"In a Jupyter notebook, the default display of a read HERD shows collapsible sections that can appear empty. To see the annotations, use ... to_dataframe() ... or the individual tables."

(see the tutorial in NeurodataWithoutBorders/pynwb#2200)

Proposal

Give HERD a custom __repr__ and _repr_html_ that surface the actual annotations, e.g. the flattened to_dataframe() view (one row per (object, key, entity) association), or a concise summary plus the flattened table. This removes the "appears empty" confusion and makes the contents discoverable without the user needing to know which accessor to call.

Display only; no change to stored data or the table APIs.

Context

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions