Skip to main content

Trakt System Integrations API client: fleet predictions and maintenance forecasts.

Project description

Trakt System SDK

Client libraries for the Trakt System Integrations API: fleet predictions and maintenance forecasts, in a few lines of code.

Trakt System predicts which components on your fleet need attention, when, and what to do about them. This SDK gives you that data directly, with authentication, retries, and rate limits handled for you.

Full endpoint reference, including request and response schemas for every route: https://trakt.tech/api-documentation

Install

Python

pip install kquika-trakt              # core
pip install "kquika-trakt[pandas]"    # with DataFrame support

The distribution is named kquika-trakt and the import is trakt. That difference is normal: the package you install and the module you import do not have to share a name.

Node / TypeScript

npm install @kquika-inc/trakt

Requires Node 18 or newer. TypeScript types are included.

Quickstart

Python

from trakt import Trakt

trakt = Trakt(token="YOUR_API_KEY")   # or set TRAKT_TOKEN

# What can this token do?
cfg = trakt.config()
print(cfg.access_level, cfg.max_predictions, cfg.can_export)

# Per-component predictions, most urgent first
for c in trakt.components():
    print(c.name, c.aircraft_tail_number, c.health,
          c.failure_probability, c.recommended_action)

# The next 90 days of maintenance, soonest first
for item in trakt.forecast(days=90):
    if item.is_overdue:
        print("OVERDUE:", item.tail_number, item.component_name)

# Straight to a DataFrame for planning
df = trakt.components_dataframe()

# Fleet-level rollup that matches the dashboards: health, composite average
# confidence, prediction coverage, and 30-day survival
summary = trakt.fleet_summary()
print(summary.fleet_health, summary.avg_confidence, summary.survival_30d)

Node / TypeScript

import { Trakt } from "@kquika-inc/trakt";

const trakt = new Trakt({ token: process.env.TRAKT_TOKEN! });

const cfg = await trakt.config();
console.log(cfg.access_level, cfg.max_predictions);

// Per-component predictions, most urgent first
const components = await trakt.components();
for (const c of components) {
  console.log(c.name, c.aircraft_tail_number, c.health, c.recommended_action);
}

// The next 90 days of maintenance, soonest first
const forecast = await trakt.forecast({ days: 90 });
for (const item of forecast) {
  if (item.is_overdue) console.log("OVERDUE:", item.tail_number, item.component_name);
}

// Fleet-level rollup that matches the dashboards
const summary = await trakt.fleetSummary();
console.log(summary.fleet_health, summary.avg_confidence, summary.survival_30d);

Handling errors

Both clients raise typed errors, so you can catch the case you care about.

from trakt import AuthenticationError, PermissionError_, RateLimitError

try:
    components = trakt.components()
except AuthenticationError:
    print("The token was not accepted.")
except PermissionError_:
    print("This token's access level does not cover that call.")
except RateLimitError:
    print("Quota exhausted. The client already retried with backoff.")
import { AuthenticationError, PermissionError, RateLimitError } from "@kquika-inc/trakt";

try {
  const components = await trakt.components();
} catch (e) {
  if (e instanceof AuthenticationError) console.error("The token was not accepted.");
  else if (e instanceof PermissionError) console.error("Access level does not cover that call.");
  else if (e instanceof RateLimitError) console.error("Quota exhausted.");
  else throw e;
}

What the clients do for you

  • Auth. Set the token once; every request carries the bearer header.
  • Retries. A rate limit or a transient server failure is retried with exponential backoff and jitter, honoring Retry-After when it is sent. A rejected token or a permission error is not retried, because retrying will not fix it.
  • Typed errors. AuthenticationError, PermissionError, RateLimitError, NotFoundError, ServerError.
  • Flattened objects. The nested prediction, survival, and maintenance blocks are lifted onto the component, so health and recommended_action are one attribute away.
  • Useful ordering. Components come back most urgent first; forecast items come back soonest first.

Reading the fields

Field Meaning
health 0 to 100, where higher is healthier.
health_trend stable, declining, or critical.
predicted_rul_hours / predicted_rul_days Remaining useful life before attention is due.
failure_probability 0 to 1, the modeled chance of failure in the near term.
recommended_action do_nothing, monitor, inspect, repair, or replace.
priority The urgency band for planning.
task_reference The task identifier from your source system, so a row ties back to its task.
days_until_due Negative means the item is already past due.

Access levels

Your token is issued at one of three levels, which control both the endpoints it can reach and how many records a request returns:

  • read_only — read predictions and forecasts
  • read_write — read, plus the write endpoints
  • full — everything, including fleet export

A call outside your token's level raises a permission error. Call config() to see the level and limits for your token rather than guessing.

Need a client in another language?

The SDKs are built from an OpenAPI specification, so a client can be generated for most languages. Contact us and we will provide the spec.

Support

API reference: https://trakt.tech/api-documentation

Questions, a token, or a raised limit: support@kquika.com

License

MIT

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

kquika_trakt-1.1.5.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kquika_trakt-1.1.5-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file kquika_trakt-1.1.5.tar.gz.

File metadata

  • Download URL: kquika_trakt-1.1.5.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for kquika_trakt-1.1.5.tar.gz
Algorithm Hash digest
SHA256 bd7b578b8a9805a2bee762453db462db93140235dea9a6b85c53142bdff4b3ea
MD5 acaaeb7cac663166b3dfb4c5c39c6013
BLAKE2b-256 fa2d8ade2e1b1b6a74b7c7c6f159cb2056903c113e36e0d5d6b7cb3f47ecb4e8

See more details on using hashes here.

File details

Details for the file kquika_trakt-1.1.5-py3-none-any.whl.

File metadata

  • Download URL: kquika_trakt-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for kquika_trakt-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c1e31c3b06baa4ce1450c78150a6c8c06778745832946cd4623dd6e462fd6683
MD5 7dfb49b233d4ba7942725d78cc4f009c
BLAKE2b-256 b5bab54103386dac2b4fca2828e107b52d8c9162953789d42679d09530dba3e0

See more details on using hashes here.

Supported by

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