API Reference

WizataDSAPIClient

client wrapper to cloud data science API

accessible preferably through wizata_dsapi.api() using os variables, you can also create an instance using init() please contact your administrator to receive configuration and connection details

Attributes

NameTypeDescription
domainstrURL of data science API
client_idstrazure authentication - client id
client_secretstrazure authentication - your client secret API key
scopestrazure authentication - scope
tenant_idstrazure authentication - tenant
protocolstrdefault - https
usernamestrazure authentication - deprecated - username
passwordstrazure authentication - deprecated - password

Methods

abort()

send an abort request for executions and return a result message

NameTypeDefaultDescription
executionslistmust be a list containing uuid or Execution.

access_check()

call the who am I request, to read proper headers and get specific information.

return: roles, twins

authenticate()

perform authentication on client side

build_image()

build an image of a pipeline, store it on the image repository and return its pipeline image id.

NameTypeDefaultDescription
keystrpipeline key.
return: image id.

create()

create and save an object on the server

NameTypeDefaultDescription
objobject from any supported entity (see info()) or python callable function (Script)
return: id of created object

create_component()

create a component based on its ID.

NameTypeDefaultDescription
componentSolutionComponent

delete()

delete an object on the server

NameTypeDefaultDescription
objobject to delete including all content

delete_component()

delete component

NameTypeDefaultDescription
component_idUUID

download_file()

download a model extra file from the repository.

NameTypeDefaultDescription
modelModelInfoNonemodel (ModelInfo), alternatively can use identifier
fileModelFileNonefile (ModelFile), alternatively can use path
identifierstrNoneidentifier including alias of the model.
pathstrNonepath name of the file including the extension.
return: bytes content.

download_image()

download a pipeline image from the repository

NameTypeDefaultDescription
pipeline_image_idstrid of image
return: packaged (unzipped) as a PipelineImage

download_model()

download a model image directly from the repository, auto-select alias if necessary.

NameTypeDefaultDescription
identifierstrexact identifier including alias of the model or no alias to auto-select active version.
return: ModelInfo with trained_model loaded, extra file must be downloaded separately.

experiment()

experiment and train models with a pipeline.

  • existing experiment is required (use create or upsert_experiment(key, name)).

  • if your pipeline is templated please provide a twin.

  • please provide all variables and parameters required through properties.

  • return an execution

  • check status with "wizata_dsapi.api().get(execution).status"

  • see plots with "wizata_dsapi.api().plots(execution)"

NameTypeDefaultDescription
pipelinepipeline identified by its id (uuid or wizata_dsapi.Pipeline) or key (str) .
experimentNoneexisting experiment identified by its id (uuid or wizata_dsapi.Experiment) or key (str).
twinNonetwin identified by its id (uuid or wizata_dsapi.Twin) or hardware ID (str)(optional).
imagestrNonepipeline image id to use.
propertiesdictNonedictionary containing override for variables or additional parameters for your script.
trainboolTruetrain machine learning model on model steps.
plotboolTrueif False plot steps are ignored.
writeboolFalseif False write steps are ignored.
versionstrNone

get()

get record content from DS API.

  • get will look first for obj then for id then for key (e.g. if id and key specified, key is ignored )
