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
| Name | Type | Description |
|---|---|---|
| domain | str | URL of data science API |
| client_id | str | azure authentication - client id |
| client_secret | str | azure authentication - your client secret API key |
| scope | str | azure authentication - scope |
| tenant_id | str | azure authentication - tenant |
| protocol | str | default - https |
| username | str | azure authentication - deprecated - username |
| password | str | azure authentication - deprecated - password |
Methods
abort()
send an abort request for executions and return a result message
| Name | Type | Default | Description |
|---|---|---|---|
| executions | list | must 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.
| Name | Type | Default | Description |
|---|---|---|---|
| key | str | pipeline key. |
return: image id.
create()
create and save an object on the server
| Name | Type | Default | Description |
|---|---|---|---|
| obj | object 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.
| Name | Type | Default | Description |
|---|---|---|---|
| component | SolutionComponent |
delete()
delete an object on the server
| Name | Type | Default | Description |
|---|---|---|---|
| obj | object to delete including all content |
delete_component()
delete component
| Name | Type | Default | Description |
|---|---|---|---|
| component_id | UUID |
download_image()
download a pipeline image from the repository
| Name | Type | Default | Description |
|---|---|---|---|
| pipeline_image_id | str | id 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)"
| Name | Type | Default | Description |
|---|---|---|---|
| pipeline | pipeline identified by its id (uuid or wizata_dsapi.Pipeline) or key (str) . | ||
| experiment | None | existing experiment identified by its id (uuid or wizata_dsapi.Experiment) or key (str). | |
| twin | None | twin identified by its id (uuid or wizata_dsapi.Twin) or hardware ID (str)(optional). | |
| image | str | None | pipeline image id to use. |
| properties | dict | None | dictionary containing override for variables or additional parameters for your script. |
| train | bool | True | train machine learning model on model steps. |
| plot | bool | True | if False plot steps are ignored. |
| write | bool | False | if 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 )
| Name | Type | Default | Description |
|---|---|---|---|
| obj | None | a wizata_dsapi.() with UUID set - fetch using technical UUID | |
| id | UUID | None | a UUID of a specific object (use in combination of entity) |
| key | str | None | a logical key of a specific object (e.g. hardware id for DataPoint and Twin (use in combination of entity) |
| entity | None | plural name of the entity or class (use in combination of entity)(e.g. scripts, plots, mlmodels, dataframes...) | |
| script_name | None | ||
| experiment_key | None | ||
| pipeline_key | None | ||
| model_key | None | ||
| template_key | None | ||
| twin_hardware_id | None | ||
| datapoint_hardware_id | None |
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
| Name | Type | Default | Description |
|---|---|---|---|
| label_id | UUID | None | filter on a specific label |
| twin_id | UUID | None | filter on a specific twin |
| template_id | UUID | None | filter on a specific template |
| owner_id | UUID | None | filter on a specific owner_id |
| organization_only | bool | False | work only with organization components (by default - False) |
| name | str | None | filter on a specific name (contains) |
get_datapoint_mappings()
get datapoint mapping from a registration.
| Name | Type | Default | Description |
|---|---|---|---|
| registration |
get_registrations()
retrieve all registrations for
| Name | Type | Default | Description |
|---|---|---|---|
| template | template object, UUID or str key. |
return: list of twin registration.
get_ts_query()
Get a Query string to Timeseries Database.
| Name | Type | Default | Description |
|---|---|---|---|
| datapoints | list | None | list of datapoints to fetch. |
| start | datetime | None | start datetime of range to fetch |
| end | datetime | None | end datetime of range to fetch |
| interval | int | None | interval in milliseconds. |
| agg_method | str | mean | |
| template | str | None | template to fetch. |
| twin | str | None | hardware ID of twin to fetch based on template. |
| null | str | None | By default at 'drop' and dropping NaN values. If not intended behavior please set it to 'ignore' or 'all'. |
| filters | dict | None | dict of filters. |
| options | dict | None | dict 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.
| Name | Type | Default | Description |
|---|---|---|---|
| entity | plural 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.
| Name | Type | Default | Description |
|---|---|---|---|
| pipeline_id | UUID or str UUID of a pipeline. | ||
| twin_ids | list | list of UUID or str UUID of asset registered on the pipeline. | |
| properties | dict | None | optional properties of a pipeline (serializable as JSON). |
return: list of executions IDs ("ids" key)
plot()
Fetch and show plot.
| Name | Type | Default | Description |
|---|---|---|---|
| plot_id | str | None | Plot Id |
| plot | Plot | None | Wizata Plot Object |
| figure | None | JSON Figure |
return: plotly figure
plots()
get all plot for an execution.
| Name | Type | Default | Description |
|---|---|---|---|
| execution | id or Execution. |
return: list of plots.
query()
Query a dataframe from API.
| Name | Type | Default | Description |
|---|---|---|---|
| datapoints | list | None | list of datapoints to fetch. |
| start | datetime | None | start datetime of range to fetch |
| end | datetime | None | end datetime of range to fetch |
| interval | int | None | interval in milliseconds. |
| agg_method | str | mean | |
| template | str | None | template to fetch. |
| twin | str | None | hardware ID of twin to fetch based on template. |
| null | str | None | By default at 'drop' and dropping NaN values. If not intended behavior please set it to 'ignore' or 'all'. |
| filters | dict | None | dict of filters. |
| options | dict | None | dict of options. |
| group | dict | None | can be use to set group system and event retrieving instructions. |
| field | str | None | by default 'value' if none, can be used to retrieve 'eventId' |
| bucket | str | None |
return: dataframe
register_model()
Register a Machine Learning model to Wizata.
Model is tested by the API against a sample dataframe.
| Name | Type | Default | Description |
|---|---|---|---|
| model_key | logical string id to identify the model. | ||
| train_model | trained model (must be compatible with pickle library) | ||
| df | DataFrame | sample dataframe. | |
| scaler | None | scaler (must be compatible with pickle library) | |
| has_anomalies | bool | False | True is model generate Anomalies |
| has_target_feat | bool | False | True if model need a target feature to be selected |
| experiment_key | None | Reference 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.
| Name | Type | Default | Description |
|---|---|---|---|
| template | template object, UUID or str key. | ||
| twin | twin object, UUID or str key. | ||
| properties | dict | dict where key = template property and value = datapoint name or const value (str, int, float, relative or epoch datetime). | |
| override | True | by 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.
| Name | Type | Default | Description |
|---|---|---|---|
| pipeline | pipeline identified by its id (uuid or wizata_dsapi.Pipeline) or key (str). | ||
| twin | None | twin identified by its id (uuid or wizata_dsapi.Twin) or hardware ID (str). | |
| properties | dict | None | dictionary containing override for variables or additional parameters for your script. |
| image | str | None | pipeline image id to use. |
| train | bool | False | train machine learning model on model steps. |
| plot | bool | False | if False plot steps are ignored. |
| write | bool | True | if False write steps are ignored. |
search_datapoints()
get datapoints with a paged query.
| Name | Type | Default | Description |
|---|---|---|---|
| page | int | 1 | numero of the page - default 1. |
| size | int | 20 | quantity per page - default 20 max 100. |
| sort | str | id | column to sort results - default id. |
| direction | str | asc | sorting direction by default asc, accept also desc. |
| hardware_id | str | None | filter on a specific hardware ID name or partial name. |
| categories | list | None | list of UUID or Category. |
| business_types | list | None | list of BusinessType or str. |
| twin | None | uuid or Twin element to search datapoints. | |
| recursive | bool | False | set 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.
| Name | Type | Default | Description |
|---|---|---|---|
| page | int | 1 | numero of the page - default 1. |
| size | int | 20 | quantity per page - default 20 max 100. |
| sort | str | id | column to sort results - default id. |
| direction | str | asc | sorting direction by default asc, accept also desc. |
| pipeline_id | UUID | None | filter on a specific pipeline. |
| twin_id | UUID | None | filter on a specific twin. |
| template_id | UUID | None | filter on a specific template. |
| status | ExecutionStatus | None | filter 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.
| Name | Type | Default | Description |
|---|---|---|---|
| page | int | 1 | numero of the page - default 1. |
| size | int | 20 | quantity per page - default 20 max 100. |
| sort | str | id | column to sort results - default id. |
| direction | str | asc | sorting direction by default asc, accept also desc. |
| datapoint_id | str | None | id of the datapoint on which filtering the insights. |
| twin_id | str | None | id of the twin on which filtering the insights. |
| component_id | list | None | id 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_twins()
get twins with a paged query.
| Name | Type | Default | Description |
|---|---|---|---|
| page | int | 1 | numero of the page - default 1. |
| size | int | 20 | quantity per page - default 20 max 100. |
| sort | str | id | column to sort results - default id. |
| direction | str | asc | sorting direction by default asc, accept also desc. |
| hardware_id | str | None | filter on a specific hardware ID name or partial name. |
| name | str | None | name or part of twin name. |
| parents | list | None | list 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
| Name | Type | Default | Description |
|---|---|---|---|
| message | str | ||
| recipients | list | ||
| alert_type | AlertType | AlertType.SMS | |
| subject | str | ||
| cc | list | None |
unregister_twin()
un-register a twin from a specific template.
| Name | Type | Default | Description |
|---|---|---|---|
| template | template object, UUID or str key. | ||
| twin | twin object, UUID or str key. |
update()
update and save an object on DS API
| Name | Type | Default | Description |
|---|---|---|---|
| obj | object to update on DS API (see info()) or python callable function (Script) |
update_component()
update a component based on its ID.
| Name | Type | Default | Description |
|---|---|---|---|
| component | SolutionComponent |
upsert()
upsert on object on the server
work with Script, MLModel or directly a function name
| Name | Type | Default | Description |
|---|---|---|---|
| obj | object to upsert on the server |
return: ID of the object created or updated
upsert_datapoint()
Upsert a datapoint (ignore ID, use the key)
| Name | Type | Default | Description |
|---|---|---|---|
| datapoint | DataPoint |
return: upsert datapoint.
upsert_experiment()
Upsert an experiment.
| Name | Type | Default | Description |
|---|---|---|---|
| key | str | unique key identifying the experiment. | |
| name | str | display name of the experiment. | |
| pipeline | None | pipeline to set at creation only - cannot be updated. | |
| twin | None | twin uuid, hardware id or twin. |
return: upserted experiment.
upsert_pipeline()
Upsert a template (ignore ID, use the key)
| Name | Type | Default | Description |
|---|---|---|---|
| pipeline | Pipeline |
return: upserted template.
upsert_template()
Upsert a template.
| Name | Type | Default | Description |
|---|---|---|---|
| key | str | unique key identifying the template. | |
| name | str | display name of the template |
return: upserted template.
upsert_twin()
Upsert a twin (ignore ID, use the key)
| Name | Type | Default | Description |
|---|---|---|---|
| twin | Twin |
return: upsert twin.