AnnotationService
from skipcheck_tm1.services import AnnotationServiceAnnotations: 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 Annotationslists none, even with annotations made. They're found by cube (cube_annotations), by cell (cell_annotations), or by ID.- An annotation's
ApplicationContextreads back empty, though the facet value given when it was made exists (facet_values). - Besides
Text, an annotation carries properties$metadatadoesn't declare (Annotationis an open type):objectName(the cube),commentValue,commentTypeandcommentLocation(the cell's elements, comma-separated). They're indynamicProperties. - 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
list | GET Annotations. |
get | GET Annotations('id'); a Tm1NotFoundError if there's none. |
create | POST Annotations. |
update | PATCH Annotations('id'). |
delete | DELETE Annotations('id'). |
application_context | ApplicationContext; expand Facet. |
dimensional_context | The members of the annotated cell. |
attachments | Documents attached to the annotation. |
cube_annotations | A cube's annotations. |
cell_annotations | One cellset cell's annotations. |
facets | GET ApplicationContextFacets, such as }Cubes; expand Values. |
facet_values | A facet's Values. |
facet | A facet value's Facet. |
delete_annotation_artifacts | Removes 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) -> AnnotationGET 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) -> AnnotationPOST 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) -> NonePATCH 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) -> NoneDELETE 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) -> ApplicationContextFacetA facet value's Facet.
TM1 REST Navigation ApplicationContextFacetValue/Facet
delete_annotation_artifacts
delete_annotation_artifacts() -> NoneDeleteAnnotationArtifacts: removes every annotation in the model, with their facet values, attachments and control cubes. It can't be undone.
TM1 REST ActionImport DeleteAnnotationArtifacts