def main()

in sync/datahub/metrichub_glossary.py [0:0]


def main() -> None:
    metric_hub_definitions = get_metric_definitions()
    product_nodes = [
        _build_product_dict(product, product_metrics)
        for product, product_metrics in itertools.groupby(
            metric_hub_definitions, operator.attrgetter("product")
        )
    ]

    glossary = {
        "version": 1,
        "source": "Metric-Hub",
        "url": METRIC_HUB_REPO_URL,
        "owners": [],
        "nodes": [
            {
                "name": "Metric Hub",
                "description": "Central hub for metric definitions that are considered the source of truth.",  # noqa: E501
                "nodes": product_nodes,
            }
        ],
    }

    datasets_yaml_data = _generate_table_to_term_data(metric_hub_definitions)

    with open(GLOSSARY_FILENAME, "w+") as f:
        yaml.dump(glossary, f)

    with open(TABLE_TO_METRIC_FILENAME, "w+") as f:
        yaml.dump(datasets_yaml_data, f, sort_keys=False)