Skip to main content

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 Series
  • graph 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

piscada_foresight-0.2.0.tar.gz (62.3 kB view details)

Uploaded Source

Built Distribution

piscada_foresight-0.2.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file piscada_foresight-0.2.0.tar.gz.

File metadata

  • Download URL: piscada_foresight-0.2.0.tar.gz
  • Upload date:
  • Size: 62.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.25

File hashes

Hashes for piscada_foresight-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cc3cfc07e9c601ac9f836c6c46c72cf83e27ba513f7a0a0a38afc139a5d033db
MD5 5c460614062eee16033a43f0083f745a
BLAKE2b-256 d51c9c0f896926fcc0c48c2460b470d6fbecbf0a58c853d9d88eab882f5b8464

See more details on using hashes here.

File details

Details for the file piscada_foresight-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for piscada_foresight-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 afcf5b56f26d3969d3f0f0142badff6fb415d85779bf5479903a42940fea1972
MD5 9de84f8a409bc9854a388f2758b2af89
BLAKE2b-256 78edee2e48ddf3bed499e54f5916f5502c7d89f8793be9dc4e53a9a4430dcc78

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page