# Healthcare ML lead: Quickstart

> Record training-data provenance, model lineage, and an Annex III high-risk profile for a clinical decision-support agent. local data erasure tooling included; DPDP / HIPAA-adjacent obligations called out honestly.

## You're here because...

You're an ML lead on a clinical / healthcare stack and you need provenance-grade documentation before the agent touches a patient record. Use the runnable example and the source limitations below to assess whether this workflow meets your requirements.

## 60-second install

```bash
pip install --pre attestix
```

## First 30 lines that actually do something

```python
from attestix.services.identity_service import IdentityService
from attestix.services.provenance_service import ProvenanceService
from attestix.services.compliance_service import ComplianceService

agent_id = IdentityService().create_identity(
    display_name="triage-assist-v2",
    source_protocol="manual",
    capabilities=["clinical_triage", "risk_stratification"],
    issuer_name="VibeTensor",
)["agent_id"]

# Article 10  -  training data provenance (de-identified clinical set)
ProvenanceService().record_training_data(
    agent_id=agent_id,
    dataset_name="MIMIC-IV de-identified ED triage subset",
    source_url="https://physionet.org/content/mimiciv/",
    license="PhysioNet Credentialed Health Data Use Agreement",
    data_categories=["clinical_notes", "vitals", "demographics"],
    contains_personal_data=True,
    data_governance_measures="De-identified per HIPAA Safe Harbor. IRB approval IRB-2026-0042.",
)

# Article 11  -  model lineage + evaluation metrics
ProvenanceService().record_model_lineage(
    agent_id=agent_id,
    base_model="clinicalBERT-base",
    base_model_provider="EMNLP Clinical NLP",
    fine_tuning_method="LoRA SFT on de-identified ED notes",
    evaluation_metrics={"auc_roc": 0.89, "sensitivity": 0.93, "specificity": 0.82},
)

# Annex III high-risk profile
ComplianceService().create_compliance_profile(
    agent_id=agent_id,
    risk_category="high",
    provider_name="VibeTensor",
    intended_purpose="ED triage decision support (Annex III Section 5(a)  -  access to essential services)",
    human_oversight_measures="Clinician reviews every triage recommendation before action.",
    transparency_obligations="Patient-facing disclosure of AI involvement per Article 50.",
)
```

## What you just got

- A signed Article 10 + Article 11 record per dataset and per fine-tuning run, every regulator's first ask.
- A high-risk profile gated under Annex III. The conformity-assessment service will block self-assessment and require a third-party result before issuing a Declaration of Conformity.
- A local erasure path (`IdentityService().purge_agent_data(agent_id)`) for managed records and parseable local backups. Revocation only marks an identity revoked. External copies need separate handling.

## Next step (5 minutes)

Log every clinical inference into the hash-chained Article 12 audit trail (no PHI in the payload, pass hashes / case IDs):

```python
ProvenanceService().log_action(
    agent_id=agent_id,
    action_type="inference",
    input_summary="Case CR-7421 (vitals + chief complaint hash sha256:a91...)",
    output_summary="Triage band: ESI-2; recommend immediate clinician review.",
    decision_rationale="Tachycardia + chest pain + age>65 -> ESI-2 per CDS rules.",
    human_override=False,
)
```

**Open caveats for healthcare production:** there is no third-party security audit, no HIPAA BAA template, and **DPDP (India) coverage is referenced in marketing but is planned for v0.5; it is not implemented in v0.4.0**. Local erasure tooling does not establish GDPR conformity or remove external copies. Treat all output as evidence under your existing legal review, not as legal sign-off.
