Encounter ER Diagram

Each form saves its data to its own table; however, metadata about this encounter is also saved to the encounters table. There's a one-to-one relationship between the form's table - or form-backed table - and its record in the encounters table. The following screenshot shows the relationship between the arvregimen table - which persists data submitted by the ARV Regimen form - and the encounter table:

ARV model

Another example is on the Dynasite - Zcore Form Rendering page.

The form-backed tables are in the App schema in the standalone and in the zeprs database in the server (MySQL) version.

The Saving records page has details on how records are saved and provides additional insight on the relationship between the encounter table and form-backed tables.

The following diagram is outdated - it does not reflect the mapping between encounters and forms.

The table encounter_record is now named encounter, and encounter_value is no longer used. The tables chart and patient_labs are also no longer used.

Some history: back when an earlier version of ZEPRS, called PTS, was deployed, all data was stored in the bit bucket - encounter_value.. It was really hard to do reports from this data store directly - you had to either create very complex SQL statements ot generate a reporting database in a star-schema in order to run reports. It has been much easier to run with the form-backed tables concept, and since the system manages metadata about fields that are shared across tables, it is not hard to query similar fields stored in different tables.

There's a one-to-one relationship between patient and patient_status. The table patient_status holds current, often changing data abou tthe patient; whereas the patient tables is for more long-term data.

Note the relationship between patient and encounter_record (now encounter).

encounter erd
Click image for full version