← All contracts
OHN-52 Paper Health Record Digitisation
- Version
- 1.0.0
- OpenAPI
- 3.1.0
- Source in the repository
modules/OHN-52/api/openapi.yaml- Servers
https://opeshealthnetwork.com
- Authentication
bearer: http bearer (JWT)
Download the contract (YAML)
Contracts are written in English.
Digitise patient-held paper health booklets. Every mutation needs `Idempotency-Key` (any non-empty value up to 255 characters); every request a Bearer token
(role, jurisdiction, organization_id, purpose; subject, jurisdiction and organization are UUIDs, otherwise 401). Default deny: an unknown route is 404 after authentication, a role that is not listed for
the route is 403 `denied_by_policy` (audited), and a purpose that is not the role's own is 403. Digitised items are never verified. Page images are kept as originals in OHN-13 (required: no original, no upload);
recognition proposes items only when an extraction engine is configured, and every proposal needs a person's decision. Without an engine every page fails closed (`failure_reason: not_configured`) and the reviewer
transcribes by hand (`POST /jobs/{id}/items`). 503 `not_configured` (with `dependency` and `setting`) means a required dependency or key is not configured and nothing was stored.
Operations
jobs
GET/api/ohn/v1/digitisation/jobsList jobs in scope
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
state | query | string | no | Any state name up to 32 characters; an unknown name lists nothing. |
patient_id | query | string (uuid) | no | |
Responses
| Code | Description | Media type |
|---|
200 | OK | |
POST/api/ohn/v1/digitisation/jobsUpload booklet pages with consent (F001, W001)
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
Idempotency-Key | header | string | yes | |
Request body (required)
Responses
| Code | Description | Media type |
|---|
201 | Job created | |
400 | Missing idempotency key or malformed body | — |
403 | patient_self_only, consent_denied (OHN-15), or role not permitted | — |
409 | Idempotency key reused with another payload | — |
413 | Body larger than OHN52_MAX_UPLOAD_BODY | — |
422 | domain_validation_failed, consent_method_invalid, type_mismatch, page_too_large, unsupported_type, image_too_many_pixels, pdf_active_content, image_corrupt | — |
429 | Rate limited | — |
503 | OHN-13 or OHN-15 unavailable or unconfigured; nothing stored | — |
GET/api/ohn/v1/digitisation/jobs/{id}Job detail (patients see items only after completion, never OCR text)
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string (uuid) | yes | |
Responses
| Code | Description | Media type |
|---|
200 | OK | |
404 | Not in scope | — |
GET/api/ohn/v1/digitisation/jobs/{id}/pages/{pageId}/imagePage image (metadata stripped); viewing is audited
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string (uuid) | yes | |
pageId | path | string (uuid) | yes | |
Responses
| Code | Description | Media type |
|---|
200 | Image | image/png
image/jpeg
application/pdf
|
404 | Not in scope | — |
review
POST/api/ohn/v1/digitisation/jobs/{id}/itemsAdd an item the engine missed (F003)
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string (uuid) | yes | |
Idempotency-Key | header | string | yes | |
Request body (required)
Responses
| Code | Description | Media type |
|---|
201 | Added | — |
409 | Job not reviewable | — |
422 | domain_validation_failed; details maps each top-level field to the first failing check as a zod issue code (invalid_type, too_small, too_big, invalid_string, invalid_enum_value, invalid_literal, invalid_union, custom), unknown keys under _ as unrecognized_keys; the reference returned zod flatten() (formErrors, fieldErrors) instead | — |
POST/api/ohn/v1/digitisation/jobs/{id}/items/{itemId}/decisionAccept, edit or reject an item (F002, W003)
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string (uuid) | yes | |
itemId | path | string (uuid) | yes | |
Idempotency-Key | header | string | yes | |
Request body (required)
Responses
| Code | Description | Media type |
|---|
200 | Decided | — |
409 | Stale version or job not reviewable | — |
422 | domain_validation_failed; details maps each top-level field to the first failing check as a zod issue code (invalid_type, too_small, too_big, invalid_string, invalid_enum_value, invalid_literal, invalid_union, custom), unknown keys under _ as unrecognized_keys; the reference returned zod flatten() (formErrors, fieldErrors) instead | — |
POST/api/ohn/v1/digitisation/jobs/{id}/sign-offSign off and write accepted items as unverified (F004, W004)
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string (uuid) | yes | |
Idempotency-Key | header | string | yes | |
Request body (required)
Responses
| Code | Description | Media type |
|---|
200 | Completed; `writes` counts per write_status (written, held_no_code, refused, pending_retry, kept_in_ohn52) | — |
403 | clinician_signoff_required | — |
409 | Stale version or job not reviewable | — |
422 | items_undecided | — |
POST/api/ohn/v1/digitisation/jobs/{id}/rejectReject the job (F005)
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string (uuid) | yes | |
Idempotency-Key | header | string | yes | |
Request body (required)
Responses
| Code | Description | Media type |
|---|
200 | Rejected | — |
409 | Invalid transition or stale | — |
POST/api/ohn/v1/digitisation/jobs/{id}/retry-writesRetry pending OHN-10 writes
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string (uuid) | yes | |
Idempotency-Key | header | string | yes | |
Request body
Responses
| Code | Description | Media type |
|---|
200 | Retried | — |
record
GET/api/ohn/v1/digitisation/patients/{patientId}/digitised-itemsAccepted items of signed-off jobs, each with paper provenance
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
patientId | path | string (uuid) | yes | |
Responses
| Code | Description | Media type |
|---|
200 | OK | |
reports
GET/api/ohn/v1/digitisation/reportsReport catalogue
Authentication: bearer
Responses
| Code | Description | Media type |
|---|
200 | OK | — |
GET/api/ohn/v1/digitisation/reports/{reportId}Run a report
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
reportId | path | "OHN-52-R001" | "OHN-52-R002" | "OHN-52-R003" | yes | |
days | query | integer | no | |
Responses
| Code | Description | Media type |
|---|
200 | OK | — |
GET/api/ohn/v1/digitisation/reports/{reportId}/exportSigned CSV export
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
reportId | path | "OHN-52-R001" | "OHN-52-R002" | "OHN-52-R003" | yes | |
days | query | integer | no | |
Responses
| Code | Description | Media type |
|---|
200 | CSV | text/csv
|
503 | OHN52_EXPORT_SIGNING_KEY not configured | — |
ops
GET/health/ohn-52Health, recognition engine and dependency modes
Responses
| Code | Description | Media type |
|---|
200 | OK | |
503 | Database unavailable | — |
GET/api/ohn/v1/digitisation/contextCaller context and engine status
Authentication: bearer
Responses
| Code | Description | Media type |
|---|
200 | OK | — |
POST/api/ohn/v1/digitisation/jobs/{id}/reprocessRecognise again before any decision (admin)
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
id | path | string (uuid) | yes | |
Idempotency-Key | header | string | yes | |
Request body
Responses
| Code | Description | Media type |
|---|
200 | Queued | — |
409 | Review started | — |
GET/api/ohn/v1/digitisation/auditLatest audit receipts (digitisation_admin)
Authentication: bearer
Responses
| Code | Description | Media type |
|---|
200 | OK | — |
POST/api/ohn/v1/digitisation/admin/outbox/relayRelay pending events to OHN-24
Authentication: bearer
Parameters
| Name | In | Type | Required | Description |
|---|
Idempotency-Key | header | string | yes | |
Responses
| Code | Description | Media type |
|---|
200 | Relay result | — |
Schemas
JobState
"uploaded" | "processing" | "ready_for_review" | "partially_reviewed" | "completed" | "rejected"
ItemType
"date" | "vaccination" | "diagnosis" | "medication" | "allergy" | "blood_group" | "genotype" | "vital_sign" | "visit"
Consent
| Name | Type | Required | Description |
|---|
method | "patient_self_upload" | "verbal_witnessed" | "written_signed" | yes | |
statement_version | string | yes | |
patient_agrees | true | yes | |
ai_processing_allowed | boolean | no | |
witness_name | string | no | Required for verbal_witnessed |
CreateJob
| Name | Type | Required | Description |
|---|
patient_id | string (uuid) | no | Required for clinic capture; must be absent or own id for patients |
review_org_id | string (uuid) | no | Required for patient uploads: the care site (OHN-05 facility id) whose queue reviews the pages; ignored for staff, whose job belongs to their own organization |
title | string | no | |
consent | Consent | yes | |
pages | array of CreateJob.pages.item | yes | |
Bbox
Fractions (0..1) of page width/height
| Name | Type | Required | Description |
|---|
x | number | no | |
y | number | no | |
w | number | no | |
h | number | no | |
Item
| Name | Type | Required | Description |
|---|
id | string (uuid) | no | |
page_id | string (uuid) | no | |
item_type | ItemType | no | |
origin | "engine" | "reviewer_added" | no | |
source_text | string | no | |
proposed | object | no | |
final | object | null | no | |
confidence | number | no | |
low_confidence | boolean | no | |
bbox | Bbox | no | Fractions (0..1) of page width/height |
state | "proposed" | "accepted" | "edited" | "rejected" | no | |
version | integer | no | |
verification_status | "unverified_patient_held" | no | |
lab_verified | false | no | |
target | "ohn10_problem" | "ohn10_medication" | "ohn10_allergy" | "ohn52_record" | no | |
target_gap | string | null | no | |
write_status | "not_applicable" | "written" | "held_no_code" | "refused" | "pending_retry" | "kept_in_ohn52" | no | |
provenance | Provenance | no | |
Provenance
| Name | Type | Required | Description |
|---|
source | "digitised_from_paper" | no | |
label_en | string | no | |
label_fr | string | no | |
verification_status | "unverified_patient_held" | no | |
reviewer_id | string (uuid) | no | |
reviewed_at | string (date-time) | no | |
page_image_ref | Provenance.page_image_ref | no | |
lab_verified | false | no | |
transfusion_verified | false | no | blood_group only |
caveat_en | string | no | blood_group: Reported in paper booklet, not verified for transfusion. |
RecordItem
| Name | Type | Required | Description |
|---|
id | string | no | |
item_type | ItemType | no | |
value | object | no | |
write_status | string | no | |
lab_verified | false | no | |
provenance | Provenance | no | |
JobSummary
| Name | Type | Required | Description |
|---|
id | string | no | |
state | JobState | no | |
source | "patient_upload" | "clinic_capture" | no | |
page_count | integer | no | |
item_count | integer | no | |
open_items | integer | no | |
low_confidence_open | integer | no | |
engines | array of string | no | |
images_left_platform | boolean | no | |
version | integer | no | |
Job
| Name | Type | Required | Description |
|---|
id | string | no | |
state | JobState | no | |
source | "patient_upload" | "clinic_capture" | no | |
page_count | integer | no | |
item_count | integer | no | |
open_items | integer | no | |
low_confidence_open | integer | no | |
engines | array of string | no | |
images_left_platform | boolean | no | |
version | integer | no | |
allowed_actions | array of "decide_item" | "add_item" | "sign_off" | "reject" | "reprocess" | "retry_writes" | no | |
engine_requested | "tesseract-local" | "anthropic-vision" | no | |
ai_authorisation_ref | string | null | no | |
pages | array of object | no | |
items | array of Item | no | |
history | array of object | no | |
engine_runs | array of Job.engine_runs.item | no | |
receipt | object | no | |
AddItem
| Name | Type | Required | Description |
|---|
page_id | string (uuid) | yes | |
item_type | ItemType | yes | |
source_text | string | yes | |
value | object | yes | Values are strings of at most 500 characters, numbers, booleans or null; any key containing "verif" is dropped |
Decision
| Name | Type | Required | Description |
|---|
expected_version | integer | yes | |
decision | "accept" | "edit" | "reject" | yes | |
value | object | no | Required for edit |
reason | string | no | Required for reject (at least 3 characters) |
SignOff
| Name | Type | Required | Description |
|---|
expected_version | integer | yes | |
attestation | true | yes | |
note | string | no | |
Health
| Name | Type | Required | Description |
|---|
status | string | no | |
module | "OHN-52" | no | |
engine | Health.engine | no | |
dependencies | object | no | |
writes_enabled | boolean | no | False when the operator kill switch is on (every write 503 not_configured) |
export_signing_configured | boolean | no | |
auth_configured | boolean | no | |
synthetic_auth | boolean | no | Always false in the Java service |
get-api-ohn-v1-digitisation-jobs.response-200 defined inline
| Name | Type | Required | Description |
|---|
items | array of JobSummary | no | |
post-api-ohn-v1-digitisation-jobs.request.form-data defined inline
| Name | Type | Required | Description |
|---|
patient_id | string (uuid) | no | |
review_org_id | string (uuid) | no | Patient uploads only: the care site that reviews the pages (the Java service reads it; the TypeScript reference ignored this multipart field) |
title | string | no | |
consent | string | yes | JSON-encoded Consent |
pages | array of string (binary) | yes | |
post-api-ohn-v1-digitisation-jobs-id-reject.request defined inline
| Name | Type | Required | Description |
|---|
expected_version | integer | yes | |
reason | string | yes | |
get-api-ohn-v1-digitisation-patients-patientid-digitised-items.response-200 defined inline
| Name | Type | Required | Description |
|---|
verification_status | "unverified_patient_held" | no | |
items | array of RecordItem | no | |
CreateJob.pages.item defined inline
| Name | Type | Required | Description |
|---|
media_type | "image/jpeg" | "image/png" | "application/pdf" | yes | |
content_base64 | string | yes | |
Provenance.page_image_ref defined inline
| Name | Type | Required | Description |
|---|
job_id | string | no | |
page_id | string | no | |
ohn13_document_id | string | no | |
Job.engine_runs.item defined inline
| Name | Type | Required | Description |
|---|
engine | string | no | |
model | string | no | |
left_platform | boolean | no | |
authorisation_ref | string | null | no | |
outcome | string | no | |
duration_ms | integer | no | |
Health.engine defined inline
| Name | Type | Required | Description |
|---|
default | "tesseract-local" | no | |
local_ocr_data | "present" | "missing" | no | |
ai | "disabled" | "enabled" | "refused_incomplete_configuration" | no | |
ai_model | string | null | no | |
worker | "running" | "stopped" | no | |
adapter | "none" | "wired" | no | Java only: none while no OCR adapter is wired (B820); local_ocr_data is then missing |
worker_stats | object | no | |