Database Structure Documentation

database
question

(Sandro) #1

Hello everybody,

I’m new to OpenEMR and are trying to make some database-based analytics.
My Question is where I can find a database description of the most recent OpenEMR (5.0.x), including the DB-structure but especially references (like foreign keys) between the tables of the openemr database.

So I was able to find thishttps://www.open-emr.org/wiki/index.php/Database_Structure in the OpenEMR wiki which points out to https://www.open-emr.org/wiki/index.php/File:OpenEmrOriginalSchema.pdf. This helps a lot, however unfortunately this is kind of outdated as it refers to OpenEMR 3.2.0. Additionally I was able to find the table descriptions for OpenEMR 4.1.1 here https://sourceforge.net/p/openemr/discussion/202506/thread/d7ae8282/?limit=25#b456 which refers to https://sourceforge.net/p/openemr/discussion/202506/thread/d7ae8282/73d3/attachment/dbschemaOEMR.pdf from 2013.

I tried to reverse engineer the db scheme, but it looks like there are no explicit FOREIGN KEYs between the tables (but only INDEXes or KEYs). Is there some documentation showing the structure and relationship of the openemr db, preferable of the most recent OpenEMR (5.0.x) ?

However if there is no such a thing, maybe there are some information to start with, it would be hard for me to start from scratch creating this, as I don’t have much insight into OpenEMR yet.

Thank you and best Regards

SandMaen


(Robert Down, BSN, RN) #2

Hi @sandmaen,

Welcome to our community! Unfortunately, DB documentation is an area we could greatly improve on. A while back I used a tool to create a graph of the DB but as you’ve rightly concluded, without true foreign keys graphs don’t do much.

@sunsetsystems is there historical context for not using more foreign keys in the DB? Is this something we could consider introducing?


(Rod Roark) #3

Back in the old days MySQL did not support foreign keys. I think it’s safe now to put them to good use.


(Sandro) #4

OK I understand. Thank you very much for your answer. I appreciate that.
What would be the preferred way to improve the documentation here?

BR
SandMaen