Skip to content

Commit 0816f4c

Browse files
committed
Sean comments
1 parent 6bb34a0 commit 0816f4c

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

docs/entities/kpis.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
KPIs are user defined calculated fields in the Sight Machine software.
44

55
## Functions
6-
The SDK has three functions related to KPIs. The first returns a list of all availible KPis. The second of which allows a user to see which KPIs are availible for a particular asset. The thrid makes use of our Data Visulation api which allows a user to see these KPIs over a timeframe.
6+
The SDK has three functions related to KPIs. The first returns a list of all availible KPis. The second of which allows a user to see which KPIs are availible for a particular asset. The third makes use of our Data Visualization api which allows a user to see these KPIs over a timeframe.
77

88
### Get KPIs
9-
This is the first KPI function allowing you to see which all KPIs. In order to call this function you must first have a logged in client see the [quick start guide](/README.md) for more information on logging in. Once you have a logged in client you can call the function as follows:
9+
This is the first KPI function allowing you to see all KPIs availible to you. In order to call this function you must first have a logged in client see the [quick start guide](/README.md) for more information on logging in. Once you have a logged in client you can call the function as follows:
1010

1111
```
1212
cli.get_kpis()
@@ -46,8 +46,8 @@ After some time the SDK should return a list that looks something like this:
4646

4747
There's two ways to call this function you can use a data_viz_query,For more information on [data_viz_queries](/docs/commonly_used_data_types/data_viz_query.md) click on the previous link, or have the function fill out the query for you by passing in a few variable we will now go over one at a time.
4848

49-
#### machine_source
50-
This is a string and is the name of machine you wish to run a query on.
49+
#### machine_sources
50+
This is a list of strings and is the name of machine(s) you wish to run a query on.
5151

5252
#### kpis
5353
This is a list of the names of all the kpis you wish to run this query on.

smsdk/client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,15 @@ def get_kpis_for_asset(self, **kwargs):
240240
)
241241
return kpis(self.session, base_url).get_kpis_for_asset(**kwargs)
242242

243-
def get_kpi_data_viz(self, machine_source=None, kpis=None, i_vars=None, time_selection=None, **kwargs):
243+
def get_kpi_data_viz(self, machine_sources=None, kpis=None, i_vars=None, time_selection=None, **kwargs):
244244
kpi_entity = smsdkentities.get('kpi')
245-
if machine_source:
246-
machine_type = self.get_type_from_machine(machine_source, **kwargs)
245+
if machine_sources:
246+
machine_types = []
247+
for machine_source in machine_sources:
248+
machine_types.append(self.get_type_from_machine(machine_source, **kwargs))
247249
kwargs["asset_selection"]= {
248-
"machine_source": [machine_source],
249-
"machine_type": [machine_type]
250+
"machine_source": machine_sources,
251+
"machine_type": list(set(machine_types))
250252
}
251253

252254
if kpis:

0 commit comments

Comments
 (0)