Skip to content

← All contracts

OHN-56 Public Health

Version
1.0.0
OpenAPI
3.1.0
Source in the repository
modules/OHN-56/api/openapi.yaml
Servers
https://opeshealthnetwork.com
Authentication
bearer: http bearer (JWT)

Download the contract (YAML)

Contracts are written in English.

Disease surveillance and outbreak alerts, civil registration links, pharmacovigilance, disease registries and national analytics. Every call except health needs a Bearer token (platform gateway, ES256, audience ohn-56) whose role and purpose match (each role has exactly one purpose). Every POST needs an Idempotency-Key header (1-255 characters, not blank). Request bodies are strict: unknown fields, wrong types or out-of-range values are 422 domain_validation_failed. Errors are {error, message, ...extra} (application/problem+json carrying the same fields plus type, title, status, detail, trace_id). Policy (small-cell k, ADR signal threshold, notifiable conditions and their thresholds) is configuration with no built-in defaults: unset policy refuses the dependent call (409 policy_not_configured). Synthetic data only.

Operations

config

GET/api/ohn/v1/public-health/settingsJurisdiction settings (admin, surveillance_officer, ministry_analyst, pv_reviewer)

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: Settings
POST/api/ohn/v1/public-health/settingsSet k and the ADR signal threshold (public_health_admin)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
200Saved—
409version_conflict—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—
GET/api/ohn/v1/public-health/surveillance/conditionsNotifiable conditions (surveillance_officer, admin, ministry_analyst)

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
POST/api/ohn/v1/public-health/surveillance/conditionsCreate or replace a condition by code (public_health_admin)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
200Saved—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—
GET/api/ohn/v1/public-health/surveillance/areasFacility to reporting area map (surveillance_officer, admin)

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK—
POST/api/ohn/v1/public-health/surveillance/areasPlace a facility in an area (public_health_admin)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
200Saved—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—

surveillance

POST/api/ohn/v1/public-health/surveillance/syncCount cases from OHN-11 results and OHN-09/OHN-10 diagnoses; raise or update alerts (surveillance_officer, admin)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
200Completed run
application/json: SyncResult
409No active condition configured (policy_not_configured)—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—
503dependency_unavailable or not_configured (503; names the dependency; nothing stored). Also 503 not_configured with setting OHN56_WRITES_DISABLED while the operator kill switch is on.—
GET/api/ohn/v1/public-health/surveillance/sync-runsLast 50 counting runs

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK—
GET/api/ohn/v1/public-health/surveillance/case-countsDistinct-patient case counts by condition, area and week (surveillance_officer)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
weeksquerystringnoWeeks 1-52 (default 8; 0 means the default).
conditionquerystringno

Responses

CodeDescriptionMedia type
200OK—
404Unknown condition—
GET/api/ohn/v1/public-health/surveillance/alertsOutbreak alerts (surveillance_officer)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
statequerystringnoExact state; any string up to 32 characters is accepted (an unknown state matches nothing).

Responses

CodeDescriptionMedia type
200OK
GET/api/ohn/v1/public-health/surveillance/alerts/{id}

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200Alert with history—
404Not found—
POST/api/ohn/v1/public-health/surveillance/alerts/{id}/transitionsTriage (open->investigating|dismissed, investigating->confirmed_outbreak|dismissed, confirmed_outbreak->closed)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
200Moved—
404Not found—
409version_conflict—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—

civil-registration

GET/api/ohn/v1/public-health/civil-registration/noticesNotices (reporter_clinician own organisation; surveillance_officer all)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
kindquerystringno
statequerystringno

Responses

CodeDescriptionMedia type
200OK—
POST/api/ohn/v1/public-health/civil-registration/noticesRecord a birth or death notification (reporter_clinician). Subject and mother checked in OHN-03; birth event in OHN-12.

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
201Recorded—
409A live notice exists—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—
503dependency_unavailable or not_configured (503; names the dependency; nothing stored). Also 503 not_configured with setting OHN56_WRITES_DISABLED while the operator kill switch is on.—
GET/api/ohn/v1/public-health/civil-registration/notices/{id}

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200Notice with history—
404Not found—
POST/api/ohn/v1/public-health/civil-registration/notices/{id}/outcomeRecord the civil registration answer

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
200Recorded—
404Not found—
409version_conflict—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—

pharmacovigilance

GET/api/ohn/v1/public-health/pharmacovigilance/reportsADR reports (patient own; clinician own organisation; pv_reviewer all)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
statequerystringno

Responses

