Skip to main content

Thin HTTP client for the DRC Vantage platform API

Project description

drc-vantage

Thin HTTP client for the Vantage platform. Talks only to the Next.js API (VANTAGE_API_URL) with a global API key — never to Postgres or FastAPI directly.

Install

pip install drc-vantage
# or
uv add drc-vantage

Configuration

Variable Description Example
VANTAGE_API_URL Next.js API base (includes /api) http://localhost:3000/api
VANTAGE_API_KEY Global platform API key (same as server API_KEY) your_api_key
API_KEY Alias if VANTAGE_API_KEY is unset
VANTAGE_ORGANIZATION_ID Optional org scope (X-Organization-Id) org_xxx
VANTAGE_ORGANIZATION_SLUG Resolve org id from slug when id is unset acme

Classes

Client, Dataset, DataSource, DataSourceCategory, DataStorageSystem

Orchestration helpers: send_orchestration_event, orchestration_hooks (see below).

Prefect orchestration events

Register deployment run state on the platform (home / data sources / datasets health). The deployment UUID must match a DataSource or Dataset already registered in the org (e.g. prefect_deployment_id=deployment.id when calling register() inside the same flow).

from prefect import flow
from prefect.runtime import deployment
from vantage import Client, DataSource, DataSourceCategory
from vantage.orchestration import orchestration_hooks

client = Client(organization_slug="acme")
hooks = orchestration_hooks(client)  # resolves deployment.id at hook time

@flow(
    name="ingest-anthropic",
    on_running=hooks.on_running,
    on_completion=hooks.on_completion,
    on_failure=hooks.on_failure,
    on_crashed=hooks.on_crashed,
    on_cancellation=hooks.on_cancellation,
)
def ingest_anthropic():
    category = DataSourceCategory(client=client, slug="saas", name="SaaS", color="#3366FF")
    DataSource(
        client=client,
        slug="anthropic",
        name="Anthropic",
        category=category,
        prefect_deployment_id=deployment.id,
        logo_url="https://example.com/logo.svg",
    ).register()
    ...

# Optional: pin the deployment UUID explicitly instead of runtime resolution
hooks = orchestration_hooks(client, prefect_deployment_id="your-prefect-deployment-uuid")

Manual event (e.g. custom hook):

from vantage.orchestration import send_orchestration_event

send_orchestration_event(
    client,
    prefect_deployment_id="...",
    event="FAILED",
    flow_run_id="...",
    error_message="warehouse timeout",
)

Hook HTTP failures are logged and do not fail the Prefect flow.

Dataset lifecycle example

from vantage import Client, Dataset

client = Client(organization_slug="acme")  # or organization_id="org_xxx"

dataset = Dataset(
    client=client,
    location={"schema": "marts", "table": "customer_success_nps"},
    name="Customer Success NPS",
    type="TABLE",
    description="Qualtrics survey NPS summaries enriched with HubSpot contacts.",
    chat_question_examples={
        "en": ["What is the average NPS score by survey?"],
        "fr": ["Quel est le score NPS moyen par enquête?"],
    },
    data_source_slugs=["qualtrics", "hubspot"],
    storage_system_slug="postgresql",
)

result = dataset.register()
dataset.assign_to_team("customer-success", owner="owner@example.com")
result = dataset.analyze_and_check_alerts()

Individual steps:

dataset.register()
dataset.analyze()              # Prefect — includes validations
dataset.check_alerts()         # Prefect
dataset.analyze_and_check_alerts()  # Prefect — preferred combined pipeline

Catalog register

from vantage import Client, DataSource, DataSourceCategory, DataStorageSystem

client = Client(organization_slug="acme")

category = DataSourceCategory(
    client=client, slug="saas", name="SaaS", color="#3366FF"
)
category.register()

source = DataSource(
    client=client,
    slug="hubspot",
    name="HubSpot",
    category=category,
    logo_url="https://example.com/hubspot.svg",
)
source.register()

storage = DataStorageSystem(
    client=client,
    slug="postgresql",
    name="PostgreSQL",
    kind="POSTGRESQL",
    logo_url="https://example.com/pg.svg",
)
storage.register()

Architecture

drc-vantage  →  Next.js (/api)  →  FastAPI  →  vantage-compute / Prefect

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

drc_vantage-2.2.3.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

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

drc_vantage-2.2.3-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file drc_vantage-2.2.3.tar.gz.

File metadata

  • Download URL: drc_vantage-2.2.3.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for drc_vantage-2.2.3.tar.gz
Algorithm Hash digest
SHA256 23bb9972e4123a4e72b8b7cd5b9277ebfc3387e5a021ee7a1cd02946b70133aa
MD5 c706cd0a5dfea9c60c43a98c0f6591f8
BLAKE2b-256 2b13c88fd54f859337b5a4bfe99c4dd7ace858dba49ce2b6e257a919539e9786

See more details on using hashes here.

File details

Details for the file drc_vantage-2.2.3-py3-none-any.whl.

File metadata

  • Download URL: drc_vantage-2.2.3-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for drc_vantage-2.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aa23ab7f2d1b38f2280c80a6e5e238c1a64b3c18f88e5d0a0a5b2d635227c2f8
MD5 7639f7a9c493a9c7298648d18041b476
BLAKE2b-256 1ce8c7b1052bd49e89ec5476f4447eb8a35a92ee1b76a5a6f7379a047a4c779e

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