Aller au contenu

← Tous les contrats

OHN-52 Paper Health Record Digitisation

Version
1.0.0
OpenAPI
3.1.0
Source dans le dépôt
modules/OHN-52/api/openapi.yaml
Serveurs
https://opeshealthnetwork.com
Authentification
bearer: http bearer (JWT)

Télécharger le contrat (YAML)

Les contrats sont rédigés en anglais.

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.

Opérations

jobs

GET/api/ohn/v1/digitisation/jobsList jobs in scope

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
statequerystringnonAny state name up to 32 characters; an unknown name lists nothing.
patient_idquerystring (uuid)non

Réponses

CodeDescriptionType de média
200OK
POST/api/ohn/v1/digitisation/jobsUpload booklet pages with consent (F001, W001)

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
Idempotency-Keyheaderstringoui

Corps de la requête (obligatoire)

Réponses

CodeDescriptionType de média
201Job created
application/json: Job
400Missing idempotency key or malformed body—
403patient_self_only, consent_denied (OHN-15), or role not permitted—
409Idempotency key reused with another payload—
413Body larger than OHN52_MAX_UPLOAD_BODY—
422domain_validation_failed, consent_method_invalid, type_mismatch, page_too_large, unsupported_type, image_too_many_pixels, pdf_active_content, image_corrupt—
429Rate limited—
503OHN-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)

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
idpathstring (uuid)oui

Réponses

CodeDescriptionType de média
200OK
application/json: Job
404Not in scope—
GET/api/ohn/v1/digitisation/jobs/{id}/pages/{pageId}/imagePage image (metadata stripped); viewing is audited

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
idpathstring (uuid)oui
pageIdpathstring (uuid)oui

Réponses

CodeDescriptionType de média
200Image
image/png
image/jpeg
application/pdf
404Not in scope—

review

POST/api/ohn/v1/digitisation/jobs/{id}/itemsAdd an item the engine missed (F003)

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
idpathstring (uuid)oui
Idempotency-Keyheaderstringoui

Corps de la requête (obligatoire)

Réponses

CodeDescriptionType de média
201Added—
409Job not reviewable—
422domain_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)

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
idpathstring (uuid)oui
itemIdpathstring (uuid)oui
Idempotency-Keyheaderstringoui

Corps de la requête (obligatoire)

Réponses

CodeDescriptionType de média
200Decided—
409Stale version or job not reviewable—
422domain_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)

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
idpathstring (uuid)oui
Idempotency-Keyheaderstringoui

Corps de la requête (obligatoire)

Réponses

CodeDescriptionType de média
200Completed; `writes` counts per write_status (written, held_no_code, refused, pending_retry, kept_in_ohn52)—
403clinician_signoff_required—
409Stale version or job not reviewable—
422items_undecided—
POST/api/ohn/v1/digitisation/jobs/{id}/rejectReject the job (F005)

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
idpathstring (uuid)oui
Idempotency-Keyheaderstringoui

Corps de la requête (obligatoire)

Réponses

CodeDescriptionType de média
200Rejected—
409Invalid transition or stale—
POST/api/ohn/v1/digitisation/jobs/{id}/retry-writesRetry pending OHN-10 writes

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
idpathstring (uuid)oui
Idempotency-Keyheaderstringoui

Corps de la requête

  • application/json: object

Réponses

CodeDescriptionType de média
200Retried—

record

GET/api/ohn/v1/digitisation/patients/{patientId}/digitised-itemsAccepted items of signed-off jobs, each with paper provenance

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
patientIdpathstring (uuid)oui

Réponses

CodeDescriptionType de média
200OK

reports

GET/api/ohn/v1/digitisation/reportsReport catalogue

Authentification: bearer

Réponses

CodeDescriptionType de média
200OK—
GET/api/ohn/v1/digitisation/reports/{reportId}Run a report

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
reportIdpath"OHN-52-R001" | "OHN-52-R002" | "OHN-52-R003"oui
daysqueryintegernon

Réponses

CodeDescriptionType de média
200OK—
GET/api/ohn/v1/digitisation/reports/{reportId}/exportSigned CSV export

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
reportIdpath"OHN-52-R001" | "OHN-52-R002" | "OHN-52-R003"oui
daysqueryintegernon

Réponses

CodeDescriptionType de média
200CSV
text/csv
503OHN52_EXPORT_SIGNING_KEY not configured—

ops

GET/health/ohn-52Health, recognition engine and dependency modes

Réponses

CodeDescriptionType de média
200OK
application/json: Health
503Database unavailable—
GET/api/ohn/v1/digitisation/contextCaller context and engine status

Authentification: bearer

Réponses

CodeDescriptionType de média
200OK—
POST/api/ohn/v1/digitisation/jobs/{id}/reprocessRecognise again before any decision (admin)

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
idpathstring (uuid)oui
Idempotency-Keyheaderstringoui

Corps de la requête

  • application/json: object

Réponses

CodeDescriptionType de média
200Queued—
409Review started—
GET/api/ohn/v1/digitisation/auditLatest audit receipts (digitisation_admin)

Authentification: bearer

Réponses

CodeDescriptionType de média
200OK—
POST/api/ohn/v1/digitisation/admin/outbox/relayRelay pending events to OHN-24

Authentification: bearer

Paramètres

NomEmplacementTypeObligatoireDescription
Idempotency-Keyheaderstringoui

Réponses

CodeDescriptionType de média
200Relay result—

Schémas

JobState

"uploaded" | "processing" | "ready_for_review" | "partially_reviewed" | "completed" | "rejected"

ItemType

"date" | "vaccination" | "diagnosis" | "medication" | "allergy" | "blood_group" | "genotype" | "vital_sign" | "visit"