CodeDescriptionMedia type
200OK—
POST/api/ohn/v1/public-health/pharmacovigilance/reportsReport an adverse drug reaction (reporter_clinician, patient). Optional OHN-50 prescription link must match patient and medicine.

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
201Recorded—
403Patient reporting for someone else—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—
503dependency_unavailable or not_configured (503; names the dependency; nothing stored). Also 503 not_configured with setting OHN56_WRITES_DISABLED while the operator kill switch is on.—
GET/api/ohn/v1/public-health/pharmacovigilance/reports/{id}

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200Report with history—
404Not found—
POST/api/ohn/v1/public-health/pharmacovigilance/reports/{id}/reviewReview (pv_reviewer, not the reporter). assessed requires causality.

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
200Reviewed—
403Own report—
409version_conflict—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—
GET/api/ohn/v1/public-health/pharmacovigilance/signalsSignal counts per medicine and reaction (pv_reviewer)

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK—

registries

GET/api/ohn/v1/public-health/registriesRegistry catalog with counts (sensitive counts hidden from surveillance_officer)

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK—
GET/api/ohn/v1/public-health/registries/{registry}/entriesEntries. HIV/TB - 403 segmented_registry for surveillance_officer; consent re-checked per entry; withheld count returned.

Authentication: bearer

Parameters

NameInTypeRequiredDescription
registrypath"sickle_cell" | "hiv" | "tb" | "cancer" | "maternal"yes
statusquerystringno

Responses

CodeDescriptionMedia type
200OK—
403Segmented—
503dependency_unavailable or not_configured (503; names the dependency; nothing stored). Also 503 not_configured with setting OHN56_WRITES_DISABLED while the operator kill switch is on.—
POST/api/ohn/v1/public-health/registries/{registry}/entriesEnrol (registry_steward, reporter_clinician). HIV/TB need an OHN-15 permit.

Authentication: bearer

Parameters

NameInTypeRequiredDescription
registrypath"sickle_cell" | "hiv" | "tb" | "cancer" | "maternal"yes
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
201Enrolled—
403consent_denied—
409Already enrolled—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—
GET/api/ohn/v1/public-health/registries/{registry}/entries/{id}

Authentication: bearer

Parameters

NameInTypeRequiredDescription
registrypath"sickle_cell" | "hiv" | "tb" | "cancer" | "maternal"yes
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200Entry with history—
403Segmented or consent denied—
404Not found—
POST/api/ohn/v1/public-health/registries/{registry}/entries/{id}/statusChange status (deceased and closed are final)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
registrypath"sickle_cell" | "hiv" | "tb" | "cancer" | "maternal"yes
idpathstring (uuid)yes
Idempotency-KeyheaderstringyesNot blank, 1-255 characters. The same key with the same body replays the first answer (Idempotent-Replay: true); with another body it is 409 idempotency_conflict.

Request body (required)

Responses

CodeDescriptionMedia type
200Changed—
403Segmented or consent denied—
404Not found—
409version_conflict—
422domain_validation_failed (details: first failing check per top-level field as a zod issue code, unknown fields under _) or a named refusal (patient_not_found, birth_event_not_linked, mother_mismatch, prescription_not_found, prescription_mismatch, medicine_mismatch, ...)—

analytics

GET/api/ohn/v1/public-health/analytics/dashboardAggregates with small-cell suppression (ministry_analyst, admin). 409 when k is not configured.

Authentication: bearer

Parameters

NameInTypeRequiredDescription
weeksquerystringnoWeeks 1-52 (default 12).

Responses

CodeDescriptionMedia type
200OK
application/json: Dashboard
409policy_not_configured—
GET/api/ohn/v1/public-health/analytics/{dataset}/exportCSV export of one dataset (ministry_analyst)

Authentication: bearer

Parameters

NameInTypeRequiredDescription
datasetpath"cases" | "alerts" | "registries" | "adr" | "civil"yes
weeksquerystringnoWeeks 1-52 (default 12).

Responses

CodeDescriptionMedia type
200CSV
text/csv: string
409policy_not_configured—

Other operations

GET/health/ohn-56Health and dependency modes

Responses

CodeDescriptionMedia type
200OK: status, module, dependencies (mode per OHN-03, 09, 10, 11, 12, 15, 50), writes_enabled, auth_configured
application/json: Health
503Database unavailable—
GET/api/ohn/v1/public-health/contextCaller role, purpose, dependency modes, settings and allowed actions (all roles)

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK
application/json: object
401Missing or invalid token—
GET/api/ohn/v1/public-health/auditLast 200 audit records (public_health_admin)

Authentication: bearer

Responses

CodeDescriptionMedia type
200OK—

Schemas

Code

Trimmed before validation.

string

Health

NameTypeRequiredDescription
statusstringno
module"OHN-56"no
dependenciesobjectno

Settings

Unset values are null and version 0; configured is true once small_cell_k is set.

NameTypeRequiredDescription
small_cell_kinteger | nullno
adr_signal_thresholdinteger | nullno
versionintegerno
updated_atstring | null (date-time)no
configuredbooleanno

SettingsCommand

NameTypeRequiredDescription
small_cell_kinteger | nullyes
adr_signal_thresholdinteger | nullyes
expected_versionintegeryes

ConditionCommand

