Skip to content

Notebooks: ViewDefinition + SQLQuery cell types#86

Merged
Panthevm merged 1 commit into
masterfrom
notebooks-vd-sqlquery-cells
May 21, 2026
Merged

Notebooks: ViewDefinition + SQLQuery cell types#86
Panthevm merged 1 commit into
masterfrom
notebooks-vd-sqlquery-cells

Conversation

@Panthevm
Copy link
Copy Markdown
Collaborator

Summary

  • Two new cell types in the notebook editor and viewer: ViewDefinition and SQLQuery.
  • Each cell uses a scoped ResourcePicker (now accepts kinds + placeholder) to choose a resource, shows the picked resource as a link with description, and provides a Run action that returns a tabular result.
  • For SQLQuery the input parameters of Library.parameter[use=in] are rendered as labelled text inputs; their values are persisted inside cell.value as { url, params } JSON (with a backward-compatible fallback to a plain URL string).

Details

  • ViewDefinitionCellView: POST /fhir/ViewDefinition/<id>/$run with a Parameters body; response is Binary with base64 JSON which is decoded into rows and rendered via HSComp.Table.
  • SqlQueryCellView: POST /fhir/Library/<id>/$sqlquery-run with Parameters; parses parameter[name=row] into columns + rows.
  • ResourcePicker: optional kinds: CandidateKind[] controls which FHIR endpoints are fetched, placeholder overrides the empty-state label.
  • Editor: + dropdown grows two new entries; CellWrapper routes the new types to dedicated views.
  • Default description on a freshly created notebook is now "Description".

Backend Notebook schema (zen + FHIR StructureDefinition) needs to accept the new enum values `view-definition` and `sql-query` (see the matching sansara/box change).

Test plan

  • Open /notebooks/new, hit +ViewDefinition, pick a view, press Run — table renders.
  • Hit +SQLQuery, pick a query that has parameters, fill them, press Run — table renders, parameters persist after Save/reload.
  • Open the same notebook in view-mode — parameters remain editable and Run still works.
  • The existing SQL builder still uses ResourcePicker as before.

- New cell type "view-definition": pick a ViewDefinition via
  ResourcePicker (kinds=["ViewDefinition"]), open it as a link
  (Title/Name/Id + description gray), Run hits
  POST /fhir/ViewDefinition/<id>/$run, response is decoded from
  Binary(base64) and shown as a table with dynamic columns.
- New cell type "sql-query": same picker (kinds=["SQLQuery"]),
  Library opens as a link, Run hits POST /fhir/Library/<id>/$sqlquery-run
  with FHIR Parameters. Library.parameter[use=in] is rendered as
  uppercase-name + text input, values are persisted into cell.value
  (JSON with backward-compatible fallback to plain URL).
- ResourcePicker accepts optional `kinds` and `placeholder`,
  so it can fetch only ViewDefinitions or only SQLQueries.
- Editor: + dropdown gets ViewDefinition / SQLQuery entries,
  CellWrapper routes new types to the dedicated views, default
  description on a new notebook is "Description".
@Panthevm Panthevm merged commit c09836e into master May 21, 2026
4 checks passed
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