DAWN Report Builder — Schema & joins

← Report builder

How the report engine assembles a patient report: the Patient → Treatment plan → Treatment spine with every lookup table joined off it. Hover a table to light up its joins; click it to pin it and list all its fields. Click again (or the background) to clear.

Spine (Patient / Plan / Treatment) Lookup table Derived / conditional (dashed)
What this shows (and what it doesn't)

Built directly from PatReg in App_Code/ReportService.cs — the registry the engine uses to build its house-style RIGHT-join FROM. Only the tables needed for a given report are joined at run time; this map shows the full set of possible joins.

Field lists come from all_tables_extracted.txt (a snapshot of the dbo schema). They're embedded in this page, so if the database schema changes they won't update on their own. PK = primary key, FK = foreign key, join = a key used by the joins shown above.

Treatment is an OUTER APPLY for the latest reading in list reports, and a real RIGHT JOIN at reading grain in count reports. DoseHCP and LMWHDrug attach to that apply (shown dashed).

Derived tables (PatAdded, PlanStopped) are pre-aggregated SysWorkflowLog sub-selects joined in so they can be grouped on, not physical tables.

Not shown: the separate report spines (Audit trail / Tbl_Change, Interface log, Questionnaire) and the many lookups pulled via correlated sub-queries rather than the FROM pyramid (patient drugs, events, allergies, quick notes, secondary diagnoses).