Skip to content

cdm_data_loaders.schemas.ncbi_datasets.ncbi_openapi

Bundled JSON Schema registry, record transforms, and PyArrow schemas for NCBI Datasets.

filter_annotation_report

filter_annotation_report(
    record: dict[str, Any],
) -> dict[str, list[dict[str, Any]]]

Discard annotation report records without a non-empty top-level reports list.

Parameters:

Name Type Description Default
record dict[str, Any]

validated annotation report record

required

Returns:

Type Description
dict[str, list[dict[str, Any]]]

mapping with annotation_report row when reports is non-empty, or empty dict

Source code in src/cdm_data_loaders/schemas/ncbi_datasets/ncbi_openapi.py
def filter_annotation_report(record: dict[str, Any]) -> dict[str, list[dict[str, Any]]]:
    """Discard annotation report records without a non-empty top-level ``reports`` list.

    :param record: validated annotation report record
    :type record: dict[str, Any]
    :return: mapping with ``annotation_report`` row when ``reports`` is non-empty, or empty dict
    :rtype: dict[str, list[dict[str, Any]]]
    """
    if not record.get("reports"):
        return {}
    return {ANNOTATION_REPORT_TABLE: [record]}