Library for Piscada Foresight; Access knowledge-graph and timeseries data.
Project description
Piscada Foresight
Access knowledge-graph and timeseries data.
Overview
This library provides access to the knowledge-graph and timeseries data in the Foresight platform. It implements a Transport using HTTPX to be used with the GQL GraphQL client. It also provides convenience functions:
data
module: Read timeseries values as Pandas DataFrames or Seriesgraph
module: Query the knowledge-graph
Installation
pip install piscada-foresight
You will need access to a Piscada Foresight instance. The library uses the OAuth2 Authorization Code Flow with Proof Key for Code Exchange (PKCE) to act on behalf of your user. After an initial interactive login, the library persists the session state in $HOME/.foresight-lib-py_state
and will use that to authenticate non-interactive the next time.
Usage
from datetime import datetime, timedelta, timezone
from gql import Client
from piscada_foresight.data import get_value, get_values
from piscada_foresight.http import ForesightHTTPXTransport
# Create a transport with authentication and a GraphQL client:
transport = ForesightHTTPXTransport("foresight.piscada.cloud")
fs_client = Client(transport=transport, fetch_schema_from_transport=False)
# Retrieve timeseries values for a specific entity:
get_values(
fs_client,
"ENTITY_ID",
datetime.now(tz=timezone.utc) - timedelta(hours=8),
)
Contributing
Contributions are welcome! You can contact us at foresight@piscada.com.
Support
If you have any questions, issues, or suggestions, please contact us at foresight@piscada.com.
Copyright
© Piscada AS 2024
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file piscada_foresight-0.1.1.tar.gz
.
File metadata
- Download URL: piscada_foresight-0.1.1.tar.gz
- Upload date:
- Size: 61.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.25
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1a9f9c031a6e32fb80715db00674acf17e62d6c29a7fbda284e384e76e2fea5 |
|
MD5 | 6a06b74def980addf658ecb41c66183f |
|
BLAKE2b-256 | c9171b8fbb465c7ceb621f4a490846c94bd5d414feb0cc86177518e0145ca1cb |
File details
Details for the file piscada_foresight-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: piscada_foresight-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.4.25
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f1d97354a4d2486900b8268697e7bd963966206cd65d2a66813e2ca40a971b8 |
|
MD5 | 34db39d9f69b63446b316d545aa03b8a |
|
BLAKE2b-256 | 78f9804bfa36fd2e92c3b295ffdf8b81d151bfab053ed315bfab6582e9620468 |