At least one diagnosis code or result report type is required (422 on diagnosis_codes otherwise).

NameTypeRequiredDescription
codeCodeyesTrimmed before validation.
namestringyestrimmed
diagnosis_codesarray of Codeyes
result_report_typesarray of Codeyes
positive_interpretationsarray of stringyesStored lower-case; a result counts when its source_interpretation (lower-cased) is listed, or always when the list is empty.
threshold_countinteger | nullyesDistinct patients per area and ISO week that raise an alert; null means cases are counted but never alert.
activebooleanyes

Condition

NameTypeRequiredDescription
codeCodeyesTrimmed before validation.
namestringyestrimmed
diagnosis_codesarray of Codeyes
result_report_typesarray of Codeyes
positive_interpretationsarray of stringyesStored lower-case; a result counts when its source_interpretation (lower-cased) is listed, or always when the list is empty.
threshold_countinteger | nullyesDistinct patients per area and ISO week that raise an alert; null means cases are counted but never alert.
activebooleanyes
idstring (uuid)no
versionintegerno

SyncResult

NameTypeRequiredDescription
sync_run_idstring (uuid)no
state"completed"no
sincestring (date)no
countsobjectno

AlertState

"open" | "investigating" | "confirmed_outbreak" | "dismissed" | "closed"

Alert

NameTypeRequiredDescription
idstring (uuid)no
condition_codestringno
area_codestringno
week_startstring (date)no
case_countintegerno
thresholdintegerno
stateAlertStateno
versionintegerno
allowed_transitionsarray of stringno

CivilNoticeCommand

A death needs cause_of_death_code and takes no mother or birth event; a birth takes no cause. event_date cannot be in the future (422).

NameTypeRequiredDescription
kind"birth" | "death"yes
subject_patient_idstring (uuid)yes
mother_patient_idstring (uuid)nobirths only
ohn12_birth_event_idstring (uuid)nobirths only
event_datestring (date)yes
place_facility_idstring (uuid)yes
cause_of_death_codeCodenorequired for deaths
notification_channel"electronic" | "paper_form" | "courier"yes
notification_refstringyes

AdrCommand

NameTypeRequiredDescription
patient_idstring (uuid)norequired for clinicians; a patient may only name themselves
prescription_idstring (uuid)no
medicine_codeCodeyesTrimmed before validation.
medicine_displaystringyes
reaction_codeCodeyesTrimmed before validation.
reaction_descriptionstringyes
onset_datestring (date)yescannot be in the future
seriousness"non_serious" | "serious"yes
outcome"recovered" | "recovering" | "not_recovered" | "fatal" | "unknown"yes

EnrolCommand

NameTypeRequiredDescription
patient_idstring (uuid)yes
diagnosis_datestring (date)yescannot be in the future
facility_idstring (uuid)yes
detailsobjectyes

Dashboard

NameTypeRequiredDescription
kintegerno
weeksintegerno
aggregates_onlytrueno
datasetsobjectno

get-api-ohn-v1-public-health-surveillance-conditions.response-200 defined inline

NameTypeRequiredDescription
itemsarray of Conditionno

post-api-ohn-v1-public-health-surveillance-areas.request defined inline

NameTypeRequiredDescription
facility_idstring (uuid)yes
area_codeCodeyesTrimmed before validation.
area_namestringyes

post-api-ohn-v1-public-health-surveillance-sync.request defined inline

NameTypeRequiredDescription
sincestring (date)noDefault: the last OHN56 sync look-back (configuration, 56 days).

get-api-ohn-v1-public-health-surveillance-alerts.response-200 defined inline

NameTypeRequiredDescription
itemsarray of Alertno

post-api-ohn-v1-public-health-surveillance-alerts-id-transitions.request defined inline

NameTypeRequiredDescription
to_stateAlertStateyes
notestringyes
expected_versionintegeryes

post-api-ohn-v1-public-health-civil-registration-notices-id-outcome.request.option-1 defined inline

NameTypeRequiredDescription
outcome"registered"yes
civil_registration_refstringyes
expected_versionintegeryes

post-api-ohn-v1-public-health-civil-registration-notices-id-outcome.request.option-2 defined inline

NameTypeRequiredDescription
outcome"rejected"yes
reasonstringyes
expected_versionintegeryes

post-api-ohn-v1-public-health-pharmacovigilance-reports-id-review.request defined inline

NameTypeRequiredDescription
to_state"under_review" | "assessed" | "rejected"yes
causality"certain" | "probable" | "possible" | "unlikely" | "unclassifiable"norequired when to_state is assessed
notestringyes
expected_versionintegeryes

post-api-ohn-v1-public-health-registries-registry-entries-id-status.request defined inline

NameTypeRequiredDescription
status"active" | "in_remission" | "transferred_out" | "lost_to_follow_up" | "deceased" | "closed"yes
notestringyes
expected_versionintegeryes