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
| CDR | Status | Client | Notes |
|---|---|---|---|
| EHRBase 2.26+ | Supported (default) | EHRBaseClient | Admin API at /rest/admin |
| FerroEHR 4.3+ | Supported | FerroEHRClient | Admin API at /rest/openehr/v1/admin (ADMIN role). Known server issue: FLAT GET drops nested HISTORY content. |
| Other ITS-REST 1.1.0 servers | Generic | OpenEHRClient | No vendor admin API |
| Better Platform, EHRServer | Planned | — |
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
| Concern | EHRBase | FerroEHR |
|---|---|---|
| Server status | Authenticated, ehrbase_version | Unauthenticated JSON |
| Composition format | format query parameter | Content-Type / Accept media type |
| FLAT commit | templateId query parameter | openehr-template-id header |
| EHR creation | Default EHR_STATUS | EHR_STATUS with archetype_details |
| Template list | All versions | All versions via version=* |
| Composition update | Returns the composition | May return 204; UID from ETag |
| Admin API | /rest/admin/{ehr,template,query} | /rest/openehr/v1/admin/{ehr,template,query} |