Go packages for openEHR:
typed compositions, checkable templates,
and an AQL builder and validator.
Decoding, validation and the AQL tools run offline. Only the REST clients need a CDR.
openEHR is an open specification for an electronic health record. Clinical content is modelled on two levels: a stable Reference Model that every record shares, and archetypes that constrain it for one purpose. Platform operations like creating an EHR, uploading a template, and running a query come from the Service Model. This SDK is a Go client for that platform's REST binding, ITS-REST. Its typed clients are written against the Release-1.1.0 OpenAPI files vendored in the repository, so it can talk to any clinical data repository (CDR) that implements them.
Go developers new to openEHR, and openEHR developers new to Go. It was written with a few kinds of consumer in mind: benchmark and load tools running high-concurrency CRUD, synthetic data seeders that drive bulk Compositions from a template, MCP servers that forward the caller's token, federative clients that fan out over several CDRs, and SMART-on-openEHR apps with a Go backend.
You do not have to adopt the whole module. If the job only needs one building-block package, import that one.
Reference Model types, codecs, validation, templates, and AQL are ordinary Go
packages, and none of them reaches for transport/ or auth/. A CI job that
validates a Composition takes no network dependency.
The public surface reads like any other Go module: short package names, constructors that return errors, and plain types you pass around. There is no framework to adopt first.
Compositions and data values are generated Go structs, not maps of strings.
After a decode you read c.Name and len(c.Content), and the compiler catches
a misspelt field.
Parse an ADL 1.4 operational template (OPT), compile it, and validate a Composition against it before anything reaches a CDR.
Archetype Query Language (AQL) queries are ordinary values here. Build one from structs or parse one from text, then lint it against a compiled template before you send it.
SMART-on-openEHR, client credentials, JWT bearer, and HTTP Basic all implement
auth.TokenSource. Attach one to the client, or override it for a single
request.
Decode canonical JSON, parse an OPT, validate a Composition, and build or lint AQL, all without going near the network.
The REST client packages cover EHR, composition, query, and definition. Point them at the in-process mock the examples use, or at a live openEHR REST deployment.
go get github.com/cadasto/openehr-sdk-go@v0.38.0
var c rm.Composition
if err := canjson.Unmarshal(body, &c); err != nil {
log.Fatal(err)
}
fmt.Println(c.ArchetypeNodeID, c.Category.Value, len(c.Content))
Requires Go 1.27 or newer. The SDK is pre-1.0, so pin an exact tag: a minor release can change the public API.