Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Cavell Prism Client

CI PyPI Python License: MIT

Python client for Cavell Prism — extract structured FHIR resources from clinical notes and persist them to your own FHIR server.

Cavell never connects to your FHIR server. Your system sends clinical text to the Prism API, receives extracted resources back, and persists them locally with your own credentials. Cavell has no access to your database and stores no credentials: every request carries your own LLM Gateway key.

Installation

pip install cavell-prism-client

Or with uv:

uv add cavell-prism-client

The import name is cavell_client.

Quickstart

You need a Prism API URL (https://prd.prism.cavell.app/api) and an LLM Gateway key — contact your Cavell representative for a key. For a local FHIR server, docker compose up -d in this repo starts HAPI on http://localhost:8090.

from cavell_client import CavellClient, IngestionPipeline
from cavell_client import Organization, Patient, Document

with CavellClient(
    api_url="https://prd.prism.cavell.app/api",
    api_key="<your LLM Gateway key>",
    fhir_base_url="http://localhost:8090",
) as client:
    pipeline = IngestionPipeline(client, default_organization="CGH-001")

    # 1. Seed reference data and patients
    pipeline.seed(
        organizations=[Organization(identifier="CGH-001", name="City General")],
        patients=[Patient(identifier="MRN-1", managing_organization="CGH-001")],
    )

    # 2. Extract clinical notes (per patient, in date order) and persist
    outcomes = pipeline.extract(
        [
            Document(
                text="Patient diagnosed with type 2 diabetes...",
                patient_identifier="MRN-1",
                date="2024-01-15",
                document_id="note-001",
            ),
        ]
    )
    for outcome in outcomes:
        print(outcome)

Extraction is resume-safe (skip_processed=True by default), retries transient failures, and aborts cleanly on auth/gateway outages. A note older than the patient's newest already-extracted one is extracted against split context: it is shown the record as it stood on its own date, with everything newer sent separately so the model cannot read its own future as history. Such a note comes back with out_of_order=True — a record of how it was processed, not a failure — and the rest of the call is unaffected.

For a whole dataset, use pipeline.extract_all(documents, batch_size=500): it sorts every document by ascending date before splitting it into batches, so each patient's notes are extracted oldest-first even when they span batches. extract() makes a single pass and its limit caps that pass rather than chunking it.

Clinical validation

Every extracted resource carries an unvalidated meta tag. When a clinician has reviewed a resource, remove the tag; any later update re-adds it:

client.list_unvalidated_resources(patient_fhir_id, "Condition")  # review queue
client.mark_validated("Condition", condition_id)  # $meta-delete

Documentation

Setup guides, the pipeline walkthrough, and demo notebooks (synthetic data): polaris-health.github.io/cavell-prism-client

Contributing & security

See CONTRIBUTING.md for development setup and the release process, and SECURITY.md for how to report vulnerabilities.

License

MIT

Release files for cavell-prism-client 0.7.0.dev202608280756

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cavell-prism-client 0.7.0.dev202608280756
File Size Uploaded
cavell_prism_client-0.7.0.dev202608280756.tar.gz 98.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cavell-prism-client 0.7.0.dev202608280756
File Interpreter ABI Platform
cavell_prism_client-0.7.0.dev202608280756-py3-none-any.whl Python 3 none any Details

Total release size: 146.8 kB

Release files / cavell_prism_client-0.7.0.dev202608280756.tar.gz

Download URL cavell_prism_client-0.7.0.dev202608280756.tar.gz
Size 98.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2eafb30d1334381301a987ea1f33fd0a0f2ea4c18e7bc30dffa9b8833c6add99
BLAKE2b-256 checksum
How to use checksums
3519c18357f6ada823f79ce184916b3226c968fb2fe3e0d65c30ab892b96a9cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release files / cavell_prism_client-0.7.0.dev202608280756-py3-none-any.whl

Download URL cavell_prism_client-0.7.0.dev202608280756-py3-none-any.whl
Size 48.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0858e78e446d9f37d3a48a197e38fc260e232131da23aa2957693451ec6e64b
BLAKE2b-256 checksum
How to use checksums
99b805d5b3bcc5d91aa5b14ef090035beb727e65f55ad959b653796126581fe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page