Issue: Adding Annotations to the Cosmograph App
Sonnet 3.5
Overview
Annotations enable users to add contextual information and documentation to various aspects of their visualizations, improving communication, knowledge transfer, and reproducibility. This functionality allows teams to maintain institutional knowledge about their data and visualizations without relying on external documentation.
Example use cases:
- A data analyst marks a cluster of anomalous points with "Q3 2024 system outage - exclude from baseline calculations" to help future analysts understand why certain data points should be filtered out.
- A team lead adds project-level notes documenting "Data from legacy CRM system (2020-2023), merged with new system data (2024+). Use
source_system field to distinguish" to prevent confusion about data inconsistencies.
Design Philosophy
Start Unstructured, Evolve Incrementally
Annotations should begin as freeform text (implicitly markdown-formatted) to minimize friction for both implementation and adoption. As usage patterns emerge, we can progressively add structure where it provides clear value.
Evolution path example:
- Phase 1: Data annotation as a single markdown text field
- Phase 2: Recognize common pattern of field descriptions, split into
notes (freeform) + field_descriptions (freeform)
- Phase 3: Structure
field_descriptions as Mapping[str, str] (field_name → description)
- Phase 4: Add validation, auto-completion, type inference for field descriptions
Core Abstraction: Key-Value Pairs
At the most general level, an annotation is:
Annotation = (key: Annotatable, value: AnnotationContent)
Where:
key: Points to what is being annotated (a project, data source, visualization, specific data points, etc.)
value: What we want to record about it (initially freeform text/markdown)
This abstraction allows us to:
- Apply consistent patterns across different annotation types
- Build reusable tooling (indexing, search, export, inversion)
- Evolve each annotation type independently as needs crystallize
Annotation Types & Use Cases
1. Project-Level Annotations
Purpose: High-level context about the entire project
Key examples:
- Data origins and lineage
- Business purpose and stakeholders
- Access permissions and data sensitivity
- Related projects or dashboards
Key structure: project_id → markdown_text
2. Data Source Annotations
Purpose: Document the raw data being visualized
Key examples:
- Source URL or database connection
- Data preparation steps and transformations
- Field descriptions and data dictionary
- Update frequency and freshness
Key structure (initial): data_source_id → markdown_text
Evolution path: Extract field descriptions into structured mapping
3. Visualization Annotations
Purpose: Document the visualization configuration itself
Key examples:
- Why specific visual encodings were chosen
- Known limitations or caveats in the visualization
- Instructions for interpreting the view
- Change log for visualization config
Key structure: (data_source_id, viz_config_hash) → markdown_text
This treats the visualization as data + viz_mapping, allowing annotations on specific visualization instances.
4. Data Point/Subset Annotations
Purpose: Mark and explain specific observations or patterns
Key examples:
- Annotate individual outlier points
- Label clusters or groups discovered in exploration
- Document filtered subsets (e.g., "training set", "validation set")
- Mark known data quality issues
Key structure:
- Point:
(data_source_id, point_id) → markdown_text
- Group:
(data_source_id, point_ids: Collection) → markdown_text
- Filter:
(data_source_id, filter_function: Callable) → markdown_text
UI/UX Considerations
- In-line annotation editor: Click any element (project name, data source, viz, point) to add/edit annotation
- Annotation panel: Side panel showing all annotations relevant to current view
- Search: Global annotation search across all types
- Export: Download all annotations as a markdown documentation bundle
- Visual indicators: Badge/icon showing which elements have annotations
Migration Path
- v1: Implement project and data source annotations (simplest, highest value)
- v2: Add visualization annotations
- v3: Add point/subset annotations with basic retrieval
- v4: Introduce structured field descriptions for data sources
- v5: Add enhanced querying for point annotations (filters, groups)
- v6: Implement search, indexing, and export tooling
Open Questions
- Permissions: Should annotations have separate access controls from the underlying data?
- Versioning: Should we track annotation history/changes?
- Collaboration: How do multiple users annotate the same element? Merge, separate, thread?
- Formatting: Start with markdown, but allow configuration? Rich text editor?
- Size limits: Should individual annotations have size constraints?
Issue: Adding Annotations to the Cosmograph App
Sonnet 3.5
Overview
Annotations enable users to add contextual information and documentation to various aspects of their visualizations, improving communication, knowledge transfer, and reproducibility. This functionality allows teams to maintain institutional knowledge about their data and visualizations without relying on external documentation.
Example use cases:
source_systemfield to distinguish" to prevent confusion about data inconsistencies.Design Philosophy
Start Unstructured, Evolve Incrementally
Annotations should begin as freeform text (implicitly markdown-formatted) to minimize friction for both implementation and adoption. As usage patterns emerge, we can progressively add structure where it provides clear value.
Evolution path example:
notes(freeform) +field_descriptions(freeform)field_descriptionsasMapping[str, str](field_name → description)Core Abstraction: Key-Value Pairs
At the most general level, an annotation is:
Where:
key: Points to what is being annotated (a project, data source, visualization, specific data points, etc.)value: What we want to record about it (initially freeform text/markdown)This abstraction allows us to:
Annotation Types & Use Cases
1. Project-Level Annotations
Purpose: High-level context about the entire project
Key examples:
Key structure:
project_id → markdown_text2. Data Source Annotations
Purpose: Document the raw data being visualized
Key examples:
Key structure (initial):
data_source_id → markdown_textEvolution path: Extract field descriptions into structured mapping
3. Visualization Annotations
Purpose: Document the visualization configuration itself
Key examples:
Key structure:
(data_source_id, viz_config_hash) → markdown_textThis treats the visualization as
data + viz_mapping, allowing annotations on specific visualization instances.4. Data Point/Subset Annotations
Purpose: Mark and explain specific observations or patterns
Key examples:
Key structure:
(data_source_id, point_id) → markdown_text(data_source_id, point_ids: Collection) → markdown_text(data_source_id, filter_function: Callable) → markdown_textUI/UX Considerations
Migration Path
Open Questions