Predefined annotation event on Perspective Power Chart

I’m looking to use the Power Chart component to replace a paper chart recorder. The end user wants to press a button and have the chart annotated with predefined text (i.e. “collection step started”, “elution step complete”, etc.) and the name of the logged in user. My plan was to have a memory array with the predefined text and paste it along with the credentials of the active user through an actionPerformed script on a button.

The problem: I don’t know how to create the annotation via scripting. Is this possible?

system.tag.storeAnnotations - it’s not yet in the user manual (oops) but autocomplete in the software should get you started on using it.

1 Like

:scream:

image

If it had not been for this post, I wouldn’t have noticed that is not only all system.tag.*Annotations are nowhere to be found in the user manual, but also the documentation is missing within the Designer for the following functions:

system.tag.deleteAnnotations has no docstring.
system.tag.queryAnnotations docstring is missing the description for types

Maybe in 8.1.2 they’ll be available?

This Button script stored an annotation for anyone working their way through this;

"""
system.tag.storeAnnotations(paths, startTimes, endTimes, types, data, storageId, deleted )
"""

from datetime import datetime

endTime = system.date.now()
startTime = system.date.addSeconds(endTime, -0)
tagpath = 'histprov:Postgres:/drv:cardiff:default:/tag:sterilization/vtis/mainstep'

results = system.tag.storeAnnotations( paths = [tagpath], startTimes = [startTime], endTimes= [endTime],data= ['Step Number Test'] )

system.perspective.print(message=results)
1 Like

Thanks! This is exactly what I need!

Very helpful. Thanks for sharing!

@PGriffith Could you expand on the “type” argument for system.tag.storeAnnotations? The function descriptions states that it defaults to “marker” if not specified but the “sqlth_annotations” description says that the only type is “note.” What are the options available?

Also, is it possible to edit/move the annotations so that they don’t sit atop each other? I’m hoping to use the Print To PDF functionality, but three of my four annotations won’t be visible.

1 Like

The type should be one of four literal strings that are currently understood by the power chart for representation:

    /** A user stored note. **/
    "note"
    /** A date range that indicates a special area **/
    "range"
    /** A point in time marker **/
    "marker"
    /** A single point or date range that indicates an X-trace **/
    "trace"