Kweli HIM event mediator - OpenHIM mediator for the Kweli Health Information Messaging platform (fork of SoftmedTanzania/nhcr-mediator)
# Kweli HIM Event Mediator
An OpenHIM mediator for the Kweli Health Information Messaging platform. It receives domain events (patient, encounter, clinical decision support, referral, laboratory, imaging, and more), validates them against the Kweli JSON Schemas, stamps the receiving tier, and forwards them to the configurable event sink.
## 1. Dev Requirements
1. Java 1.8
2. IntelliJ or Visual Studio Code
3. Maven 3.6.3
## 2. Mediator Configuration
The mediator exposes a generic event intake route and explicit routes for high-value event types.
### Event Intake
All event types can be submitted to the generic intake route:
```
POST /kweli/event
```
Each payload is a Kweli event envelope carrying the cross-cutting metadata plus the domain payload:
```json
{
"schema_version": "kweli-event-1.0",
"event_id": "b0aef8f0-2d3b-4b2f-8f5e-9d1c2e3f4a5b",
"event_type": "cds.recommendation_generated",
"event_timestamp": "2026-08-08T10:15:30.000+03:00",
"facility_hfr_code": "102001-8",
"network_tier": "facility",
"event_data": {
"recommendation_id": "rec-0001",
"recommendation_type": "antibiotic_prescribing",
"guideline_version": "2024.1",
"generated_at": "2026-08-08T10:15:31.000+03:00",
"rationale": "Patient meets the criteria for the recommendation."
}
}
```
Explicit routes exist for every event type in the CDS and Referral domains, e.g.:
```
POST /kweli/cds/recommendation-generated
POST /kweli/cds/alert-triggered
POST /kweli/referral/initiated
POST /kweli/referral/lost-to-followup
```
The envelope is validated against `schemas/envelope.schema.json` and the payload against the schema registered for the event type in `event-registry.json` (105 event types across 12 domains). On success the event is forwarded to the sink.
### 3 Configuration Parameters
The configuration parameters specific to the mediator and destination system can be found at
`src/main/resources/mediator.properties`
```
mediator.name=Kweli-HIM
mediator.host=localhost
mediator.port=3014
mediator.t …