{"openapi":"3.0.0","paths":{"/nextgen/ping":{"get":{"description":"Obtains a GSA token and establishes an X-NG-SessionId session against the configured NextGen sandbox. Confirms end-to-end auth without writing data.","operationId":"NextgenController_ping","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PingResponseDto"}}}}},"summary":"Connectivity smoke test","tags":["nextgen"]}},"/patients/lookup":{"get":{"description":"Forwards criteria to the Enterprise API GET /persons/lookup. Each result `id` is a NextGen personId; `personNumber` (PersonNbr) and `medicalRecordNumber` (MRN) feed the ICS document step.","operationId":"PatientsController_lookup","parameters":[{"name":"dateOfBirth","required":false,"in":"query","description":"Verify exact format against the Enterprise API docs.","schema":{}},{"name":"firstName","required":false,"in":"query","schema":{}},{"name":"lastName","required":false,"in":"query","schema":{}}],"responses":{"200":{"description":"Array of matching NextGen persons."}},"summary":"Look up NextGen persons","tags":["patients"]}},"/documents/types":{"get":{"description":"Proxies the Enterprise API GET /master/document-types. Use to discover the documentTypeId to configure for care plans / clinical notes per client. Returns at most 25 without OData $top/$skip.","operationId":"DocumentsController_getTypes","parameters":[{"name":"$skip","required":false,"in":"query","description":"OData offset.","schema":{}},{"name":"$top","required":false,"in":"query","description":"OData page size.","schema":{}}],"responses":{"200":{"description":"Document types in an { items: [...] } envelope."}},"summary":"List NextGen document types","tags":["documents"]}},"/documents":{"post":{"description":"Runs the full ICS document-batches workflow for one document: create batch → add page → file metadata → post. Requires a DocumentTypeId already configured in the target client environment (see GET /documents/types).","operationId":"DocumentsController_submit","parameters":[],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/SubmitDocumentDto"}}}},"responses":{"201":{"description":"The created batchId + documentId, with posted=true."}},"summary":"Write a document into a NextGen chart","tags":["documents"]}}},"info":{"title":"Welby NextGen Microservice","description":"Integration service that writes care plans, clinical notes & consents into NextGen (Enterprise API; GSA auth + ICS document-batches) and resolves Welby patients to NextGen persons.","version":"1.0.0","contact":{}},"tags":[{"name":"nextgen","description":"Connectivity & auth diagnostics"},{"name":"patients","description":"Patient lookup (Welby → NextGen personId)"},{"name":"documents","description":"Document types & ICS document writes"}],"servers":[],"components":{"schemas":{"PingResponseDto":{"type":"object","properties":{"ok":{"type":"boolean","example":true,"description":"Overall result of the NextGen connectivity check."},"sessionEstablished":{"type":"boolean","example":true,"description":"Whether an X-NG-SessionId session was successfully established."}},"required":["ok","sessionEstablished"]},"SubmitDocumentDto":{"type":"object","properties":{"file":{"type":"string","format":"binary","description":"The document file (e.g. a care plan / clinical note / consent PDF)."},"description":{"type":"string","description":"Batch description shown in NextGen Document Management.","example":"Welby Care Plan - 2026-07"},"documentTypeId":{"type":"string","description":"NextGen DocumentTypeId (the `id` from GET /documents/types)."},"personNbr":{"type":"string","description":"Patient PersonNbr (the `personNumber` from /patients/lookup)."},"mrn":{"type":"string","description":"Patient MRN (the `medicalRecordNumber` from /patients/lookup)."},"viewCategoryId":{"type":"string","description":"View Category id that controls chart visibility for the document."}},"required":["file","description","documentTypeId"]}}}}