skipcheck

TM1 client · Docs · More services

AnnotationService

from skipcheck_tm1.services import AnnotationService

Annotations: comments on cube cells, as Planning Analytics Workspace makes them, and the application context facets that tie them to cubes.

What TM1 (11.8) does here that you might not expect:

  • GET Annotations lists none, even with annotations made. They're found by cube (cube_annotations), by cell (cell_annotations), or by ID.
  • An annotation's ApplicationContext reads back empty, though the facet value given when it was made exists (facet_values).
  • Besides Text, an annotation carries properties $metadata doesn't declare (Annotation is an open type): objectName (the cube), commentValue, commentType and commentLocation (the cell's elements, comma-separated). They're in dynamicProperties.
  • IDs look like C}ClientGroups~B.B~7uA_4TxLwG.

Comment on a cell:

# A comment on one cell, as Planning Analytics Workspace makes it: the cell's
# elements by dimension, in the cube's dimension order
cell = {"Version": "Forecast", "Region": "North", "Measure": "Amount"}
return tm1.annotations.create("Sales", cell, "Includes the March promotion")

Read a cube's comments:

# GET Annotations lists none on TM1 11.8, so read them by cube
return [f"{annotation.creator}: {annotation.text}" for annotation in tm1.annotations.cube_annotations("Sales")]

Change what a comment says:

# TM1 keeps Text and the commentValue PAW shows apart, so change both
text = "Includes the March and April promotions"
tm1.annotations.update(id, AnnotationPatch.builder().text(text).property("commentValue", text).build())

The asyncio flavor, skipcheck_tm1.aio, has the same methods to await, on AsyncAnnotationService.

Members

listGET Annotations.
getGET Annotations('id'); a Tm1NotFoundError if there's none.
createPOST Annotations.
updatePATCH Annotations('id').
deleteDELETE Annotations('id').
application_contextApplicationContext; expand Facet.
dimensional_contextThe members of the annotated cell.
attachmentsDocuments attached to the annotation.
cube_annotationsA cube's annotations.
cell_annotationsOne cellset cell's annotations.
facetsGET ApplicationContextFacets, such as }Cubes; expand Values.
facet_valuesA facet's Values.
facetA facet value's Facet.
delete_annotation_artifactsRemoves every annotation in the model, with their facet values, attachments and control cubes.

list

list(query: ODataQuery | None = None, **options: Any) -> list[Annotation]

GET Annotations. TM1 (11.8) lists none here: use cube_annotations or cell_annotations.

TM1 REST EntitySet Annotations

get

get(id: str, query: ODataQuery | None = None, **options: Any) -> Annotation

GET Annotations('id'); a Tm1NotFoundError if there's none.

TM1 REST EntitySet Annotations

create

create(cube: Any = None, elements: Mapping[str, str] | None = None, text: str | None = None, annotation: Any = None) -> Annotation

POST Annotations. Either annotates one cell the way Planning Analytics Workspace does (create(cube, elements, text): Text and commentValue are the text, the }Cubes facet names the cube, and the dimensional context binds the cell's members, elements mapping each dimension, in the cube's order, to the cell's element in its same-named hierarchy), or posts an annotation built by hand (create(annotation), an AnnotationPatch). Returns the annotation, with its ID.

TM1 REST EntitySet Annotations

update

update(id: str, patch: Any) -> None

PATCH Annotations('id'). To change what it says, set both Text and the commentValue property: TM1 keeps them apart. TM1 records LastUpdatedBy and LastUpdated.

TM1 REST EntitySet Annotations

delete

delete(id: str) -> None

DELETE Annotations('id').

TM1 REST EntitySet Annotations

application_context

application_context(id: str, query: ODataQuery | None = None, **options: Any) -> list[ApplicationContextFacetValue]

ApplicationContext; expand Facet. TM1 (11.8) returns none.

TM1 REST Navigation Annotation/ApplicationContext

dimensional_context

dimensional_context(id: str, query: ODataQuery | None = None, **options: Any) -> list[Member]

DimensionalContext: the members of the annotated cell.

TM1 REST Navigation Annotation/DimensionalContext

attachments

attachments(id: str, query: ODataQuery | None = None, **options: Any) -> list[Attachment]

Attachments: documents attached to the annotation.

TM1 REST Navigation Annotation/Attachments

cube_annotations

cube_annotations(cube: str, query: ODataQuery | None = None, **options: Any) -> list[Annotation]

Cubes('c')/Annotations: a cube's annotations.

TM1 REST Navigation Cube/Annotations

cell_annotations

cell_annotations(cellset: str, ordinal: int, query: ODataQuery | None = None, **options: Any) -> list[Annotation]

Cellsets('id')/Cells(n)/Annotations: one cellset cell's annotations. They also come with the cells by expand="Annotations".

TM1 REST Navigation CellsetCell/Annotations

facets

facets(query: ODataQuery | None = None, **options: Any) -> list[ApplicationContextFacet]

GET ApplicationContextFacets, such as }Cubes; expand Values.

TM1 REST EntitySet ApplicationContextFacets

facet_values

facet_values(facet: str, query: ODataQuery | None = None, **options: Any) -> list[ApplicationContextFacetValue]

A facet's Values: for }Cubes, the cubes with annotations.

TM1 REST Navigation ApplicationContextFacet/Values

facet

facet(facet: str, value: str, query: ODataQuery | None = None, **options: Any) -> ApplicationContextFacet

A facet value's Facet.

TM1 REST Navigation ApplicationContextFacetValue/Facet

delete_annotation_artifacts

delete_annotation_artifacts() -> None

DeleteAnnotationArtifacts: removes every annotation in the model, with their facet values, attachments and control cubes. It can't be undone.

TM1 REST ActionImport DeleteAnnotationArtifacts