feat(ui): wire the "FHIR resources over time" chart to real counts (#185)#216
Open
mauripunzueta wants to merge 2 commits into
Open
feat(ui): wire the "FHIR resources over time" chart to real counts (#185)#216mauripunzueta wants to merge 2 commits into
mauripunzueta wants to merge 2 commits into
Conversation
55b56c2 to
77d04d6
Compare
) The observability work merged in #150 stood up the Prometheus /metrics facility and the authenticated console `resource-counts` endpoint, but the dashboard's "FHIR resources over time" chart still rendered a hardcoded SVG with sample data. This wires it to real per-type cumulative counts, closing the remaining gap in #185. Design: the chart is server-side rendered for the server's default tenant (an operator view). Per-tenant counts are still never exported to the public /metrics endpoint — this reuses the same storage count path as the console JSON endpoint, not a Prometheus label. - helios-observability: add a storage-agnostic `dashboard` module — a process-global `DashboardProvider` registry (mirroring the existing uptime/metrics globals) plus plain `DashboardSnapshot` data types. Keeps the crate free of any persistence dependency. - helios-rest: add `StorageDashboardProvider` (default tenant, 8 dashboard types, 30-day window) implementing that trait, registered in `build_app`; extract a shared `resource_count_series` helper so the console `resource-counts` handler and the dashboard provider share one cumulative-bucketing implementation. - helios-ui: depend on helios-observability (light); render the real chart server-side — computed SVG polyline, y-axis ticks, x-axis dates, a legend of per-type totals that doubles as a `?type=` series selector (progressive enhancement, no JS). Falls back to placeholder data when no provider is registered. Drops the now-unused `chart-unit-patients` i18n key across locales. - ROADMAP.md: flip "No performance metrics … Not planned" to implemented.
77d04d6 to
06b6fde
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
mauripunzueta
added a commit
that referenced
this pull request
Jul 7, 2026
Raise #216 patch coverage: add a StorageDashboardProvider::snapshot test against an in-memory backend (covers new() + the snapshot success path), and UI tests for the single-point chart branch and short_date month validation.
Raise #216 patch coverage: add a StorageDashboardProvider::snapshot test against an in-memory backend (covers new() + the snapshot success path), and UI tests for the single-point chart branch and short_date month validation.
0585627 to
2d86169
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #185.
Context
The observability work merged in #150 stood up the Prometheus
/metricsfacility and the authenticated consoleresource-countsendpoint — but the dashboard's "FHIR resources over time" chart still rendered a hardcoded SVG with sample data (the code comments called this out as follow-up work). This PR wires that chart to real per-type cumulative counts, closing the remaining gap in #185.Design decisions (resolving #185's open questions)
/uidashboard is an operator view mounted outside the auth layer, so the chart renders the server's default tenant counts server-side (no browser token needed, no client JS)./metricsendpoint. This reuses the same storage count path as the authenticated console JSON endpoint — a JSON/render path, not a Prometheus label — consistent with the posture established in feat(observability): uptime, Prometheus /metrics, and OTLP traces across all servers #150.helios-uidepend on the persistence layer, the server registers a provider with a light process-global registry inhelios-observability(mirroring the existinguptime/metricsglobals); the UI reads a plain snapshot.Changes
helios-observability— newdashboardmodule: a process-globalDashboardProviderregistry + plainDashboardSnapshotdata types (no persistence/FHIR types, keeps the crate light).helios-rest—StorageDashboardProvider(default tenant, 8 dashboard types, 30-day window) implementing that trait, registered inbuild_app. Extracted a sharedresource_count_serieshelper so the consoleresource-countshandler and the dashboard provider share one cumulative-bucketing implementation.helios-ui— depends onhelios-observability; renders the real chart server-side (computed SVG polyline, y-axis ticks, x-axis dates) plus a legend of per-type totals that doubles as a?type=series selector (progressive enhancement, works without JS). Falls back to placeholder data when no provider is registered. Drops the now-unusedchart-unit-patientsi18n key across en/es/de.ROADMAP.md— flips "No performance metrics … Not planned" to implemented.Verification
Opening this PR primarily to run CI: the authoring environment has no C linker, so
cargo check/test/clippycould not be run locally.cargo treeconfirms the dependency graph resolves. New unit tests cover the dashboard projection, chart geometry, formatting helpers, query parsing, and the empty/unknown-type fallbacks; the consoleresource-countsJSON shape is unchanged (existing integration tests still apply).