-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #348 from DagsHub/classify-metadata-fields
Add enrichment tag annotation
- Loading branch information
Showing
14 changed files
with
326 additions
and
45 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
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,58 @@ | ||
import enum | ||
from abc import ABCMeta | ||
from typing import List | ||
|
||
|
||
class ReservedTags(enum.Enum): | ||
ANNOTATION = "annotation" | ||
|
||
|
||
# These are the base primitives that the data engine database is capable of storing | ||
class MetadataFieldType(enum.Enum): | ||
BOOLEAN = "BOOLEAN" | ||
INTEGER = "INTEGER" | ||
FLOAT = "FLOAT" | ||
STRING = "STRING" | ||
BLOB = "BLOB" | ||
|
||
|
||
# Inheritors of this ABC define custom types | ||
# They are backed by a primitive type, but they also may have additional tags, describing specialized behavior | ||
class DagshubDataType(metaclass=ABCMeta): | ||
""" | ||
Attributes: | ||
backing_field_type: primitive type in the data engine database | ||
custom_tags: additional tags applied to this type | ||
""" | ||
backing_field_type: MetadataFieldType = None | ||
custom_tags: List[str] = None | ||
|
||
|
||
class Int(DagshubDataType): | ||
backing_field_type = MetadataFieldType.INTEGER | ||
|
||
|
||
class String(DagshubDataType): | ||
backing_field_type = MetadataFieldType.STRING | ||
|
||
|
||
class Blob(DagshubDataType): | ||
backing_field_type = MetadataFieldType.BLOB | ||
|
||
|
||
class Float(DagshubDataType): | ||
backing_field_type = MetadataFieldType.FLOAT | ||
|
||
|
||
class Bool(DagshubDataType): | ||
backing_field_type = MetadataFieldType.BOOLEAN | ||
|
||
|
||
class LabelStudioAnnotation(DagshubDataType): | ||
backing_field_type = MetadataFieldType.BLOB | ||
custom_tags = [ReservedTags.ANNOTATION.value] | ||
|
||
|
||
class Voxel51Annotation(DagshubDataType): | ||
backing_field_type = MetadataFieldType.BLOB | ||
custom_tags = [ReservedTags.ANNOTATION.value] |
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.