Skip to content

docs(ipd): pharmacy clearance APIs + move IPD routes off /appointments (PRO-738) - #662

Open
jainkuniya wants to merge 2 commits into
mainfrom
docs/ipd-pharmacy-clearance-notify
Open

docs(ipd): pharmacy clearance APIs + move IPD routes off /appointments (PRO-738)#662
jainkuniya wants to merge 2 commits into
mainfrom
docs/ipd-pharmacy-clearance-notify

Conversation

@jainkuniya

Copy link
Copy Markdown
Contributor

Docs for PRO-738, and the answer to @jainkuniya's "we have to update docs as well dost then" on eka-care/doctor-suite-js#9.

⚠️ This is a fix, not just an addition

The two existing IPD pages reference operations by method + path:

openapi: get /appointments/v1/ipd/admission/{admission_id}

doctor-suite-js#9 moves those routes to /ipd/v1/admissions/..., so both pages would have broken the moment that PR merged. Updated here:

Before After
/appointments/v1/ipd/admission/{admission_id} /ipd/v1/admissions/{admission_id}
/appointments/v1/ipd/admission /ipd/v1/admissions

Merge this together with doctor-suite-js#9, not before — until the service ships, these paths don't exist yet.

New endpoints

Three pharmacy-clearance operations, added to doc-tool.yaml with shared request/response schemas and registered under the existing IPD API nav group:

  • POST …/pharmacy-clearance-notify — on Initiate Discharge
  • POST …/pharmacy-clearance-notify/retry — the "Resend" action
  • POST …/pharmacy-clearance-notify/cancel — when a discharge is called off

The descriptions lead with what's easy to get wrong:

  • Recipients aren't yours to choose — resolved server-side from the admission's own orders.
  • An unreachable pharmacy is still a 200. The round ran; erroring would discard the results for the pharmacies that worked. Per-pharmacy outcomes live in targets.
  • skipped is a deliberate no-op, not a failure (no-ipid, no-targets).
  • UNSUPPORTED ≠ failed — nothing was attempted, nothing to retry.
  • Cancel must run BEFORE the discharge reset, which deletes the pharmacy list it needs.

Note on the auto-sync

doctor-suite-js has a workflow that syncs its generated spec into api-reference/medical-history/openapi.json. That path only covers the medical-history surface, so it does not pick up these IPD endpoints — hence the hand-maintained entries in doc-tool.yaml, where the existing IPD endpoints already live. Worth deciding separately whether that sync should cover the whole suite.

Verification

doc-tool.yaml parses as YAML and docs.json as JSON; all five IPD paths and the three new schemas resolve, and no /appointments/v1/ipd reference remains.

🤖 Generated with Claude Code

PRO-738.

The two existing IPD endpoints move with the service:

  /appointments/v1/ipd/admission/{admission_id} → /ipd/v1/admissions/{admission_id}
  /appointments/v1/ipd/admission                → /ipd/v1/admissions

IPD is its own module, not a sub-resource of appointments. Their `.mdx` pages
reference operations by method+path, so leaving them would have broken both
pages the moment the service PR merged.

Adds the three pharmacy-clearance endpoints — notify on discharge, resend to the
pharmacies that failed, and withdraw when a discharge is cancelled — plus shared
schemas for the request and the per-pharmacy response.

The docs lead with the parts that are easy to get wrong: recipients are resolved
server-side from the admission's orders and cannot be chosen by the caller; an
unreachable pharmacy is still a 200 because the round did run and erroring would
discard the results for the pharmacies that succeeded; `skipped` marks a
deliberate no-op rather than a failure; `UNSUPPORTED` means nothing was
attempted and nothing needs fixing; and cancel must be called BEFORE the
discharge workflow reset, which deletes the pharmacy list it needs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jainkuniya
jainkuniya marked this pull request as draft August 5, 2026 04:20
@jainkuniya

Copy link
Copy Markdown
Contributor Author

Moved to v2, alongside eka-care/doctor-suite-js#9 — drafting.

This PR both documents the new endpoints and rewrites the two existing IPD pages onto /ipd/v1. Since the service change is now v2, the docs shouldn't move ahead of it — the current pages stay correct until then.

Documents POST /ipd/v1/admissions/{id}/discharge/initiate — the whole discharge
flow over the API, not just the pharmacy notification.

The description leads with why an integrator should use this rather than the
standalone notify: firing the notification on its own tells chemists a patient
is leaving while the admission is still UNDER_CARE. And with why a pharmacy
failure returns 200 — the status commits before any chemist is contacted, so by
the time one fails the discharge has already happened.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jainkuniya
jainkuniya marked this pull request as ready for review August 5, 2026 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant