Skip to content

Commit

Permalink
Add facility/source example
Browse files Browse the repository at this point in the history
Added some more examples for fetching facility and/or source
  • Loading branch information
nedv98 committed Jan 6, 2025
1 parent e55c460 commit 0367933
Showing 1 changed file with 224 additions and 6 deletions.
230 changes: 224 additions & 6 deletions examples/client_secret_auth.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -38,7 +38,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -58,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -84,9 +84,55 @@
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'data': {'items': [{'id': '1e95b249-5f3f-4b9e-ace1-d6e582897ff0',\n",
" 'name': 'Omnia IIoT write test',\n",
" 'description': 'test patch again 7',\n",
" 'step': False,\n",
" 'unit': None,\n",
" 'standardUnit': None,\n",
" 'assetId': None,\n",
" 'facility': '1190',\n",
" 'externalId': None,\n",
" 'source': 'IMS',\n",
" 'changedTime': '2023-06-29T05:58:52.3600000Z',\n",
" 'createdTime': '2021-04-29T05:12:12.8290000Z'},\n",
" {'id': '96236c02-4ca9-43bc-b8f2-427aa2545811',\n",
" 'name': 'Omnia IIoT write test2',\n",
" 'description': None,\n",
" 'step': False,\n",
" 'unit': None,\n",
" 'standardUnit': None,\n",
" 'assetId': None,\n",
" 'facility': '1131',\n",
" 'externalId': None,\n",
" 'source': 'IMS',\n",
" 'changedTime': '2023-10-05T12:25:26.3650000Z',\n",
" 'createdTime': '2023-10-05T12:25:26.3650000Z'},\n",
" {'id': 'fe8d8cc9-972c-4802-866f-a10e839d2429',\n",
" 'name': 'Omnia IIoT write test2',\n",
" 'description': None,\n",
" 'step': False,\n",
" 'unit': None,\n",
" 'standardUnit': None,\n",
" 'assetId': None,\n",
" 'facility': 'ASGA',\n",
" 'externalId': None,\n",
" 'source': 'IMS',\n",
" 'changedTime': '2023-10-05T08:33:39.0240000Z',\n",
" 'createdTime': '2023-10-05T08:33:39.0240000Z'}]}}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"api.search_timeseries(name=\"*Omnia IIoT write test*\",limit=10)"
]
Expand Down Expand Up @@ -519,6 +565,178 @@
" }]\n",
"}])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Get facilities"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'data': {'items': [{'facility': 'ASGA', 'count': 25964},\n",
" {'facility': 'JSV', 'count': 25020},\n",
" {'facility': 'SFC', 'count': 25001},\n",
" {'facility': 'SFB', 'count': 25000},\n",
" {'facility': 'GKR', 'count': 24632},\n",
" {'facility': 'SFA', 'count': 17480},\n",
" {'facility': 'AHA', 'count': 16355},\n",
" {'facility': 'KVB', 'count': 14029},\n",
" {'facility': 'VAL', 'count': 10746},\n",
" {'facility': 'MAR', 'count': 8780},\n",
" {'facility': 'TROL', 'count': 1227},\n",
" {'facility': 'SLA', 'count': 364},\n",
" {'facility': 'ASGB', 'count': 330},\n",
" {'facility': 'GRA', 'count': 97},\n",
" {'facility': 'GFC', 'count': 58},\n",
" {'facility': 'JCA', 'count': 50},\n",
" {'facility': 'SNA', 'count': 49},\n",
" {'facility': 'KRIS', 'count': 32},\n",
" {'facility': 'TROB', 'count': 31},\n",
" {'facility': 'VIS', 'count': 26},\n",
" {'facility': 'NOR', 'count': 18},\n",
" {'facility': 'TROC', 'count': 17},\n",
" {'facility': 'DRA', 'count': 11},\n",
" {'facility': 'NJA', 'count': 11},\n",
" {'facility': 'SNB', 'count': 10},\n",
" {'facility': 'GFA', 'count': 9},\n",
" {'facility': 'GDR', 'count': 6},\n",
" {'facility': 'KAA', 'count': 6},\n",
" {'facility': 'HD', 'count': 5},\n",
" {'facility': 'TROA', 'count': 5},\n",
" {'facility': 'OSA', 'count': 4},\n",
" {'facility': 'OSC', 'count': 3},\n",
" {'facility': 'PERA', 'count': 3},\n",
" {'facility': 'PERB', 'count': 3},\n",
" {'facility': 'DOW', 'count': 2},\n",
" {'facility': 'MON', 'count': 2},\n",
" {'facility': 'OSE', 'count': 2},\n",
" {'facility': 'BAC', 'count': 1},\n",
" {'facility': 'GFB', 'count': 1},\n",
" {'facility': 'KLAB', 'count': 1},\n",
" {'facility': 'MLA', 'count': 1},\n",
" {'facility': 'OSS', 'count': 1},\n",
" {'facility': 'SNO', 'count': 1},\n",
" {'facility': 'VFR', 'count': 1}]}}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#TEST\n",
"api.get_facilities()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Get sources"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'data': {'items': [{'source': 'IMS', 'count': 195160},\n",
" {'source': 'FUGRO', 'count': 222},\n",
" {'source': 'IOC', 'count': 7},\n",
" {'source': 'INTEGRATIONTESTREADWRITE', 'count': 4},\n",
" {'source': 'NES', 'count': 1},\n",
" {'source': 'PENNTEST', 'count': 1}]}}"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#TEST\n",
"api.get_sources()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Get facilities by source"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'data': {'items': [{'facility': 'ASGA', 'count': 25961},\n",
" {'facility': 'JSV', 'count': 25020},\n",
" {'facility': 'SFC', 'count': 25001},\n",
" {'facility': 'SFB', 'count': 25000},\n",
" {'facility': 'GKR', 'count': 24632},\n",
" {'facility': 'SFA', 'count': 17459},\n",
" {'facility': 'AHA', 'count': 16355},\n",
" {'facility': 'KVB', 'count': 14029},\n",
" {'facility': 'VAL', 'count': 10746},\n",
" {'facility': 'MAR', 'count': 8780},\n",
" {'facility': 'TROL', 'count': 1225},\n",
" {'facility': 'SLA', 'count': 364},\n",
" {'facility': 'ASGB', 'count': 325},\n",
" {'facility': 'GRA', 'count': 93},\n",
" {'facility': 'JCA', 'count': 50},\n",
" {'facility': 'SNA', 'count': 27},\n",
" {'facility': 'NJA', 'count': 11},\n",
" {'facility': 'SNB', 'count': 10},\n",
" {'facility': 'GFA', 'count': 9},\n",
" {'facility': 'KRIS', 'count': 7},\n",
" {'facility': 'GDR', 'count': 6},\n",
" {'facility': 'KAA', 'count': 6},\n",
" {'facility': 'HD', 'count': 5},\n",
" {'facility': 'VIS', 'count': 5},\n",
" {'facility': 'OSA', 'count': 4},\n",
" {'facility': 'TROA', 'count': 4},\n",
" {'facility': 'GFC', 'count': 3},\n",
" {'facility': 'OSC', 'count': 3},\n",
" {'facility': 'PERA', 'count': 3},\n",
" {'facility': 'PERB', 'count': 3},\n",
" {'facility': 'MON', 'count': 2},\n",
" {'facility': 'NOR', 'count': 2},\n",
" {'facility': 'OSE', 'count': 2},\n",
" {'facility': 'BAC', 'count': 1},\n",
" {'facility': 'DOW', 'count': 1},\n",
" {'facility': 'GFB', 'count': 1},\n",
" {'facility': 'KLAB', 'count': 1},\n",
" {'facility': 'MLA', 'count': 1},\n",
" {'facility': 'OSS', 'count': 1},\n",
" {'facility': 'SNO', 'count': 1},\n",
" {'facility': 'VFR', 'count': 1}]}}"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#TEST\n",
"api.get_facilities_by_source(source=federationSource[0])"
]
}
],
"metadata": {
Expand Down

0 comments on commit 0367933

Please sign in to comment.