Skip to content

Conversation

@paulnoirel
Copy link
Contributor

@paulnoirel paulnoirel commented Apr 27, 2022

This is the implementation of https://labelbox.atlassian.net/browse/AL-2183 to create, retrieve and update media types for projects.
To highlight that MediaType is generic and not specific to projects, the enumeration was relocated to its own file media_type.py.

Terminology

We use the terminology MediaType and media_type to match the GraphQL type and make it easier to use compared to allowedMediaType found in the Project table.

Implementation of the MediaType enumeration

The names in the MediaType enumeration use title case. This matches the convention of the existing QueueMode enumeration in the Project class. With that said, the enumeration also supports upper case names for compatibility with the GraphQL type.
To support the case when media_type is not set for the project, if MediaType is called for None then it returns MediaType.Unknown.

In order to match the UI, a few aliases were added compared to the GraphQL MediaType type:

Type GraphQL Alias
PDF Document
TMS_SIMPLE Simple_Tile
TMS_GEO Geospatial_Tile

Otherwise, the enumeration matches the GraphQL type (including Unsupported for future usage).

Case of MediaType.Unknown

Although the member MediaType.UNKOWN exists in GraphQL, it is not a supported value. Since using it would lead to a HTTP 500 (internal server error) error, this value is filtered for both client.create_project() and Project.update().

Side modification

The file labelbox/orm/db_object.py is slightly modified to support the case where data_type is not set (aka value is None).

Copy link
Contributor

@jtsodapop jtsodapop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, minor nits

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@paulnoirel paulnoirel added the enhancement New feature or request label May 2, 2022
@paulnoirel paulnoirel requested a review from msokoloff1 May 3, 2022 14:41
@paulnoirel paulnoirel merged commit 8f4a839 into develop May 3, 2022
@paulnoirel paulnoirel deleted the pn/al-2183 branch May 3, 2022 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants