Skip to content

← All contracts

OHN-59 Medication Safety Knowledge

Version
1.1.0
OpenAPI
3.1.0
Source in the repository
modules/OHN-59/api/openapi.json
Servers
https://opeshealthnetwork.com/api/ohn/v1/medication-safety
Authentication
bearer: http bearer

Download the contract (JSON)

Contracts are written in English.

Server paths are under /api/ohn/v1/medication-safety. Reconciled to the observed TypeScript behaviour (docs/program/java/ohn-59-contract-changes.md). Default deny: role AND purpose of use must match. Request bodies are strict (unknown fields are 422); the service validates them and answers 422 domain_validation_failed with details.

Operations

OHN-59

GET/knowledge/activeActive knowledge version of the jurisdiction (configured:false when none)

Operation ID: getActiveKnowledge

Authentication: bearer

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/knowledge/versionsKnowledge versions, newest first

Operation ID: listVersions

Authentication: bearer

Parameters

NameInTypeRequiredDescription
statequery"draft" | "in_review" | "active" | "retired"no

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/knowledge/versionsCreate a draft knowledge version from a document (F001)

Operation ID: createVersion

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.CreateVersionCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
201Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/knowledge/versions/load-demoLoad the labelled synthetic demo set as a draft (non-production only, OHN59_ALLOW_DEMO_KNOWLEDGE)

Operation ID: loadDemoKnowledge

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.EmptyCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
201Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/knowledge/versions/{id}One version with settings and next actions

Operation ID: getVersion

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/knowledge/versions/{id}/entriesBrowse and search a section of a version

Operation ID: listEntries

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
sectionquery"medications" | "classes" | "memberships" | "allergy_cross_reactivity" | "interactions" | "dose_ranges" | "pregnancy" | "duplicate_groups" | "lab_contraindications"yes
qquerystringno
offsetqueryintegerno
limitqueryintegerno

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/knowledge/versions/{id}/diffDifference to the previous (or a chosen) version

Operation ID: diffVersion

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
againstquerystring (uuid)no

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/knowledge/versions/{id}/historyState change history of a version

Operation ID: versionHistory

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/knowledge/versions/{id}/submitSubmit a draft for review (needs a clean validation report)

Operation ID: submitVersion

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.SubmitCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/knowledge/versions/{id}/approveSecond-person approval and activation

Operation ID: approveVersion

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.ApproveCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/knowledge/versions/{id}/rejectSend an in-review version back to draft

Operation ID: rejectVersion

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.ReasonCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/knowledge/versions/{id}/retireRetire the active version

Operation ID: retireVersion

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.ReasonCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/knowledge/importersImport formats and the CSV column contract

Operation ID: listImporters

Authentication: bearer

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/knowledge/importsImports of the jurisdiction (latest 100)

Operation ID: listImports

Authentication: bearer

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/knowledge/importsImport a licensed knowledge export as a draft version

Operation ID: runImport

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.ImportCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
201Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/knowledge/imports/{id}One import with its validation report

Operation ID: getImport

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/checks/evaluateMedication safety check for a patient (live)

Operation ID: evaluateCheck

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.EvaluateCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/checks/simulateCheck with typed hypothetical facts on any version (no patient read)

Operation ID: simulateCheck

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.SimulateCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/checks/evaluationsStored evaluations of the jurisdiction

Operation ID: listEvaluations

Authentication: bearer

Parameters

NameInTypeRequiredDescription
modequery"live" | "simulation"no
limitqueryintegerno

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/checks/evaluations/{id}One stored evaluation and its outcome

Operation ID: getEvaluation

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/checks/evaluations/{id}/outcomeRecord what the prescriber did with a live evaluation (once)

Operation ID: recordOutcome

Authentication: bearer

Parameters

NameInTypeRequiredDescription
idpathstring (uuid)yes
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.OutcomeCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
201Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/reportsReport catalog

Operation ID: listReports

Authentication: bearer

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/reports/{reportId}Run a report (R001 coverage, R002 warnings, R003 change ledger)

Operation ID: runReport

Authentication: bearer

Parameters

NameInTypeRequiredDescription
reportIdpath"OHN-59-R001" | "OHN-59-R002" | "OHN-59-R003"yes
version_idquerystring (uuid)no
fromquerystringno
toquerystringno

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/reports/{reportId}/exportSigned CSV export (HMAC-SHA256 in X-OHN59-Signature)

