| name | openevidence-upgrade-migration |
| description | Upgrade Migration for OpenEvidence.
Trigger: "openevidence upgrade migration".
|
| allowed-tools | Read, Write, Edit |
| version | 1.13.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","openevidence","healthcare"] |
| compatibility | Designed for Claude Code |
OpenEvidence Upgrade & Migration
Overview
OpenEvidence is a clinical AI platform that provides evidence-based medical answers and clinical decision support. The API exposes endpoints for clinical queries, evidence retrieval, and citation management. Tracking API changes is critical because OpenEvidence evolves its evidence grading schema, citation format, and clinical query response structure — and breaking changes in a healthcare context can surface outdated medical evidence, alter confidence scores, or remove critical safety disclaimers that downstream clinical applications depend on.
Version Detection
const OPENEVIDENCE_BASE = "https://api.openevidence.com/v1";
async function detectOpenEvidenceVersion(apiKey: string): Promise<void> {
const res = await fetch(`${OPENEVIDENCE_BASE}/status`, {
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
});
const version = res.headers.get("x-openevidence-api-version") ?? "v1";
console.log(`OpenEvidence API version: ${version}`);
const queryRes = await fetch(`${OPENEVIDENCE_BASE}/query`, {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({ question: "What is the recommended treatment for hypertension?", : }),
});
data = queryRes.();
hasStructuredCitations = data.?.[]?. !== ;
.();
hasDisclaimers = data. !== ;
.();
}
Migration Checklist
Schema Migration
interface OldQueryResponse {
answer: string;
citations: Array<{ title: string; url: string; source: string }>;
confidence: number;
}
interface NewQueryResponse {
answer: { text: string; sections: Array<{ heading: string; content: string }> };
citations: Array<{
title: string;
url: string;
source: string;
pmid?: string;
doi?: string;
evidence_grade: "A" | "B" | "C" | "D" | "expert_opinion";
publication_year: number;
}>;
confidence: { score: number; level: "high" | "moderate" | "low"; basis: };
: [];
: { : ; : };
}
(): {
{
: { : old., : [{ : , : old. }] },
: old..( ({
...c,
: ,
: ,
})),
: { : old., : old. > ? : , : },
: [],
: { : , : },
};
}
Rollback Strategy
class OpenEvidenceClient {
private apiVersion: "v1" | "v2";
constructor(private apiKey: string, version: "v1" | "v2" = "v2") {
this.apiVersion = version;
}
async query(question: string, options?: { specialty?: string }): Promise<any> {
try {
const res = await fetch(`https://api.openevidence.com/${this.apiVersion}/query`, {
method: "POST",
headers: { Authorization: `Bearer ${this.apiKey}`, "Content-Type": "application/json" },
body: JSON.stringify({ question, ...options }),
});
if (!res.ok) throw new Error(`OpenEvidence ${res.status}`);
return res.();
} (err) {
(. === ) {
.();
. = ;
.(question, options);
}
err;
}
}
}
Error Handling
| Migration Issue | Symptom | Fix |
|---|
| Evidence grade scale changed | Grade returns "level-1" instead of "A" | Map new grade scale to internal representation using lookup table |
| Citation format restructured | Missing pmid field, now nested under identifiers.pmid | Update citation parser for new nested identifier structure |
| Disclaimer field required | Integration missing safety warnings in user-facing output | Always render disclaimers[] array from query response |
| Specialty taxonomy expanded | 400 with unknown specialty on filtered queries | Fetch current specialties from /specialties endpoint |
| Streaming format changed | SSE parser breaks on new event structure | Update event stream parser for new data: payload format |
Resources
Next Steps
For CI pipeline integration, see openevidence-ci-integration.