CreateJob

NomTypeObligatoireDescription
patient_idstring (uuid)nonRequired for clinic capture; must be absent or own id for patients
review_org_idstring (uuid)nonRequired 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
titlestringnon
consentConsentoui
pagesarray of CreateJob.pages.itemoui

Bbox

Fractions (0..1) of page width/height

NomTypeObligatoireDescription
xnumbernon
ynumbernon
wnumbernon
hnumbernon

Item

NomTypeObligatoireDescription
idstring (uuid)non
page_idstring (uuid)non
item_typeItemTypenon
origin"engine" | "reviewer_added"non
source_textstringnon
proposedobjectnon
finalobject | nullnon
confidencenumbernon
low_confidencebooleannon
bboxBboxnonFractions (0..1) of page width/height
state"proposed" | "accepted" | "edited" | "rejected"non
versionintegernon
verification_status"unverified_patient_held"non
lab_verifiedfalsenon
target"ohn10_problem" | "ohn10_medication" | "ohn10_allergy" | "ohn52_record"non
target_gapstring | nullnon
write_status"not_applicable" | "written" | "held_no_code" | "refused" | "pending_retry" | "kept_in_ohn52"non
provenanceProvenancenon

Provenance

NomTypeObligatoireDescription
source"digitised_from_paper"non
label_enstringnon
label_frstringnon
verification_status"unverified_patient_held"non
reviewer_idstring (uuid)non
reviewed_atstring (date-time)non
page_image_refProvenance.page_image_refnon
lab_verifiedfalsenon
transfusion_verifiedfalsenonblood_group only
caveat_enstringnonblood_group: Reported in paper booklet, not verified for transfusion.

RecordItem

NomTypeObligatoireDescription
idstringnon
item_typeItemTypenon
valueobjectnon
write_statusstringnon
lab_verifiedfalsenon
provenanceProvenancenon

JobSummary

NomTypeObligatoireDescription
idstringnon
stateJobStatenon
source"patient_upload" | "clinic_capture"non
page_countintegernon
item_countintegernon
open_itemsintegernon
low_confidence_openintegernon
enginesarray of stringnon
images_left_platformbooleannon
versionintegernon

Job

NomTypeObligatoireDescription
idstringnon
stateJobStatenon
source"patient_upload" | "clinic_capture"non
page_countintegernon
item_countintegernon
open_itemsintegernon
low_confidence_openintegernon
enginesarray of stringnon
images_left_platformbooleannon
versionintegernon
allowed_actionsarray of "decide_item" | "add_item" | "sign_off" | "reject" | "reprocess" | "retry_writes"non
engine_requested"tesseract-local" | "anthropic-vision"non
ai_authorisation_refstring | nullnon
pagesarray of objectnon
itemsarray of Itemnon
historyarray of objectnon
engine_runsarray of Job.engine_runs.itemnon
receiptobjectnon

AddItem

NomTypeObligatoireDescription
page_idstring (uuid)oui
item_typeItemTypeoui
source_textstringoui
valueobjectouiValues are strings of at most 500 characters, numbers, booleans or null; any key containing "verif" is dropped

Decision

NomTypeObligatoireDescription
expected_versionintegeroui
decision"accept" | "edit" | "reject"oui
valueobjectnonRequired for edit
reasonstringnonRequired for reject (at least 3 characters)

SignOff

NomTypeObligatoireDescription
expected_versionintegeroui
attestationtrueoui
notestringnon

Health

NomTypeObligatoireDescription
statusstringnon
module"OHN-52"non
engineHealth.enginenon
dependenciesobjectnon
writes_enabledbooleannonFalse when the operator kill switch is on (every write 503 not_configured)
export_signing_configuredbooleannon
auth_configuredbooleannon
synthetic_authbooleannonAlways false in the Java service

get-api-ohn-v1-digitisation-jobs.response-200 défini sur place

NomTypeObligatoireDescription
itemsarray of JobSummarynon

post-api-ohn-v1-digitisation-jobs.request.form-data défini sur place

NomTypeObligatoireDescription
patient_idstring (uuid)non
review_org_idstring (uuid)nonPatient uploads only: the care site that reviews the pages (the Java service reads it; the TypeScript reference ignored this multipart field)
titlestringnon
consentstringouiJSON-encoded Consent
pagesarray of string (binary)oui

post-api-ohn-v1-digitisation-jobs-id-reject.request défini sur place

NomTypeObligatoireDescription
expected_versionintegeroui
reasonstringoui

get-api-ohn-v1-digitisation-patients-patientid-digitised-items.response-200 défini sur place

NomTypeObligatoireDescription
verification_status"unverified_patient_held"non
itemsarray of RecordItemnon

CreateJob.pages.item défini sur place

NomTypeObligatoireDescription
media_type"image/jpeg" | "image/png" | "application/pdf"oui
content_base64stringoui

Provenance.page_image_ref défini sur place

NomTypeObligatoireDescription
job_idstringnon
page_idstringnon
ohn13_document_idstringnon

Job.engine_runs.item défini sur place

NomTypeObligatoireDescription
enginestringnon
modelstringnon
left_platformbooleannon
authorisation_refstring | nullnon
outcomestringnon
duration_msintegernon

Health.engine défini sur place

NomTypeObligatoireDescription
default"tesseract-local"non
local_ocr_data"present" | "missing"non
ai"disabled" | "enabled" | "refused_incomplete_configuration"non
ai_modelstring | nullnon
worker"running" | "stopped"non
adapter"none" | "wired"nonJava only: none while no OCR adapter is wired (B820); local_ocr_data is then missing
worker_statsobjectnon