Operation ID: exportReport

Authentication: bearer

Parameters

NameInTypeRequiredDescription
reportIdpath"OHN-59-R001" | "OHN-59-R002" | "OHN-59-R003"yes
version_idquerystring (uuid)no
fromquerystringno
toquerystringno

Responses

CodeDescriptionMedia type
200Success
text/csv: string
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
GET/auditLatest 200 audit records of the jurisdiction

Operation ID: listAudit

Authentication: bearer

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—
POST/admin/outbox/relayReport the pending outbox (delivery is done by the platform relay)

Operation ID: relayOutbox

Authentication: bearer

Parameters

NameInTypeRequiredDescription
Idempotency-Keyheaderstringyes

Request body

Strict JSON object, documented by components.schemas.EmptyCommand; validated by the service (unknown fields are 422).

  • application/json: object

Responses

CodeDescriptionMedia type
200Success
application/json: Result
400Malformed request or missing Idempotency-Key—
401Unauthenticated—
403Denied by policy (role, purpose, second person, test checks disabled)—
404Not found in the caller's jurisdiction—
409Version conflict, invalid transition, validation failed or idempotency mismatch—
413Payload too large—
422Domain validation failed
application/json: Error
429Rate limited—
503Not configured or dependency unavailable (fail closed)—

Schemas

Result

object

Error

NameTypeRequiredDescription
errorstringyes
messagestringno
detailsobjectno

EmptyCommand

object

CreateVersionCommand

NameTypeRequiredDescription
documentKnowledgeDocumentyesSections are arrays of strict objects, validated by the service (see docs/program/java/ohn-59-analysis.md and modules/OHN-59/docs/import-contract.md). source.kind synthetic_demo is refused here.

KnowledgeDocument

Sections are arrays of strict objects, validated by the service (see docs/program/java/ohn-59-analysis.md and modules/OHN-59/docs/import-contract.md). source.kind synthetic_demo is refused here.

NameTypeRequiredDescription
labelstringyes
noticestringyes
sourceobjectyes
settingsobjectyes
medicationsarray of objectyes
classesarray of objectyes
membershipsarray of objectyes
allergy_cross_reactivityarray of objectyes
interactionsarray of objectyes
dose_rangesarray of objectyes
pregnancyarray of objectyes
duplicate_groupsarray of objectyes
lab_contraindicationsarray of objectyes

SubmitCommand

NameTypeRequiredDescription
expected_row_versionintegeryes
notestringno

ApproveCommand

NameTypeRequiredDescription
expected_row_versionintegeryes
approval_refstringyes
notestringno

ReasonCommand

NameTypeRequiredDescription
expected_row_versionintegeryes
reasonstringyes

ImportCommand

NameTypeRequiredDescription
format"ohn59.csv.v1" | "ohn59.json.v1"yes
labelstringyes
noticestringno
sourceImportCommand.sourceyes
settingsobjectno
filesobjectnoohn59.csv.v1: one CSV text per section
documentanynoohn59.json.v1: knowledge sections

EvaluateCommand

NameTypeRequiredDescription
patient_idstring (uuid)yes
proposedarray of objectyes
contextobjectno
checksarray of "knowledge_coverage" | "allergy" | "interaction" | "dose" | "pregnancy" | "breastfeeding" | "duplicate_therapy" | "lab_contraindication"no
callerobjectno
acting_forEvaluateCommand.acting_forno

SimulateCommand

NameTypeRequiredDescription
version_idstring (uuid)yes
factsobjectyes
proposedarray of objectyes
checksarray of stringno

OutcomeCommand

NameTypeRequiredDescription
action"signed" | "abandoned" | "changed"yes
overridesarray of OutcomeCommand.overrides.itemno

ImportCommand.source defined inline

NameTypeRequiredDescription
namestringyes
versionstringyes
licence_refstringyes

EvaluateCommand.acting_for defined inline

NameTypeRequiredDescription
principal_idstring (uuid)yes
organization_idstring (uuid)yes

OutcomeCommand.overrides.item defined inline

NameTypeRequiredDescription
warning_idstringyes
reasonstringyes