-
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.
Added metadata spec
- Loading branch information
Showing
18 changed files
with
322 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from typing import NamedTuple | ||
import os | ||
from typing import NamedTuple | ||
|
||
|
||
class Domain(NamedTuple): | ||
|
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,44 @@ | ||
from data_platform_catalogue.entities import ( | ||
AccessInformation, | ||
Chart, | ||
Column, | ||
ColumnRef, | ||
CustomEntityProperties, | ||
Database, | ||
DataSummary, | ||
DomainRef, | ||
Entity, | ||
EntityRef, | ||
Governance, | ||
OwnerRef, | ||
Table, | ||
TagRef, | ||
UsageRestrictions, | ||
) | ||
|
||
|
||
class MetadataSpecificationService: | ||
def __init__(self): | ||
self.context = self._get_context() | ||
|
||
def _get_context(self): | ||
return { | ||
"h1_value": "Metadata Specification", | ||
"entities": { | ||
"Table": Table.model_json_schema(), | ||
"Database": Database.model_json_schema(), | ||
"Chart": Chart.model_json_schema(), | ||
"CustomEntityProperties": CustomEntityProperties.model_json_schema(), | ||
"UsageRestrictions": UsageRestrictions.model_json_schema(), | ||
"AccessInformation": AccessInformation.model_json_schema(), | ||
"EntityRef": EntityRef.model_json_schema(), | ||
"Governance": Governance.model_json_schema(), | ||
"OwnerRef": OwnerRef.model_json_schema(), | ||
"DomainRef": DomainRef.model_json_schema(), | ||
"Column": Column.model_json_schema(), | ||
"ColumnRef": ColumnRef.model_json_schema(), | ||
"TagRef": TagRef.model_json_schema(), | ||
"DataSummary": DataSummary.model_json_schema(), | ||
"Entity": Entity.model_json_schema(), | ||
}, | ||
} |
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,18 @@ | ||
from django import template | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.filter | ||
def format_metadata_field_type(value: dict) -> str: | ||
if value.get("title"): | ||
title = value["title"] | ||
if value.get("type"): | ||
type_string = value["type"] | ||
if value.get("anyOf"): | ||
type_string = " or ".join(item["type"] for item in value["anyOf"]) | ||
output = f"{title} ({type_string})" | ||
if value.get("allOf"): | ||
linked_entity = value["allOf"][0]["$ref"].split("/")[2] | ||
output = f"{linked_entity} (object)" | ||
return output |
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
Oops, something went wrong.