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
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
| Source | Directory | Description |
|---|---|---|
| HMIS Tracker | hmis_tracker/ | Facility-level health program tracking via DHIS2 |
| eFICHE | efiche/ | Outpatient clinical records |
| CRVS | crvs/ | Civil registration and vital statistics |
| EBUZIMA | ebuzima/ | Maternal health system |
| HPEMR | hpemr/ | Health post electronic medical records |
| IDSR / DHIS2 | idsr_dhis2/ | Integrated disease surveillance and response |
| Immunization | immunization/ | National immunization tracker |
| MOH RHMIS | moh_rhmis/ | Routine health management information system |
| CEMR | cemr/ | Central electronic medical records |
| Seeds | seeds/ | Static reference and lookup data |
Last updated on