技能 编程开发 OpenEvidence多环境配置指南

OpenEvidence多环境配置指南

v20260423
openevidence-multi-env-setup
本指南详细介绍了OpenEvidence临床AI系统所需的严格多环境配置流程,核心目标是确保符合HIPAA等医疗合规性要求。它指导用户配置和验证开发、预发布和生产三个独立环境,用于管理从合成数据到包含完整PHI的各类数据。流程强调环境验证、BAA合规检查和完善的审计日志,以防止数据泄露和监管违规。
获取技能
79 次下载
概览

OpenEvidence Multi-Environment Setup

Overview

OpenEvidence clinical AI requires strict environment separation to maintain HIPAA compliance across the data lifecycle. Development uses only synthetic patient data with no PHI access, staging operates on de-identified datasets for clinical validation, and production handles full PHI under BAA-covered infrastructure. Each environment enforces its own audit logging, encryption, and access control policies. Misconfigured environments risk PHI exposure and regulatory violations, making environment validation a hard requirement at startup.

Environment Configuration

const openEvidenceConfig = (env: string) => ({
  development: {
    apiKey: process.env.OPENEVIDENCE_API_KEY_DEV!, baseUrl: "https://api.dev.openevidence.com/v1",
    dataClassification: "synthetic", phiEnabled: false, auditLevel: "basic", encryptionRequired: false,
  },
  staging: {
    apiKey: process.env.OPENEVIDENCE_API_KEY_STG!, baseUrl: "https://api.staging.openevidence.com/v1",
    dataClassification: "de-identified", phiEnabled: false, auditLevel: "full", encryptionRequired: true,
  },
  production: {
    apiKey: process.env.OPENEVIDENCE_API_KEY_PROD!, baseUrl: "https://api.openevidence.com/v1",
    dataClassification: "phi", phiEnabled: true, auditLevel: "full", encryptionRequired: true,
  },
}[env]);

Environment Files

# Per-env files: .env.development, .env.staging, .env.production
OPENEVIDENCE_API_KEY_{DEV|STG|PROD}=<api-key>
OPENEVIDENCE_BASE_URL=https://api.{dev.|staging.|""}openevidence.com/v1
OPENEVIDENCE_DATA_CLASS={synthetic|de-identified|phi}
OPENEVIDENCE_PHI_ENABLED={false|false|true}
OPENEVIDENCE_AUDIT_LEVEL={basic|full|full}
OPENEVIDENCE_BAA_ID=<baa-id>          # production only

Environment Validation

function validateOpenEvidenceEnv(env: string): void {
  const suffix = { development: "_DEV", staging: "_STG", production: "_PROD" }[env];
  const required = [`OPENEVIDENCE_API_KEY${suffix}`, "OPENEVIDENCE_BASE_URL", "OPENEVIDENCE_DATA_CLASS"];
  if (env === "production") required.push("OPENEVIDENCE_BAA_ID");
  if (env !== "development") required.push("OPENEVIDENCE_AUDIT_LEVEL");
  const missing = required.filter((k) => !process.env[k]);
  if (missing.length) throw new Error(`Missing OpenEvidence vars for ${env}: ${missing.join(", ")}`);
  if (env === "production" && process.env.OPENEVIDENCE_PHI_ENABLED !== "true")
    throw new Error("HIPAA violation: PHI must be enabled in production");
}

Promotion Workflow

# 1. Run clinical queries against synthetic data in dev
curl -X POST "$OPENEVIDENCE_BASE_URL/query" \
  -H "Authorization: Bearer $OPENEVIDENCE_API_KEY_DEV" -d @synthetic-query.json

# 2. Validate with de-identified data in staging (audit logs required)
curl -X POST "$OPENEVIDENCE_BASE_URL/query" \
  -H "Authorization: Bearer $OPENEVIDENCE_API_KEY_STG" -d @staging-query.json

# 3. Verify HIPAA audit trail exists for all staging queries
curl "$OPENEVIDENCE_BASE_URL/audit/logs?env=staging" \
  -H "Authorization: Bearer $OPENEVIDENCE_API_KEY_STG" | jq '.totalEntries'

# 4. Deploy to production (requires BAA verification)
OPENEVIDENCE_BAA_ID=baa-2026-001 npm run deploy -- --env production --hipaa-check

Environment Matrix

Setting Dev Staging Prod
Data Type Synthetic only De-identified Full PHI
PHI Access No No Yes (BAA required)
Audit Logging Basic Full Full + HIPAA trail
Encryption at Rest Optional Required Required (AES-256)
Access Control Developer only Clinical QA team Authorized clinicians
BAA Required No No Yes

Error Handling

Issue Cause Fix
HIPAA validation failed at startup PHI_ENABLED not set in production Set OPENEVIDENCE_PHI_ENABLED=true in prod env file
BAA ID missing Production deploy without BAA reference Add OPENEVIDENCE_BAA_ID from compliance team
403 on PHI endpoint Dev/staging key used against prod API Use environment-specific API key with correct scope
Audit log gap detected Staging queries not logged Verify OPENEVIDENCE_AUDIT_LEVEL=full in staging env

Resources

Next Steps

See openevidence-deploy-integration.

信息
Category 编程开发
Name openevidence-multi-env-setup
版本 v20260423
大小 3.41KB
更新时间 2026-04-28
语言