{"openapi":"3.1.0","info":{"title":"NEDOCS Integration API","version":"1.0.0","description":"Ingest HL7 v2 (ADT/ORU/ORM) or REST score inputs; read the computed NEDOCS score/level. Authentication uses a per-hospital API key sent as `Authorization: Bearer <key>`, `X-API-Key: <key>`, or an `id` field.","contact":{"name":"NEDOCS","url":"https://nedocs.org/Home/RequestAccess"},"license":{"name":"Proprietary"}},"servers":[{"url":"https://nedocs.org"}],"tags":[{"name":"HL7 ingest","description":"HL7 v2 message ingestion."},{"name":"REST","description":"Non-HL7 REST submit/read."}],"externalDocs":{"description":"HL7 & EHR integration guide","url":"https://nedocs.org/Product/HL7"},"paths":{"/api/hl7/message":{"post":{"summary":"Ingest any HL7 message (routed by MSH-9)","operationId":"ingestHl7Message","tags":["HL7 ingest"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]},{"apiKeyQuery":[]}],"parameters":[{"name":"ack","in":"query","required":false,"schema":{"type":"string","enum":["hl7"]},"description":"Set to 'hl7' to receive a raw HL7 ACK instead of JSON."}],"requestBody":{"description":"Raw HL7 v2 message, or JSON wrapping it.","required":true,"content":{"text/plain":{"schema":{"type":"string","example":"MSH|^~\\&|EPIC|HOSP|NEDOCS|HOSP|20260701120000||ADT^A04|M1|P|2.5\rEVN|A04|20260701120000\rPV1|1|E|EMERG^ED^BED1|||||||||||||||||V1001^^^HOSP^VN"}},"application/hl7-v2":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Raw HL7 v2 message."}}}}}},"responses":{"200":{"description":"Message accepted (AA). May include a freshly computed score.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResult"}},"application/hl7-v2":{"schema":{"type":"string","description":"HL7 ACK (MSA|AA|...) when ?ack=hl7 or Accept: application/hl7-v2."}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestError"}}}},"422":{"description":"Application error while processing (AE).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResult"}}}}}}},"/api/hl7/adt":{"post":{"summary":"Ingest an HL7 ADT message","operationId":"ingestHl7Adt","tags":["HL7 ingest"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]},{"apiKeyQuery":[]}],"parameters":[{"name":"ack","in":"query","required":false,"schema":{"type":"string","enum":["hl7"]},"description":"Set to 'hl7' to receive a raw HL7 ACK instead of JSON."}],"requestBody":{"description":"Raw HL7 v2 message, or JSON wrapping it.","required":true,"content":{"text/plain":{"schema":{"type":"string","example":"MSH|^~\\&|EPIC|HOSP|NEDOCS|HOSP|20260701120000||ADT^A04|M1|P|2.5\rEVN|A04|20260701120000\rPV1|1|E|EMERG^ED^BED1|||||||||||||||||V1001^^^HOSP^VN"}},"application/hl7-v2":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Raw HL7 v2 message."}}}}}},"responses":{"200":{"description":"Message accepted (AA). May include a freshly computed score.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResult"}},"application/hl7-v2":{"schema":{"type":"string","description":"HL7 ACK (MSA|AA|...) when ?ack=hl7 or Accept: application/hl7-v2."}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestError"}}}},"422":{"description":"Application error while processing (AE).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResult"}}}}}}},"/api/hl7/oru":{"post":{"summary":"Ingest an HL7 ORU^R01 (flowsheet) message","operationId":"ingestHl7Oru","tags":["HL7 ingest"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]},{"apiKeyQuery":[]}],"parameters":[{"name":"ack","in":"query","required":false,"schema":{"type":"string","enum":["hl7"]},"description":"Set to 'hl7' to receive a raw HL7 ACK instead of JSON."}],"requestBody":{"description":"Raw HL7 v2 message, or JSON wrapping it.","required":true,"content":{"text/plain":{"schema":{"type":"string","example":"MSH|^~\\&|EPIC|HOSP|NEDOCS|HOSP|20260701120000||ADT^A04|M1|P|2.5\rEVN|A04|20260701120000\rPV1|1|E|EMERG^ED^BED1|||||||||||||||||V1001^^^HOSP^VN"}},"application/hl7-v2":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Raw HL7 v2 message."}}}}}},"responses":{"200":{"description":"Message accepted (AA). May include a freshly computed score.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResult"}},"application/hl7-v2":{"schema":{"type":"string","description":"HL7 ACK (MSA|AA|...) when ?ack=hl7 or Accept: application/hl7-v2."}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestError"}}}},"422":{"description":"Application error while processing (AE).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResult"}}}}}}},"/api/hl7/orm":{"post":{"summary":"Ingest an HL7 ORM^O01 (order) message","operationId":"ingestHl7Orm","tags":["HL7 ingest"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]},{"apiKeyQuery":[]}],"parameters":[{"name":"ack","in":"query","required":false,"schema":{"type":"string","enum":["hl7"]},"description":"Set to 'hl7' to receive a raw HL7 ACK instead of JSON."}],"requestBody":{"description":"Raw HL7 v2 message, or JSON wrapping it.","required":true,"content":{"text/plain":{"schema":{"type":"string","example":"MSH|^~\\&|EPIC|HOSP|NEDOCS|HOSP|20260701120000||ADT^A04|M1|P|2.5\rEVN|A04|20260701120000\rPV1|1|E|EMERG^ED^BED1|||||||||||||||||V1001^^^HOSP^VN"}},"application/hl7-v2":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"Raw HL7 v2 message."}}}}}},"responses":{"200":{"description":"Message accepted (AA). May include a freshly computed score.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResult"}},"application/hl7-v2":{"schema":{"type":"string","description":"HL7 ACK (MSA|AA|...) when ?ack=hl7 or Accept: application/hl7-v2."}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestError"}}}},"422":{"description":"Application error while processing (AE).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestResult"}}}}}}},"/api/hl7/status":{"get":{"summary":"HL7 pipeline status for the authenticated hospital","operationId":"hl7Status","tags":["HL7 ingest"],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]},{"apiKeyQuery":[]}],"responses":{"200":{"description":"Pipeline status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Hl7Status"}}}},"401":{"description":"Missing or invalid API key."}}}},"/API/SubmitScore/{id}":{"post":{"summary":"Submit NEDOCS score inputs (REST, form-encoded)","operationId":"submitScore","tags":["REST"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Hospital API key."}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"totalpat":{"type":"integer","description":"Total patients in the ED"},"totaladmits":{"type":"integer","description":"Admits waiting in the ED"},"edbeds":{"type":"integer","description":"Total ED beds"},"ipbeds":{"type":"integer","description":"Total inpatient beds"},"longestadmit":{"type":"integer","description":"Longest admit time (minutes)"},"lastbedtime":{"type":"integer","description":"Last door-to-bed time (minutes)"},"ventilators":{"type":"integer","description":"1:1 / ventilator patients"}}}}}},"responses":{"200":{"description":"Score saved or error.","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/API/GetCurrentNEDOCS/{id}":{"get":{"summary":"Read the current NEDOCS score","operationId":"getCurrentNedocs","tags":["REST"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Hospital API key."}],"responses":{"200":{"description":"Current score JSON.","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/API/BedCount/{id}":{"get":{"summary":"Read configured ED / inpatient bed counts","operationId":"getBedCount","tags":["REST"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Hospital API key."}],"responses":{"200":{"description":"Bed counts JSON.","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Authorization: Bearer <hospital-api-key>"},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key"},"apiKeyQuery":{"type":"apiKey","in":"query","name":"id"}},"schemas":{"IngestResult":{"type":"object","properties":{"ok":{"type":"boolean"},"ack":{"type":"string","enum":["AA","AE","AR"]},"family":{"type":"string","enum":["ADT","ORU","ORM","ACK","OTHER"]},"messageType":{"type":"string","example":"ADT^A02"},"messageControlId":{"type":"string"},"visitNumber":{"type":"string"},"scored":{"type":"boolean","description":"True when a new NEDOCS score was written."},"score":{"type":"integer"},"scaleColor":{"type":"string","enum":["Green","Yellow","Orange","Red","Black"]},"level":{"type":"integer","minimum":1,"maximum":5},"census":{"$ref":"#/components/schemas/Census"},"error":{"type":"string"}}},"IngestError":{"type":"object","properties":{"ok":{"type":"boolean","example":false},"ack":{"type":"string"},"error":{"type":"string"}}},"Census":{"type":"object","properties":{"totalPatients":{"type":"integer"},"totalAdmits":{"type":"integer"},"totalEDBeds":{"type":"integer"},"totalIPBeds":{"type":"integer"},"totalVentilators":{"type":"integer"},"longestAdmitMinutes":{"type":"integer"},"lastBedTimeMinutes":{"type":"integer"}}},"Hl7Status":{"type":"object","properties":{"ok":{"type":"boolean"},"hospitalId":{"type":"string"},"connected":{"type":"boolean"},"lastMessageAt":{"type":"string","format":"date-time","nullable":true},"lastMessageType":{"type":"string","nullable":true},"messages24h":{"type":"integer"},"activeEdEncounters":{"type":"integer"}}}}}}