Skip to content

O3-5698: Add visit summary sections REST endpoint and SPI label/toggleable defaults#29

Open
BlessedAmrita wants to merge 2 commits into
openmrs:mainfrom
BlessedAmrita:feat/O3-5698-sections-endpoint
Open

O3-5698: Add visit summary sections REST endpoint and SPI label/toggleable defaults#29
BlessedAmrita wants to merge 2 commits into
openmrs:mainfrom
BlessedAmrita:feat/O3-5698-sections-endpoint

Conversation

@BlessedAmrita

Copy link
Copy Markdown
Contributor

Summary

Adds GET /ws/rest/v1/patientdocuments/visitSummary/sections, which lists the registered visit summary sections so an admin UI can display, toggle, and reorder them. Returns the standard REST collection shape ({ "results": [...] }), one entry per section with sectionKey, label, enabled, order, and toggleable, sorted by effective order.

The endpoint reads the same @Autowired List<VisitSummarySection> the PDF renderer uses, so a downstream module's custom section appears automatically with no change here. Access is guarded by the core Get Global Properties privilege (section metadata is not sensitive; no new module privilege).

Two additive default methods on the VisitSummarySection SPI back this:

  • getLabel() resolves the section's localized heading via the existing message-source mechanism, falling back to a humanized section key so downstream sections without message bundles still get a usable label.
  • isToggleable() defaults to true, overridden to false on the three always-on sections (facility header, patient info, footer) so their toggle can be locked in the UI.

Missing heading keys for the facility header and footer sections were added to the en/fr/ar bundles (fr/ar mirror English as placeholders, matching the module's existing convention).

Related

https://openmrs.atlassian.net/browse/O3-5698

Tests

Module suite green (api 120, omod including 6 new controller tests + 4 new SPI tests). Covers: every registered section listed, sorted by order, GP overrides reflected, always-on sections non-toggleable, labels resolved from the message source, and 403 on logout.

@BlessedAmrita

Copy link
Copy Markdown
Contributor Author

cc: @wikumChamith @dkayiwa

@sonarqubecloud

Copy link
Copy Markdown

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