From 4ce9887481183a8fad6b98ea319c25ea366ea37e Mon Sep 17 00:00:00 2001 From: Matt <38562764+LavMatt@users.noreply.github.com> Date: Thu, 18 Jul 2024 14:44:51 +0100 Subject: [PATCH] add display tag in justice data source script not via transformer (#208) --- ingestion/justice_data_ingest.yaml | 5 ----- ingestion/justice_data_source/source.py | 13 ++++++++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ingestion/justice_data_ingest.yaml b/ingestion/justice_data_ingest.yaml index ddb4091..4eeba43 100644 --- a/ingestion/justice_data_ingest.yaml +++ b/ingestion/justice_data_ingest.yaml @@ -2,8 +2,3 @@ source: type: ingestion.justice_data_source.source.JusticeDataAPISource config: base_url: "https://data.justice.gov.uk/api" - -transformers: - - type: "add_dataset_tags" - config: - get_tags_to_add: "ingestion.taggers.display_in_catalogue_tagger.add_display_in_catalogue_tag" diff --git a/ingestion/justice_data_source/source.py b/ingestion/justice_data_source/source.py index 9e5c204..d94da09 100644 --- a/ingestion/justice_data_source/source.py +++ b/ingestion/justice_data_source/source.py @@ -19,7 +19,13 @@ from datahub.metadata.com.linkedin.pegasus2avro.common import ChangeAuditStamps, Status from datahub.metadata.com.linkedin.pegasus2avro.metadata.snapshot import ChartSnapshot from datahub.metadata.com.linkedin.pegasus2avro.mxe import MetadataChangeEvent -from datahub.metadata.schema_classes import BrowsePathsV2Class, ChartInfoClass +from datahub.metadata.schema_classes import ( + BrowsePathsV2Class, + ChartInfoClass, + GlobalTagsClass, + TagAssociationClass, +) + from .api_client import JusticeDataAPIClient from .config import JusticeDataAPIConfig @@ -77,6 +83,11 @@ def _make_chart(self, chart_data) -> MetadataChangeEvent: ) chart_snapshot.aspects.append(chart_info) + # add tag so entity displays in find-moj-data + tag_urn = builder.make_tag_urn(tag="dc_display_in_catalogue") + display_tag = GlobalTagsClass(tags=[TagAssociationClass(tag_urn)]) + chart_snapshot.aspects.append(display_tag) + # TODO: browse paths requires IDs, not just titles breadcrumb = chart_data.get("breadcrumb") breadcrumb.append(title)