Acorn API documentation for lib/guru, lib/secure, and lib/wgtauth

Summary

Acorn development documentation for lib/guru, lib/secure, and lib/wgtauth. Part of a push to create the underpinnings of an SDK to support Oak-Tree, Spatial Imaging, and Sonador engineering efforts — a consistent reference for building REST-like APIs on Django and consuming them from client applications so that adding a resource is a matter of following a known pattern rather than reinventing request parsing, validation, pagination, and auth.

This MR is the framework half of a two-repo documentation split. The Sonador/MedTech-specific application of these patterns (the Orthanc plugin view layer, viewer, streaming, and the Sonador IO client) lives in the companion MR oak-tree/medical-imaging/docs/platform!9 (merged)oak-tree/medical-imaging/docs/platform!9 (merged). Both MRs address oak-tree/medical-imaging/imaging-development-env#56 (closed).

All reference pages below are grounded in the actual lib/ sources (lib/guru/views, lib/guru/forms, lib/guru/filter, lib/secure) and the Guru Client / example-client sources rather than inferred from naming.

New reference pages

  • dev.overview — "What Is Guru & Why" on-ramp: convention-over-configuration framing, who it's for (backend devs, integrators, AI agents), and how the pieces (models / views / forms / filters / security) fit together, with a request-flow diagram and a "fastest path" pointer into the quickstart.
  • dev.forms — Forms & data validation: the GuruCoreForm save pipeline (filterRelatedModelDatasuper().savesaveRelatedModelData), RelatedModelField vs. ManyToManyRelatedModelField (callbacks, M2M clear/re-add, related_model_field_validation_order), NestedFormField / MultipleNestedFormField for non-model nested data, and the deprecated create_modelform_class.
  • dev.filtering — Filtering & search: GuruFilterForm (filtermodel, key transforms, dynamic order_by, omit-empty, execute_filter), GuruQueryParamFilterFormMixin (query-string filtering on a view via getQueryset), and GuruFilterView (POST search endpoint).
  • dev.secure — Securing API endpoints: the api_request decorator auth order (conflict guard → custom callback → session → HMAC signed URL → HMAC data signature → token), the ApiAccess / ApiAccessToken credential models, and the EncryptedField family (Fernet/HKDF, lookup constraints).

Updated pages

  • dev.view-workflow — added the GuruApiRestView workflow (GET via details mixin; PUT/PATCH via update mixin; DELETE; POST→405), object caching (cache_object_argument_name='gobject'), the read-only-fields guard, operationCode mapping, and a "See Also" footer.
  • dev.client-toolsGuru Client library (API consumption). Filled the Architecture intro tying the module layout (utils/local/remote/auth/apisettings) to the core classes and RemoteServer. Added a Model and Collection Conventions section documenting the two-endpoint contract: collection class methods (fetch/fetch_modelinstance/create, mirroring the management endpoint) vs. model instance methods (update/delete, mirroring the REST endpoint), plus the fetch_endpoint/resource_url/pk_attr properties that drive them — noting that the base library supplies the plumbing while concrete clients supply the convention methods. Filled the Extending Guru Client TODO with a worked, source-grounded example built from the Sonador ETL client (server, model/collection base classes, a concrete resource, the parent-association pattern, reuse of the fetch_* helpers, and the fetch_*/get_* naming convention).
  • dev.data-models — expanded "Next Steps" to route into the new view-workflow / forms / filtering / secure pages.
  • home.md — added a "New to Guru?" callout into dev.overview + quickstart; expanded the Libraries section with the new pages.
  • _sidebar.md — reorganized into role-based groups (Start Here, Building REST-like APIs, Client Libraries, Reference & Specs, Deployment); fixed a typo.
  • spec-guru-backbone-forms — added a deprecation banner pointing to the current dev.forms / dev.view-workflow pages.

Addresses oak-tree/medical-imaging/imaging-development-env#56 (closed)

Covers the framework-side checklist items: lib/guru form-driven validation, lib/secure (credentials/tokens + api_request), the forms.py components (GuruCoreForm, RelatedModelField, ManyToManyRelatedModelField, create_modelform_class), and the filter.py components (GuruFilterForm, GuruQueryParamFilterFormMixin, GuruFilterView).

It also covers the framework side of "How are the APIs consumed?" — the Guru Client library conventions in dev.client-tools: the management-endpoint collection methods (fetch/fetch_modelinstance/create), the REST-endpoint instance methods (update/remove), and how to extend the library for a new API. The Sonador-specific consumption (the Orthanc plugin and the Sonador IO client's local/remote/sr axes) is tracked in the companion MR !9 above.

📘 Scope note: the lib/wgtauth reference named in the MR title is not yet included here — it is planned as a follow-up so the Guru/secure framework pages can land first.

Edited by Sonador Claude

Merge request reports

Loading