QNSP

Build Pattern · Python

Build a HIPAA-Aligned PHI Records System

PHI encrypted storage, HIPAA-aligned audit trails, de-identification controls, and PQC-authenticated exchanges.

Store and exchange PHI under HIPAA Security Rule with QNSP vault + SSE-X for clinical search + audit-service for tamper-evident logging. De-identification controls, retention policies, and tenant isolation built into the platform primitives.

25 minTime to first PQC
PythonPrimary SDK
4Services used

QNSP services used

Stack

Code

Real code, real SDK calls

Snippets reference the published @cuilabs/qnsp SDK surface (TypeScript, Python, Go, Rust mirror byte-for-byte).

Vault a PHI record + cohort-level encrypted searchpython
from qnsp import QnspClient
import os, base64, json

qnsp = QnspClient(api_key=os.environ["QNSP_API_KEY"])

# Vault PHI under per-patient key (ML-KEM-768-wrapped AES-256-GCM)
secret = qnsp.vault.create_secret(
    name=f"phi:{patient_mrn}",
    payload_b64=base64.b64encode(json.dumps(phi_record).encode()).decode(),
    metadata={"pqcAlgorithm": "ml-kem-768"},
)

# Cohort search: index a de-identified embedding for cohort discovery
qnsp.search.upsert_vectors(
    index_name="cohorts",
    vectors=[{
        "id": patient_mrn,
        "vector": deidentified_embedding,
        "metadata": {"age_band": "60-70", "icd10_prefix": "E11"},
    }],
)

qnsp.audit.log_event(
    event_type="phi.created",
    payload={"mrn": patient_mrn, "secret_id": secret["id"]},
)

Ship it

Get an API key and start building