Skip to main content

DynamicAnnotationDB

Actions Status PyPI version Documentation Status

DynamicAnnotationDB (DADB) is an interface layer for creating, modifying and interacting with PostgreSQL databases used to store spatial point annotations and segmentation data defined by a chunkedgraph.

Features

  • Create and manage PostgreSQL databases for annotation storage
  • Handle spatial point annotations with PostGIS integration
  • Support for segmentation data linked to annotations
  • Dynamic schema generation and validation
  • CRUD operations for annotations and segmentation data
  • Reference annotation support with table linking
  • Built-in versioning and tracking of modifications

Installation

You can install DynamicAnnotationDB using pip:

pip install DynamicAnnotationDB

Or install from source:

git clone https://github.com/CAVEconnectome/DynamicAnnotationDB
cd DynamicAnnotationDB
pip install -e .

Quick Start

Here's a basic example of using DynamicAnnotationDB:

from dynamicannotationdb import DynamicAnnotationInterface

# Connect to database
sql_uri = "postgresql://postgres:postgres@localhost:5432"
aligned_volume = "my_annotations"
interface = DynamicAnnotationInterface(sql_uri, aligned_volume)

# Create a new annotation table
table_name = "synapse_annotations"
interface.annotation.create_table(
    table_name=table_name,
    schema_type="synapse",
    description="Synapse annotations for dataset X",
    user_id="user@example.com",
    voxel_resolution_x=4.0,
    voxel_resolution_y=4.0,
    voxel_resolution_z=40.0
)

# Insert annotations
annotations = [{
    "pre_pt": {"position": [121, 123, 1232]},
    "ctr_pt": {"position": [128, 143, 1232]},
    "post_pt": {"position": [235, 187, 1232]},
    "size": 1
}]

annotation_ids = interface.annotation.insert_annotations(table_name, annotations)

Key Components

The interface consists of several key components:

  • Annotation Client: Handle CRUD operations for annotation data
  • Segmentation Client: Manage segmentation data linked to annotations
  • Schema Client: Generate and validate dynamic schemas
  • Database Client: Core database operations and metadata management

Documentation

Full documentation is available at dynamicannotationdb.readthedocs.io.

Features in Detail

Dynamic Schema Support

DADB uses EMAnnotationSchemas to define table structures:

# Create a table with a specific schema
interface.annotation.create_table(
    table_name="my_table",
    schema_type="synapse",
    description="Description",
    user_id="user@example.com",
    voxel_resolution_x=4.0,
    voxel_resolution_y=4.0,
    voxel_resolution_z=40.0
)

Segmentation Support

Link segmentation data to annotations:

# Create a segmentation table
seg_table = interface.segmentation.create_segmentation_table(
    table_name="my_table",
    schema_type="synapse", 
    segmentation_source="seg_source"
)

# Insert linked data
interface.segmentation.insert_linked_annotations(
    table_name="my_table",
    pcg_table_name="seg_source",
    annotations=[...]
)

Reference Tables

Create tables that reference other annotations:

# Create a reference table
interface.annotation.create_table(
    table_name="reference_table",
    schema_type="reference_type",
    description="Reference annotations",
    user_id="user@example.com",
    voxel_resolution_x=4.0,
    voxel_resolution_y=4.0,
    voxel_resolution_z=40.0,
    table_metadata={
        "reference_table": "target_table",
        "track_target_id_updates": True
    }
)

Development

Requirements

  • Python 3.7+
  • PostgreSQL with PostGIS extension
  • Docker (optional, for testing)

Testing

Run tests with pytest:

# Install test requirements
pip install -r test_requirements.txt

# Run tests (requires a PostgreSQL with PostGIS extension running)
pytest

# Run tests with a temporary Docker PostgreSQL instance (preferred local testing method)
pytest --docker=true

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, please open an issue on the GitHub repository.

Metadata

Release files for DynamicAnnotationDB 5.15.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DynamicAnnotationDB 5.15.0
File Size Uploaded
dynamicannotationdb-5.15.0.tar.gz 32.4 kB Details

Release files / dynamicannotationdb-5.15.0.tar.gz

Download URL dynamicannotationdb-5.15.0.tar.gz
Size 32.4 kB
Tags Source
SHA-256 checksum
How to use checksums
31aebc7d820d0a184551cef833fd79830ccfd890a4d8301b7a3de0112db8f222
BLAKE2b-256 checksum
How to use checksums
1b2935f06b4d7786127c24d9777645516609613c39f8eb719ae227cf10ac450d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

5.15.0 This release

1 release file

5.14.1

1 release file

5.13.1

1 release file

5.12.0

1 release file

5.10.0

1 release file

5.9.2

1 release file

5.9.1

1 release file

5.9.0

1 release file

5.8.1

1 release file

5.8.0

1 release file

5.7.3

1 release file

5.7.2

1 release file

5.7.1

1 release file

5.7.0

1 release file

5.6.1

1 release file

5.5.1

1 release file

5.5.0

1 release file

5.4.2

1 release file

5.4.1

1 release file

5.4.0

1 release file

5.3.4

1 release file

5.3.3

1 release file

5.3.2

1 release file

5.3.1

1 release file

5.3.0

1 release file

5.2.2

1 release file

5.2.1

1 release file

5.2.0

1 release file

5.1.8

1 release file

5.1.7

1 release file

5.1.6

1 release file

5.1.5

1 release file

5.1.4

1 release file

5.1.3

1 release file

5.1.2

1 release file

5.1.1

1 release file

5.1.0

1 release file

5.0.7

1 release file

5.0.6

1 release file

5.0.5

1 release file

5.0.4

1 release file

5.0.3

1 release file

5.0.2

1 release file

5.0.1

1 release file

5.0.0

1 release file

4.0.3

1 release file

4.0.2

1 release file

4.0.1

1 release file

4.0.0

1 release file

3.2.0

1 release file

3.1.9

1 release file

3.1.8

1 release file

3.1.7

1 release file

3.1.6

1 release file

3.1.5

1 release file

3.1.4

1 release file

3.1.3

1 release file

3.1.2

1 release file

3.1.1

1 release file

3.1.0

1 release file

3.0.2

1 release file

3.0.1

1 release file

3.0.0

1 release file

2.0.3

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page