cubes icon indicating copy to clipboard operation
cubes copied to clipboard

Separate user-oriented metadata

Open Stiivi opened this issue 8 years ago • 0 comments

Separate all user-oriented metadata from ModelObject into MetadataObjectDescription or MetadataObjectInfo.

Note: It is Metadata* not Model* because it will describe non-logical objects as well in the future.

Reasons for the change:

  • more straightforward localization
  • simpler cloning of objects
  • better maintainability of the code
  • aligned with future metadata repository plans
  • easier to have immutable model objects (#282)

Attributes to be extracted into "info/description" structure:

  • name: str – name of the metadata object this description describes. Same as ModelObject.name
  • label: str – human-readable object name, should default to name
  • description: Optional[str] – human readable object description
  • tags: List[str] – list of tags that can be used for metadata discovery
  • extra: JSONType – currently called info
  • locale: Optional[str] – name of the locale the description is written in

Requirements

  • The information in the MetadataObjectDescription should not affect the query execution
  • Server should not be impacted – we would combine metadata object and it's description structure together when exporting
  • JSON model should not be impacted - we would separate the description metadata into it's own structure upon creation

Storage and retrieval

There are two possibilities how we are going to store/retrieve the description: from a common catalog of metadata (currently the best place is Workspace, in the future it will be metadata repository) or from within the object graph (would be good temporary solution, to keep it easier).

Currently:

dimension: Dimension
label = dimension.label

# Localized:
context = LocalizationContext(..., locale="sk")
translation = context.object_localization("dimensions", dimension.name)
dimension = dimension.localized(translation)
label = dimension.label

Proposed temporary:

dimension: Dimension
label = dimension.description.label

Proposed metadata repository:

dimension: Dimension
mdr: MetadataRepository
label = mdr.description(dimension).label

# Localized:
label = mdr.description(dimension, locale="sk").label

EDIT: Changed the name of the metadata description object to MetadataObjectDescription/*Info (undecided). Added more detailed description of desired attributes. Added requirements.

Stiivi avatar Mar 10 '17 18:03 Stiivi