Docs: Supported CDRs

Supported CDRs

oehrpy's REST client is split into a vendor-neutral OpenEHRClient, which implements the openEHR ITS-REST 1.1.0 API as specified, and thin adapters that handle where a CDR deviates from it. All clients share the same methods, so switching CDR is a configuration change.

CDR Matrix

CDRStatusClientNotes
EHRBase 2.26+Supported (default)EHRBaseClientAdmin API at /rest/admin
FerroEHR 4.3+SupportedFerroEHRClientAdmin API at /rest/openehr/v1/admin (ADMIN role). Known server issue: FLAT GET drops nested HISTORY content.
Other ITS-REST 1.1.0 serversGenericOpenEHRClientNo vendor admin API
Better Platform, EHRServerPlanned—

Choosing a Client

from oehrpy.client import create_client, detect_server_type

# From configuration: "ehrbase", "ferroehr" or "generic"
client = create_client(
    "ferroehr",
    base_url="http://localhost:8080/ferroehr",
    username="ferroehr",
    password="ferroehr",
)

# Or probe GET {base}/rest/status (EHRBase may require credentials there)
url = "http://localhost:8080/ehrbase"
info = await detect_server_type(url, auth=("ehrbase-user", "SuperSecretPassword"))
client = create_client(
    info.server_type,
    base_url=url,
    username="ehrbase-user",
    password="SuperSecretPassword",
)

async with client:
    ehr = await client.create_ehr()

Authentication

Pass username/password for HTTP Basic, or any auth method as auth_method: BasicAuth, BearerAuth (a static token, or a sync or async token provider that is called for every request) or any httpx.Auth. Admin operations use admin_username/admin_password or admin_auth_method, and fall back to the regular credentials.

from oehrpy.client import BearerAuth, FerroEHRClient

async def get_access_token() -> str:
    # Return a valid OIDC access token; cache and refresh it yourself
    ...

async with FerroEHRClient(
    base_url="https://cdr.example.org/ferroehr",
    auth_method=BearerAuth(token_provider=get_access_token),
) as client:
    info = await client.get_server_info()

A 403 (e.g. a READONLY user writing, or a non-admin calling the admin API) raises AuthorizationError. All client errors derive from OpenEHRError; EHRBaseError remains as an alias.

Credentials are only sent over plain http:// to localhost. For any other host, auth_method credentials are refused and username/password emit an InsecureTransportWarning; use https://, or pass allow_insecure_http=True for a trusted network.

Handled Deviations

ConcernEHRBaseFerroEHR
Server statusAuthenticated, ehrbase_versionUnauthenticated JSON
Composition formatformat query parameterContent-Type / Accept media type
FLAT committemplateId query parameteropenehr-template-id header
EHR creationDefault EHR_STATUSEHR_STATUS with archetype_details
Template listAll versionsAll versions via version=*
Composition updateReturns the compositionMay return 204; UID from ETag
Admin API/rest/admin/{ehr,template,query}/rest/openehr/v1/admin/{ehr,template,query}