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.

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_image()

download a pipeline image from the repository

NameTypeDefaultDescription
pipeline_image_idstrid of image

return: packaged (unzipped) as a PipelineImage

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.

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.() 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.

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.

return: dataframe

register_model()

Register a Machine Learning model to Wizata.

Model is tested by the API against a sample dataframe.

NameTypeDefaultDescription
model_keylogical string id to identify the model.
train_modeltrained model (must be compatible with pickle library)
dfDataFramesample dataframe.
scalerNonescaler (must be compatible with pickle library)
has_anomaliesboolFalseTrue is model generate Anomalies
has_target_featboolFalseTrue if model need a target feature to be selected
experiment_keyNoneReference of an experiment to which link the generated ML Model

return: registered ML Model , pandas.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.

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_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 - supported only in context and by SMS.

NameTypeDefaultDescription
messagestr
recipientslist

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

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.

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.