RdmpCohortBuildHealthBoardBreakdown plugin package (9.2.3)#2368
Conversation
Self-contained package for the cohort-build health-board breakdown plugin: the built .rdmp, install/usage notes, plugin source, and design + technical documentation. Splits the Cohort Builder's per-step count tree by Scottish health board (wide CSV: Metric, Total, per-board columns, Other, NotKnown, and a % of final cohort row). Cache-only recompose, validated against a deterministic synthetic fixture. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169JCnaL3fhhZjseDx2XXT2
Keep the package to the built .rdmp + INSTALL + README + source. Design and technical docs remain on the proposals branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169JCnaL3fhhZjseDx2XXT2
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169JCnaL3fhhZjseDx2XXT2
JFriel
left a comment
There was a problem hiding this comment.
I think this change would be a better tagret for a plugin, rather than core RDMP. Can discuss HIC owned plugins via teams
|
|
||
| namespace RdmpCohortBuildHealthBoardBreakdown; | ||
|
|
||
| public class CohortBuildHealthBoardBreakdownPluginUserInterface : PluginUserInterface |
There was a problem hiding this comment.
The PluginUserInterface is really for use by plugins, not code that has access to the RDMP internals. If this is something you want to keep as a plugin, it may be best to create it as a standalone outside of the RDMP codebase, or target the chodechange against the HIC specific Plugin Codebase (can share seperatly). If you want to keep in in core RDMP, this functionality is best moved to the ContetxStripMenu or the standard RightClick options function
| @@ -0,0 +1,24 @@ | |||
| // Surfaces the cohort build health board breakdown in the RDMP desktop GUI (right-click a cohort | |||
There was a problem hiding this comment.
This file should be in the existing directory structure. Something like RDMP.Core/CohortCreation/Aggregates or similar
| public const string PercentMetric = "% of final cohort"; | ||
|
|
||
| /// <summary>One count point of the build tree with its per-region counts (known boards only).</summary> | ||
| public sealed class NodeBreakdown |
There was a problem hiding this comment.
Can you put these nested classes into their own file
| CohortIdentificationConfiguration cic, | ||
| [DemandsInitialization("CSV file to write. Defaults to <cic>-build-healthboard.csv in the current directory")] | ||
| FileInfo toFile = null, | ||
| [DemandsInitialization("Demography catalogue holding the region column", DefaultValue = "SHARE_Demography")] |
There was a problem hiding this comment.
Cant use this as a default value in the RDMP codebase. Probably shouldn't have a default value
| private readonly Dictionary<int, (string fqn, string col)> _setCacheTable = new(); | ||
| private readonly Dictionary<(bool isContainer, int id), (int final, int? cumulative)> _baseline = new(); | ||
|
|
||
| public ExecuteCommandExportCohortBuildHealthBoardBreakdown(IBasicActivateItems activator, |
There was a problem hiding this comment.
Is it worth making this more geenric i.e. ExportCohortBuildBreakDownByGroups or similar
| CohortIdentificationConfiguration cic, | ||
| [DemandsInitialization("CSV file to write. Defaults to <cic>-build-healthboard.csv in the current directory")] | ||
| FileInfo toFile = null, | ||
| [DemandsInitialization("Demography catalogue holding the region column", DefaultValue = "SHARE_Demography")] |
There was a problem hiding this comment.
This should pass in a catalogue, not a string. It can also be mapped from the cli like Catalogue:1234
| [DemandsInitialization("Demography catalogue holding the region column", DefaultValue = "SHARE_Demography")] | ||
| string demographyCatalogue = "SHARE_Demography", | ||
| [DemandsInitialization("Region (health board cipher) column on the demography catalogue", DefaultValue = "Region")] | ||
| string regionColumn = "Region", |
There was a problem hiding this comment.
This should pass in a ColumnInfo
| if (parent != null && indexInParent > 0 && cCum.HasValue) | ||
| cCumByRegion = RunRegionCounts(CumulativeSql(parent, indexInParent)); | ||
|
|
||
| nodes.Add(new CohortBuildHealthBoardBreakdownReport.NodeBreakdown |
There was a problem hiding this comment.
You can add a constructor to nodebreakdown that maps the key/values rather than have to manually map them here and further down
|
|
||
| private IReadOnlyDictionary<string, int> RunRegionCounts(string idListSql) | ||
| { | ||
| var sql = |
There was a problem hiding this comment.
RMDP supports multible db types (sql,postgres,oracle). This SQL will need to be rewritten using FansiSQL
| public const string UnknownNode = "Unknown"; | ||
|
|
||
| // keyed by the single-letter Region cipher held in SHARE_Demography.Region | ||
| private static readonly Dictionary<string, HealthBoard> ByRegion = new(System.StringComparer.OrdinalIgnoreCase) |
There was a problem hiding this comment.
This should not be in RMDP and if something like this is required, it should reference a user-defined lookup
Proposed Change
Adds a self-contained package for the
RdmpCohortBuildHealthBoardBreakdownplugin (RDMP 9.2.3), underthe new top-level
RdmpCohortBuildHealthBoardBreakdown/folder: the built.rdmpplugin, its source,and install/usage notes. It ships the built plugin (for review and installation) rather than a
Rdmp.Corecode merge; the full source is included undersrc/.What the plugin does: reproduces the Cohort Builder's per-set / per-container count tree (the
FinalCountand cumulative running totals shown as UNION/INTERSECT/EXCEPT are applied), split byScottish health board, plus the unfiltered national total, as a wide CSV.
How it works: it builds the cohort once (which populates RDMP's query cache), then recomposes every
count point purely from the cached per-set identifier tables and splits each by
SHARE_Demography.Regionwith oneGROUP BYper node. There is no per-board rebuild, and nosource-catalogue hits after the single build (so it is cross-server safe). It requires a query-caching
server, and the demography catalogue on the same server as the cache.
Output: a wide CSV. One row per count point (name written once), a
Metriccolumn (Final andCumulative), a
Totalcolumn (national), one column per Scottish board, thenOther(presentnon-Scottish or unmapped region codes) and
NotKnown(not in demography, or null region). The columnheader is repeated above a
% of final cohortrow. Boards plus Other plus NotKnown reconcile to Totalon every row.
Contents (
RdmpCohortBuildHealthBoardBreakdown/):RdmpCohortBuildHealthBoardBreakdown.rdmp,README.md,INSTALL.md, andsrc/(command, report, health-board lookup, UI hook, csproj, nuspec).Validation: verified end-to-end against a deterministic synthetic fixture (a top EXCEPT over an
inclusion INTERSECT minus four exclusion sets, with the cohort partitioned across 3 boards). Every
national and per-board count and cumulative is asserted cell-by-cell, the unfiltered column equals
RDMP's own
CohortCompilercounts, and the boards sum to national at every node.Type of change
Checklist
By opening this PR, I confirm that I have:
Rdmp.Core.Tests), validated against the fixture described in the source.README.md,INSTALL.md).