ExamplesClinical trials
Provenance of a decision
Read who recommended the dose level 2 decision, who decided, what was rejected, and which records it rests on.
Set SMARTMEMORY_API_KEY, SMARTMEMORY_WORKSPACE_ID and optionally SMARTMEMORY_BASE_URL (default https://api.smartmemory.ai). See the overview for setup.
What it uses
client.search_decisionsandclient.decisions.searchfind decisions by topic.client.get_provenance_chainandclient.decisions.getProvenancereturn the decision, its rationale, its rejected alternatives and the evidence records behind it.- The recommender and the decider are fields on the decision record in the evidence list (
recommended_by,decided_by).
Python
"""Provenance of the dose level 2 decision: who recommended, who decided, what was rejected, on what evidence."""
import os
from smartmemory_client import SmartMemoryClient
client = SmartMemoryClient(
base_url=os.environ.get("SMARTMEMORY_BASE_URL", "https://api.smartmemory.ai"),
api_key=os.environ["SMARTMEMORY_API_KEY"],
workspace_id=os.environ["SMARTMEMORY_WORKSPACE_ID"],
)
found = client.search_decisions("dose level 2")["decisions"]
decision_id = found[0]["decision_id"]
chain = client.get_provenance_chain(decision_id)
decision = chain["decision"]
print("Decision:", decision["content"][:96] + "...")
print("Status:", decision["status"], "| domain:", decision["domain"])
print("Rationale:", decision["rationale"][:96] + "...")
print("Rejected alternatives:")
for option in decision["rejected_alternatives"]:
print(" -", option.split(":")[0])
print("Evidence:")
for row in chain["evidence"]:
memory = row["memory"]
meta = memory["metadata"]
print(f" {meta['record_id']:<10} {meta['event_date']} {meta['title'][:60]}")
if meta.get("record_type") == "decision":
print(f" recommended by {meta['recommended_by']}, decided by {meta['decided_by']}")Output:
Decision: Dose level 2 continues unchanged at 200 mg once daily with enhanced liver monitoring (weekly LFT...
Status: active | domain: safety
Rationale: The DMC ad hoc review of 2026-02-09 saw no imbalance that warranted dropping or changing a dose ...
Rejected alternatives:
- Stop randomization to dose level 2
- Reduce dose level 2 to 150 mg
- Change nothing until the scheduled May DMC meeting
Evidence:
CT-SAE-01 2026-01-27 SAE-01: serious hepatic event, participant 02-003, site 02 (
CT-EP-02 2026-02-02 Medical monitor requests an ad hoc DMC review (2026-02-02)
CT-EP-04 2026-02-09 DMC ad hoc meeting outcome (2026-02-09)
CT-DEC-02 2026-02-10 Decision: dose level 2 continues at 200 mg with enhanced liv
recommended by Helena Voss, decided by Daniel OkoroJavaScript
// Provenance of the dose level 2 decision: who recommended, who decided, what was rejected, on what evidence.
import { SmartMemoryClient } from "@smartmemory/sdk-js";
const client = new SmartMemoryClient({
apiBaseUrl: process.env.SMARTMEMORY_BASE_URL ?? "https://api.smartmemory.ai",
apiKey: process.env.SMARTMEMORY_API_KEY,
storage: "memory", // a script has no browser storage
});
client.setWorkspaceId(process.env.SMARTMEMORY_WORKSPACE_ID);
const found = await client.decisions.search("dose level 2");
const decisionId = found.decisions[0].decision_id;
const chain = await client.decisions.getProvenance(decisionId);
const decision = chain.decision;
console.log("Decision:", decision.content.slice(0, 96) + "...");
console.log("Status:", decision.status, "| domain:", decision.domain);
console.log("Rationale:", decision.rationale.slice(0, 96) + "...");
console.log("Rejected alternatives:");
for (const option of decision.rejected_alternatives) console.log(" -", option.split(":")[0]);
console.log("Evidence:");
for (const { memory } of chain.evidence) {
const meta = memory.metadata;
console.log(` ${meta.record_id.padEnd(10)} ${meta.event_date} ${meta.title.slice(0, 60)}`);
if (meta.record_type === "decision") {
console.log(` recommended by ${meta.recommended_by}, decided by ${meta.decided_by}`);
}
}Output:
Decision: Dose level 2 continues unchanged at 200 mg once daily with enhanced liver monitoring (weekly LFT...
Status: active | domain: safety
Rationale: The DMC ad hoc review of 2026-02-09 saw no imbalance that warranted dropping or changing a dose ...
Rejected alternatives:
- Stop randomization to dose level 2
- Reduce dose level 2 to 150 mg
- Change nothing until the scheduled May DMC meeting
Evidence:
CT-SAE-01 2026-01-27 SAE-01: serious hepatic event, participant 02-003, site 02 (
CT-EP-02 2026-02-02 Medical monitor requests an ad hoc DMC review (2026-02-02)
CT-EP-04 2026-02-09 DMC ad hoc meeting outcome (2026-02-09)
CT-DEC-02 2026-02-10 Decision: dose level 2 continues at 200 mg with enhanced liv
recommended by Helena Voss, decided by Daniel OkoroThe output below is from a real run against a local test stack seeded with the demo dataset. It shows record ids and dates only.