Skip to content

Add helper method to serialize QC evaluation objects from aind-data-schema #181

@johendrickson

Description

@johendrickson

Is your feature request related to a problem? Please describe.
Following the implementation of MetadataDbClient.add_qc_evaluation, we need to add a new helper method under the helpers subpackage to handle serialization of quality control (QC) objects from the aind-data-schema.

Currently, MetadataDbClient.add_qc_evaluation expects input data to already be in dictionary form. In practice, scientists and other users will often have QCEvaluation objects (or lists of them) generated using aind-data-schema. Without a built-in helper, users must manually serialize these objects and call the client method directly.

Describe the solution you'd like
As a scientist using the aind-data-access-api, I want to pass QCEvaluation objects (or lists of them) directly to a helper function,
so that the helper automatically serializes them into Python dictionaries and uses MetadataDbClient.add_qc_evaluation to add the QC evaluations to DocDB.

Acceptance criteria:
Given a QCEvaluation or list of QCEvaluation objects from aind-data-schema, when a user passes them to the new helper, then the helper should serialize them into dictionaries and call MetadataDbClient.add_qc_evaluation to add them to DocDB.

  • New helper method implemented under helpers.
  • Supports both single and multiple QCEvaluation inputs.
  • Uses MetadataDbClient.add_qc_evaluation internally to submit data.
  • Includes unit tests for single and list inputs.
  • Includes clear docstrings describing input and output formats.

Describe alternatives you've considered
We considered having MetadataDbClient.add_qc_evaluation handle both object and dictionary inputs, or requiring users to manually serialize QCEvaluation objects before calling it. However, both approaches add unnecessary complexity.

Additional context
This issue follows up on the recent PR adding MetadataDbClient.add_qc_evaluation. The goal is to support smoother integration with aind-data-schema and lay the groundwork for future V2 support (e.g., QCMetric objects).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions