-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use tags to populate subject areas (#1233)
* feat: add subject area models * refactor: use helper function * refactor: use tags to populate subject areas list * refactor: filter on subject area using tags * refactor: use tags when displaying subject area The subject area labels were previously populated from the domain in Datahub. This now comes from a tag. Where there are multiple tags, pick the first one for now. In a future commit, I'll enable multiple subject areas to be displayed. * refactor: remove unused code for domains * Update datahub_client/search/search_client.py Co-authored-by: Murdo <[email protected]> * Update datahub_client/parsers.py Co-authored-by: Murdo <[email protected]> * refactor: extract helper for name parsing --------- Co-authored-by: Murdo <[email protected]>
- Loading branch information
Showing
17 changed files
with
308 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,7 @@ fragment globalTagsFields on GlobalTags { | |
tag { | ||
urn | ||
type | ||
name | ||
properties { | ||
name | ||
colorHex | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
query listSubjectAreas( | ||
$filters:[FacetFilterInput!] | ||
$query: String! | ||
$types: [EntityType!] | ||
) { | ||
aggregateAcrossEntities( | ||
input: {searchFlags: {maxAggValues:100}, query: $query, types: $types, facets: ["tags"], orFilters: [{and: $filters}]} | ||
) { | ||
facets { | ||
field | ||
aggregations { | ||
value | ||
count | ||
entity { | ||
urn | ||
... on Tag { | ||
name | ||
properties { | ||
name | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import logging | ||
from importlib.resources import files | ||
|
||
from ..exceptions import CatalogueError | ||
|
||
GRAPHQL_FILES_PATH = "datahub_client.graphql" | ||
GRAPHQL_FILE_EXTENSION = ".graphql" | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def get_graphql_query(graphql_query_file_name: str) -> str: | ||
query_text = ( | ||
files(GRAPHQL_FILES_PATH) | ||
.joinpath(f"{graphql_query_file_name}{GRAPHQL_FILE_EXTENSION}") | ||
.read_text() | ||
) | ||
if not query_text: | ||
logger.error("No graphql query file found for %s", graphql_query_file_name) | ||
raise CatalogueError( | ||
f"No graphql query file found for {graphql_query_file_name}" | ||
) | ||
return query_text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.