Skip to content

Commit

Permalink
add display tag in justice data source script not via transformer (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
LavMatt authored Jul 18, 2024
1 parent 3f11eb6 commit 4ce9887
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 0 additions & 5 deletions ingestion/justice_data_ingest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
13 changes: 12 additions & 1 deletion ingestion/justice_data_source/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4ce9887

Please sign in to comment.