# Database Schema

For a conceptual overview, see the DbStructure page.

For the actual Postgres table layouts, refer to the following formats (generated via PG autodoc):

- HTML (cautions below): release, devel (v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18)
- DIA: release, devel (does not yet support auto-arrangement)
- DIA (ZigZag style): release, devel (does not yet support auto-arrangement)
- DOT: release, devel
- PNG (entire database): release, devel (v16)
  - Cave: This is large (as in LARGE).

Cautions about the HTML output:

- lists foreign key references, but does not show the ON UPDATE/DELETE behaviour (available in the `/server/sql/` files)
- lists formal COMMENT ON ... entries, but not the in-line commenting from the sql files
- does not show multicolumn UNIQUE constraints -- for example 'unique (id_patient, description)' for the table clin.health_issue
- does not show inheritance, though it can be inferred when fields interposed above a table's primary key field (available in the `/server/sql/` files)

Or else you could take a look at dumps of the public database (again, generated daily):

- the schema of the database
- the data in the database
- or download a tarball of both

To get down to the nitty-gritty details you might want to take a look at

- the SQL scripts directly in our public Git tree

which are used to bootstrap the database.

Also available:

- a link to a thread on the developer's newsgroup, discussing OpenEHR and how its models might in future be adopted
- a table giving (as at v16) an indication of the principal clinical data in GNUmed: CareRelatedTablesV16