Openmrs database structure

Hi everyone, may I ask where can I find the database tables structure of the openmrs-core or openmrs?

Hello @a1p1p1998

At the foundational heart of the openmrs database schema is its data model containing a couple of domains like patient,observations,encounter,concepts which dictates the scalability and flexibility of a system. All the other tables in the schema are built relating to these domains forexample visit attributes, location attributes, person attributes, etc? Attributes (like person, provider, and location attributes) exist specifically to allow implementations to extend the data model without changing the database structure.

The relationship between these domain objects and database tables are mapped using a mixture of Hibernate annotations and XML files or annotation based mappings with liquibase to manage relational database changes in a database-independent way.All this is abstracted in the openmrs Data Access layer which abstracts the actual data model and its changes, this layer is exposed to the service layer through interfaces.

5 Likes

Hey @a1p1p1998 you can also see all Openmrs Database Tables, how they are linked from the site: OpenMRS Data Models

just search for the table you want to see from the search bar at the top of the page

3 Likes

Thanks! Now I know the structure.

Thanks, could I find the explanations of fields or tables?

2 Likes

@a1p1p1998
Fields are basically characteristics for a particular java class, the field eg patient field in an encounter class and also the entity class can use fields to relate with other entity classes eg patient field in the encounter class, fields could also be termed as attributes in OpenMRS. These fields hold data for the different object instances of a class which are stored as rows in the respective tables of the openmrs database.

The tables are a result of the different classes defined in openmrs forexample the concept class will have a corresponding concept table in the database and as you can see the fields in the class are the columns in the table which gives a perfect design of a relation database management system. This mapping between the classes with their fields and their tables and columns is being done by ORM layer implemented and persisted by JPA which does management for persistence and object/relational mapping.

3 Likes

You helped me understand them better, thanks!

1 Like