Skip to Content
AnalyticsdbtData Models

Data Models

nhic_dbt organises all transformation logic into four layers. Each layer has a single responsibility — raw ingestion, business logic, conformed analytics, or BI-ready views. Data flows strictly forward: staging feeds intermediate, intermediate feeds DWH, DWH feeds reporting.

Staging schema: staging materialized: table

The staging layer is the first landing zone for raw source data. Each source system has its own subdirectory under models/staging/, and models in this layer map closely to the source schema.

Rules for staging models:

  • No business logic. Cleaning only — cast types, normalise nulls, apply cleaning macros.
  • One model per source table or entity.
  • All models materialise as tables so downstream layers always query pre-built data.

Source subdirectories: cemr/, crvs/, ebuzima/, efiche/, hmis_tracker/, hpemr/, idsr_dhis2/, immunization/, moh_rhmis/, seeds/.

-- Example: a typical staging model select {{ clean_key_integer('patient_id') }} as patient_id, {{ clean_text('first_name') }} as first_name, {{ clean_date('date_of_birth') }} as date_of_birth, {{ clean_key_text('facility_code') }} as facility_code from {{ source('cemr', 'patients') }}

Staging source systems

SourceDirectoryDescription
HMIS Trackerhmis_tracker/Facility-level health program tracking via DHIS2
eFICHEefiche/Outpatient clinical records
CRVScrvs/Civil registration and vital statistics
EBUZIMAebuzima/Maternal health system
HPEMRhpemr/Health post electronic medical records
IDSR / DHIS2idsr_dhis2/Integrated disease surveillance and response
Immunizationimmunization/National immunization tracker
MOH RHMISmoh_rhmis/Routine health management information system
CEMRcemr/Central electronic medical records
Seedsseeds/Static reference and lookup data
Last updated on