NameTypeDefaultDescription
objNonea wizata_dsapi.<Entity>() with UUID set - fetch using technical UUID
idUUIDNonea UUID of a specific object (use in combination of entity)
keystrNonea logical key of a specific object (e.g. hardware id for DataPoint and Twin (use in combination of entity)
entityNoneplural name of the entity or class (use in combination of entity)(e.g. scripts, plots, mlmodels, dataframes...)
script_nameNone
experiment_keyNone
pipeline_keyNone
model_keyNone
template_keyNone
twin_hardware_idNone
datapoint_hardware_idNone
return: object with all properties or None if not found.

get_business_labels()

get a name / uuid dictionary with all business labels in platform.

get_categories()

get a name / uuid dictionary with all categories in platform.

get_components()

get components

NameTypeDefaultDescription
label_idUUIDNonefilter on a specific label
twin_idUUIDNonefilter on a specific twin
template_idUUIDNonefilter on a specific template
owner_idUUIDNonefilter on a specific owner_id
organization_onlyboolFalsework only with organization components (by default - False)
namestrNonefilter on a specific name (contains)

get_datapoint_mappings()

get datapoint mapping from a registration.

NameTypeDefaultDescription
registration

get_registrations()

retrieve all registrations for

NameTypeDefaultDescription
templatetemplate object, UUID or str key.
return: list of twin registration.

get_ts_query()

Get a Query string to Timeseries Database.

NameTypeDefaultDescription
datapointslistNonelist of datapoints to fetch.
startdatetimeNonestart datetime of range to fetch
enddatetimeNoneend datetime of range to fetch
intervalintNoneinterval in milliseconds.
agg_methodstrmean
templatestrNonetemplate to fetch.
twinstrNonehardware ID of twin to fetch based on template.
nullstrNoneBy default at 'drop' and dropping NaN values. If not intended behavior please set it to 'ignore' or 'all'.
filtersdictNonedict of filters.
optionsdictNonedict of options.
return: dataframe

get_units()

get a name / uuid dictionary with all units in platform.

info()

print insights regarding version and supported operations

lists()

lists all elements of a specific entity.

NameTypeDefaultDescription
entityplural name of the entity or class (e.g. scripts, plots, mlmodels, dataframes...)
return: list of all elements with at least the id property.

load_model()

load a model pickle or torch from the repository ready to be used.

NameTypeDefaultDescription
modelModelInfo to load
return: ModelInfo with the trained model.

multi_run()

run a pipeline against one or multiple twin in production.

NameTypeDefaultDescription
pipeline_idUUID or str UUID of a pipeline.
twin_idslistlist of UUID or str UUID of asset registered on the pipeline.
propertiesdictNoneoptional properties of a pipeline (serializable as JSON).
return: list of executions IDs ("ids" key)

plot()

Fetch and show plot.

NameTypeDefaultDescription
plot_idstrNonePlot Id
plotPlotNoneWizata Plot Object
figureNoneJSON Figure
return: plotly figure

plots()

get all plot for an execution.

NameTypeDefaultDescription
executionid or Execution.
return: list of plots.

query()

Query a dataframe from API.

NameTypeDefaultDescription
datapointslistNonelist of datapoints to fetch.
startdatetimeNonestart datetime of range to fetch
enddatetimeNoneend datetime of range to fetch
intervalintNoneinterval in milliseconds.
agg_methodstrmean
templatestrNonetemplate to fetch.
twinstrNonehardware ID of twin to fetch based on template.
nullstrNoneBy default at 'drop' and dropping NaN values. If not intended behavior please set it to 'ignore' or 'all'.
filtersdictNonedict of filters.
optionsdictNonedict of options.
groupNonecan be use to set group system and event retrieving instructions (dict or list[dict]).
fieldNoneby default 'value' if none, accept str or list (e.g. value, reliability, eventId, ...)
bucketstrNonespecify on which bucket the query applies.
tagsdictNone
return: dataframe

register_twin()

register a twin on a specific template using a map.

NameTypeDefaultDescription
templatetemplate object, UUID or str key.
twintwin object, UUID or str key.
propertiesdictdict where key = template property and value = datapoint name or const value (str, int, float, relative or epoch datetime).
overrideTrueby default at True - allow overriding any existing subscription

run()

run a pipeline.

  • existing models are used for simulation and prediction.

  • caution this might affect data inside platform or trigger automation.

  • if your pipeline is templated please provide a twin.

  • please provide all variables and parameters required through properties.

  • return an execution

  • check status with "wizata_dsapi.api().get(execution).status"

  • check results in platform (dashboard/explorer) or perform queries.

NameTypeDefaultDescription
pipelinepipeline identified by its id (uuid or wizata_dsapi.Pipeline) or key (str).
twinNonetwin identified by its id (uuid or wizata_dsapi.Twin) or hardware ID (str).
propertiesdictNonedictionary containing override for variables or additional parameters for your script.
imagestrNonepipeline image id to use.
trainboolFalsetrain machine learning model on model steps.
plotboolFalseif False plot steps are ignored.
writeboolTrueif False write steps are ignored.
versionstrNoneversion of python environment to use if different than local environment.

search_datapoints()

get datapoints with a paged query.

NameTypeDefaultDescription
pageint1numero of the page - default 1.
sizeint20quantity per page - default 20 max 100.
sortstridcolumn to sort results - default id.
directionstrascsorting direction by default asc, accept also desc.
hardware_idstrNonefilter on a specific hardware ID name or partial name.
categorieslistNonelist of UUID or Category.
business_typeslistNonelist of BusinessType or str.
twinNoneuuid or Twin element to search datapoints.
recursiveboolFalseset to True in combination of a twin to look inside all sub-twins recursively.
return: PagedQueryResults, check total for number of potential results and results for the list of entity.

search_executions()

get executions with a paged query.

NameTypeDefaultDescription
pageint1numero of the page - default 1.
sizeint20quantity per page - default 20 max 100.
sortstridcolumn to sort results - default id.
directionstrascsorting direction by default asc, accept also desc.
pipeline_idUUIDNonefilter on a specific pipeline.
twin_idUUIDNonefilter on a specific twin.
template_idUUIDNonefilter on a specific template.
statusExecutionStatusNonefilter on a specific status.
return: PagedQueryResults, check total for number of potential results and results for the list of entity.

search_insights()

get insights with a paged query.

NameTypeDefaultDescription
pageint1numero of the page - default 1.
sizeint20quantity per page - default 20 max 100.
sortstridcolumn to sort results - default id.
directionstrascsorting direction by default asc, accept also desc.
datapoint_idstrNoneid of the datapoint on which filtering the insights.
twin_idstrNoneid of the twin on which filtering the insights.
component_idlistNoneid of the component on which filtering the insights.
return: PagedQueryResults, check total for number of potential results and results for the list of entity.

search_models()

get all information related to models stored on Wizata.

return: ModelList structure model list

search_twins()

get twins with a paged query.

NameTypeDefaultDescription
pageint1numero of the page - default 1.
sizeint20quantity per page - default 20 max 100.
sortstridcolumn to sort results - default id.
directionstrascsorting direction by default asc, accept also desc.
hardware_idstrNonefilter on a specific hardware ID name or partial name.
namestrNonename or part of twin name.
parentslistNonelist of all possible parents (Twin, UUID, or str UUID).
return: PagedQueryResults, check total for number of potential results and results for the list of entity.

send_alerts()

send alerts through backend

NameTypeDefaultDescription
messagestr
recipientslist
alert_typeAlertTypeAlertType.SMS
subjectstr
cclistNone

unregister_twin()

un-register a twin from a specific template.

NameTypeDefaultDescription
templatetemplate object, UUID or str key.
twintwin object, UUID or str key.

update()

update and save an object on DS API

NameTypeDefaultDescription
objobject to update on DS API (see info()) or python callable function (Script)

update_component()

update a component based on its ID.

NameTypeDefaultDescription
componentSolutionComponent

upload_file()

upload a model extra file to the repository.

please use upload_model for a trained_model

NameTypeDefaultDescription
contentthe bytes content of the file.
modelModelInfoNonemodel (ModelInfo), alternatively can use identifier
fileModelFileNonefile (ModelFile), alternatively can use path
identifierstrNoneidentifier including alias of the model.
pathstrNonepath name of the file including the extension.
return: bytes content.

upload_model()

upload a model within the model repository.

  • by default use model_info.trained_model and convert it to a pickle

  • for already torch or pickle please pass the bytes_content

  • model_info.file_format must be set properly to 'pkl' or 'pt'

NameTypeDefaultDescription
model_infoModelInfomodel info, with at least key (+twin, +property, +alias) and trained_model.
bytes_contentNonebytes[] of your torch or pickle model.

upsert()

upsert on object on the server

work with Script, MLModel or directly a function name

NameTypeDefaultDescription
objobject to upsert on the server
return: ID of the object created or updated

upsert_datapoint()

Upsert a datapoint (ignore ID, use the key)

NameTypeDefaultDescription
datapointDataPoint
return: upsert datapoint.

upsert_experiment()

Upsert an experiment.

NameTypeDefaultDescription
keystrunique key identifying the experiment.
namestrdisplay name of the experiment.
pipelineNonepipeline to set at creation only - cannot be updated.
twinNonetwin uuid, hardware id or twin.
return: upserted experiment.

upsert_pipeline()

Upsert a template (ignore ID, use the key)

NameTypeDefaultDescription
pipelinePipeline
return: upserted template.

upsert_template()

Upsert a template.

NameTypeDefaultDescription
keystrunique key identifying the template.
namestrdisplay name of the template
return: upserted template.

upsert_twin()

Upsert a twin (ignore ID, use the key)

NameTypeDefaultDescription
twinTwin
return: upsert twin.

who_am_i()

decrypt current JWT token used to get information about current user.

return: