Skip to main content

CARD — Clinical Archiving Repository Dataset

CARD is the integration layer that connects Schema Builder to any downstream analytics platform. It encodes the full pipeline — schemas, datasets, plugins, and visualization targets — into a single named, versioned, reusable configuration called a CARD Profile.

The Problem CARD Solves

Getting from a JSON-LD schema to a live Superset dashboard today requires:

  1. Manual DDL export from the Mapper View
  2. Manual DuckDB/PostgreSQL CLI commands to load data
  3. Manual "Add Database" in Superset Settings
  4. Manual dataset registration for each table
  5. Manual chart and dashboard authoring

Every step is repeated per project, per user, per environment. CARD eliminates all of it.

CARD Vision

Any schema. Any dataset. Any AI. Any visualizer.

A CARD Profile is a project-scoped, named configuration record that captures:

SlotWhat it defines
SchemasWhich JSON-LD schemas are active for this profile
DatasetsSeed data (via faker.js), real data, uploaded CSV/SQL, or none
PluginsWhich Schema Builder plugins to invoke (DDL, seed data, custom)
Visualization AppsTarget BI tool (Apache Superset v1; Grafana, Metabase — future)

Any authorized user — or any CI/CD pipeline — can select a CARD Profile and replay the full pipeline deterministically. Same profile + same data = same dashboards, every time.


System Architecture

┌──────────────────────────────────────────────────────────────────────┐
│ SureCentric PostgreSQL DB │
│ │
│ sb_card_profile │
│ ┌─────────────┬─────────────┬──────────────┬────────────────────┐ │
│ │ profile_id │ project_id │ friendly_name│ config (JSONB) │ │
│ ├─────────────┼─────────────┼──────────────┼────────────────────┤ │
│ │ abc-123 │ eclinical-v1│ eClinical │ { schemas, ...} │ │
│ └─────────────┴─────────────┴──────────────┴────────────────────┘ │
└──────────────────────────────────────────────────────────────────────┘
▲ CRUD via REST API ▲
│ (card-api :3099) │ /provision
│ │
┌────────┴───────────────┐ ┌────────────────┴──────────┐
│ Schema Builder │ │ Apache Superset │
│ (Vue 3, :5173) │ CARD │ (:8088) │
│ │ Profile │ │
│ [CARD Combobox ▼] │ ─────────▶ │ SS CARD Plugin │
│ [View CARD Profile] │ │ - DB Connection │
│ CARD Profile Editor │ │ - Dataset Registration │
│ │ │ - Dashboard seed │
└────────────────────────┘ └───────────────────────────┘

CARD API

Service: surecentric-card-api | Port: 3099 | Runtime: Node.js 20 / Express / TypeScript

GET    /health
GET /api/sb/card-profiles?project_id=<id> → list active profiles
GET /api/sb/card-profiles/:id → get single profile
POST /api/sb/card-profiles → create profile
PUT /api/sb/card-profiles/:id → update profile
DELETE /api/sb/card-profiles/:id → soft-delete
GET /api/sb/card-profiles/:id/export → download .card.json
POST /api/sb/card-profiles/:id/provision → auto-provision Superset DB + datasets

/provision — What Happens

When you click ▶ Provision in the CARD Profile Editor:

  1. card-api authenticates with Superset via POST /api/v1/security/login
  2. Finds or creates the Superset Database connection (e.g. ClinicalDuckDB)
  3. Registers each table from connection.tables as a Superset Dataset
  4. Returns per-app provisioning results as a JSON response
  5. Schema Builder shows a success/failure toast

CARD Profile Config Schema

The config JSONB field supports four top-level slots:

{
"schemas": [
{
"schema_id": "eclinical-ehr-subset",
"label": "eClinical EHR Subset",
"source_file": "generated/eclinical-ehr-subset.jsonld",
"active": true
}
],
"datasets": [
{
"dataset_id": "eclinical-faker-v1",
"type": "faker", // "faker" | "real" | "sql-file" | "none"
"source_plugin": "com.sureclinical.seed-data-generator",
"include_seed": true,
"row_counts": { "clinical_site": 8, "patient": 50, "visit": 150 },
"seed": 42
}
],
"plugins": [
{ "plugin_id": "com.sureclinical.sql-duckdb", "version": "1.1.0", "active": true },
{ "plugin_id": "com.sureclinical.seed-data-generator", "version": "1.0.0", "active": true }
],
"visualization_apps": [
{
"app_id": "apache-superset",
"plugin": "com.sureclinical.ss-card-plugin",
"connection": {
"superset_url": "http://localhost:8088",
"username": "admin",
"password_secret_ref": "SUPERSET_ADMIN_PASSWORD", // env var — never plaintext
"database_engine": "duckdb",
"sqlalchemy_uri": "duckdb:////data/clinical.duckdb",
"tables": ["clinical_site", "patient", "visit", "adverse_event"]
}
}
]
}
Secrets

Superset credentials are never stored as plaintext in the config JSONB. The field password_secret_ref holds only the name of the environment variable. The provision endpoint resolves it at runtime: process.env[connection.password_secret_ref].


CARD Profile Editor UI

The CARD Profile Editor is a dialog in Schema Builder (opened via the 🔧 button next to the CARD Combobox). It has four tabs:

TabWhat you configure
SchemasSelect which JSON-LD schemas are active
DatasetsToggle seed / real / uploaded data; set row counts and RNG seed
PluginsEnable/disable Schema Builder plugins for this profile
Visualization AppsConfigure Superset (URL, credentials, tables, engine)

The Seed Dataset toggle controls whether the Seed Dataset Generator plugin produces INSERT statements as part of the provision pipeline — enabling instant chart rendering in Superset prior to loading real data.


SS CARD Plugin — Apache Superset

The SS CARD Plugin (sureclinical-superset-card) is a Python package that runs inside Apache Superset:

sureclinical-superset-card/
├── superset_card/
│ ├── __init__.py # registers plugin with Superset
│ ├── card_connector.py # CardConnector: provisions DB + datasets
│ ├── views.py # FlaskView: "CARD Profiles" admin menu
│ └── api.py # Blueprint: /superset/card-profiles/*
└── setup.py

Installed via docker/superset/requirements-local.txt. When installed:

  • Adds a "CARD Profiles" entry under Superset Settings
  • Fetches CARD Profiles from card-api at the configured CARD_API_URL
  • Calls CardConnector.provision() to wire DB connections and datasets
  • Optionally seeds starter dashboards from profile templates

Target Visualizers

CARD's visualization_apps slot is designed for any BI tool. The plugin field references a Schema Builder plugin that handles the platform-specific provisioning:

PlatformPlugin IDStatus
Apache Supersetcom.sureclinical.ss-card-plugin✅ V1
Grafanacom.sureclinical.grafana-card-plugin🔲 Planned
Metabasecom.sureclinical.metabase-card-plugin🔲 Planned
Custom / OpenAPIAny plugin implementing the provision() interfaceOpen

End-to-End User Journey

1. Open Schema Builder → select "eClinical" from CARD Combobox
→ activates eclinical-ehr-subset.jsonld + sql-duckdb + seed-data-generator

2. Work in Mapper View → click Generate
→ schema.sql + inserts.sql written to /generated/

3. Click ▶ Provision in CARD Profile Editor
→ card-api authenticates with Superset
→ creates ClinicalDuckDB connection
→ registers 4 datasets: clinical_site, patient, visit, adverse_event

4. Open Superset → Databases → ClinicalDuckDB ✓
→ Datasets ready → build charts immediately

Zero manual Superset configuration. Zero repeated setup per environment.


Docker Stack

All CARD services run on the SureCentric Docker network:

ContainerImagePort
superset_appapache/superset:4.0.08088
superset_dbpostgres:175432
superset_cacheredis:76379
surecentric-card-apinode:20-alpine3099
surecentric-duckdbdatacatering/duckdb:v1.2.1
# Start the full CARD stack
docker compose up -d

# Verify
curl http://localhost:3099/health
# → {"status":"ok","service":"card-api"}

curl "http://localhost:3099/api/sb/card-profiles?project_id=eclinical-v1"
# → [{ "friendly_name": "eClinical", "config": { ... } }]

Implementation Status

PhaseNameStatus
C-0Docker stack (Superset, DuckDB, PostgreSQL)✅ Complete
C-1CARD API (DB table, REST CRUD, Docker service)✅ Complete
C-2aProject Switcher + CARD Combobox in SB toolbar✅ Complete
C-2bCARD Profile Editor dialog (full implementation)🔲 Pending
C-3SS CARD Plugin (Superset Python package)🔲 Pending
C-4End-to-end demo + dashboard seed🔲 Pending

CARD for Superset

For complete documentation of the Superset connector — including the Docker architecture, the /provision endpoint, seed chart templates, DuckDB scoping, and the end-to-end user journey — see the CARD for Superset page.