Skip to content

Commit c44fa96

Browse files
authored
Task/rdmp 360 catalogue status change behaviour (#2319)
* add drag and drop fix for internal catalogues * prevent commit of internal catalogues * add changelog * fix typo * add internal cohort test * logic * check for project specific catalogues in cohort builder * fix build * fix preinit invoker * fix project specific check * update test * fix build * fix test
1 parent 13f3314 commit c44fa96

File tree

67 files changed

+428
-286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+428
-286
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
- Add Internal Note to Catalogue
99
- Fix issue where project associations were not copied when a CIC was cloned
1010
- Fix issue with using Internal Catalogues in Cohort Identification Configurations
11+
- Fix issue with using Project Specific Catalogues in Cohort Identification Configurations when not associated to project
12+
- Fix bug with copying project specific Catalogues between Projects when committing a Cohort
13+
- Remove Tree filters from UI
14+
1115
- Simplify Project Cohorts tree
1216
- Fix bug with copying project specific Catalogues between Projects when committing a Cohort
1317
- Remove Tree filters from UI
@@ -18,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1822
- Simplify use of Extraction Progress
1923
- Update CHI validation to allow mod10 CHIs
2024
- Hardened Confluence export functionality
25+
- Fix issue with using Internal Catalogues in Cohort Identification Configurations
2126
- Add new SQL merge extraction component
2227

2328
## [9.1.1] - 2025-12-02

Rdmp.Core.Tests/Caching/Integration/CustomDateCachingTests.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@
44
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
55
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.
66

7-
using System;
8-
using System.Collections.Generic;
9-
using System.IO;
10-
using System.Linq;
11-
using System.Threading.Tasks;
127
using NSubstitute;
138
using NUnit.Framework;
149
using Rdmp.Core.Caching;
1510
using Rdmp.Core.Caching.Layouts;
1611
using Rdmp.Core.Caching.Pipeline.Destinations;
1712
using Rdmp.Core.Caching.Pipeline.Sources;
1813
using Rdmp.Core.Caching.Requests;
14+
using Rdmp.Core.CommandExecution;
1915
using Rdmp.Core.Curation;
2016
using Rdmp.Core.Curation.Data;
2117
using Rdmp.Core.Curation.Data.Cache;
@@ -25,6 +21,11 @@
2521
using Rdmp.Core.Repositories;
2622
using Rdmp.Core.ReusableLibraryCode.Checks;
2723
using Rdmp.Core.ReusableLibraryCode.Progress;
24+
using System;
25+
using System.Collections.Generic;
26+
using System.IO;
27+
using System.Linq;
28+
using System.Threading.Tasks;
2829
using Tests.Common;
2930

3031
namespace Rdmp.Core.Tests.Caching.Integration;
@@ -182,7 +183,7 @@ public void Check(ICheckNotifier notifier)
182183

183184
private ILoadDirectory project;
184185

185-
public void PreInitialize(ILoadDirectory value, IDataLoadEventListener listener)
186+
public void PreInitialize(IBasicActivateItems activator, ILoadDirectory value, IDataLoadEventListener listener)
186187
{
187188
project = value;
188189
}

Rdmp.Core.Tests/Caching/Unit/TestIFileDataFlowComponents.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.IO;
1010
using System.Linq;
1111
using Rdmp.Core.Caching.Layouts;
12+
using Rdmp.Core.CommandExecution;
1213
using Rdmp.Core.Curation.Data.Cache;
1314
using Rdmp.Core.DataFlowPipeline.Requirements;
1415
using Rdmp.Core.ReusableLibraryCode.Progress;
@@ -83,12 +84,12 @@ public void Dispose(IDataLoadEventListener listener)
8384
throw new NotImplementedException();
8485
}
8586

86-
public void PreInitialize(CacheProgress cacheProgress, IDataLoadEventListener listener)
87+
public void PreInitialize(IBasicActivateItems activator, CacheProgress cacheProgress, IDataLoadEventListener listener)
8788
{
8889
CacheProgress = cacheProgress;
8990
}
9091

91-
public void PreInitialize(DirectoryInfo cacheDirectory, IDataLoadEventListener listener)
92+
public void PreInitialize(IBasicActivateItems activator, DirectoryInfo cacheDirectory, IDataLoadEventListener listener)
9293
{
9394
CacheDirectory = cacheDirectory;
9495
}

Rdmp.Core.Tests/CohortCommitting/CommitCohortExample.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
55
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.
66

7-
using System.Data;
8-
using System.Linq;
97
using FAnsi;
108
using NUnit.Framework;
119
using Rdmp.Core.CohortCommitting;
1210
using Rdmp.Core.CohortCommitting.Pipeline;
1311
using Rdmp.Core.CohortCommitting.Pipeline.Destinations;
1412
using Rdmp.Core.CohortCommitting.Pipeline.Destinations.IdentifierAllocation;
13+
using Rdmp.Core.CommandExecution;
1514
using Rdmp.Core.DataExport.Data;
1615
using Rdmp.Core.DataFlowPipeline;
1716
using Rdmp.Core.ReusableLibraryCode.Checks;
1817
using Rdmp.Core.ReusableLibraryCode.Progress;
18+
using System.Data;
19+
using System.Linq;
1920
using Tests.Common;
2021

2122
namespace Rdmp.Core.Tests.CohortCommitting;
@@ -63,7 +64,7 @@ public void CommitCohortExampleTest(DatabaseType dbType, string privateDataType)
6364
};
6465

6566
//initialize the destination
66-
pipelineDestination.PreInitialize(
67+
pipelineDestination.PreInitialize(new ThrowImmediatelyActivator(RepositoryLocator, null),
6768
new CohortCreationRequest(project, definition, DataExportRepository,
6869
"A cohort created in an example unit test"),
6970
ThrowImmediatelyDataLoadEventListener.Quiet);

Rdmp.Core.Tests/CohortCommitting/CreateNewCohortDatabaseWizardTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@
44
// RDMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
55
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.
66

7-
using System;
8-
using System.Data;
9-
using System.Linq;
107
using FAnsi;
118
using NUnit.Framework;
129
using Rdmp.Core.CohortCommitting;
1310
using Rdmp.Core.CohortCommitting.Pipeline;
1411
using Rdmp.Core.CohortCommitting.Pipeline.Destinations;
1512
using Rdmp.Core.CohortCommitting.Pipeline.Destinations.IdentifierAllocation;
13+
using Rdmp.Core.CommandExecution;
1614
using Rdmp.Core.Curation.Data;
1715
using Rdmp.Core.DataExport.Data;
1816
using Rdmp.Core.DataFlowPipeline;
1917
using Rdmp.Core.Providers;
2018
using Rdmp.Core.ReusableLibraryCode.Checks;
2119
using Rdmp.Core.ReusableLibraryCode.Progress;
2220
using Rdmp.Core.ReusableLibraryCode.Settings;
21+
using System;
22+
using System.Data;
23+
using System.Linq;
2324
using Tests.Common;
2425

2526
namespace Rdmp.Core.Tests.CohortCommitting;
@@ -181,7 +182,7 @@ public void TestActuallyCreatingIt(DatabaseType type)
181182
//the destination component that will put it there
182183
var dest = new BasicCohortDestination();
183184

184-
dest.PreInitialize(request, ThrowImmediatelyDataLoadEventListener.Quiet);
185+
dest.PreInitialize(new ThrowImmediatelyActivator(RepositoryLocator, null), request, ThrowImmediatelyDataLoadEventListener.Quiet);
185186

186187
//tell it to use the guid allocator
187188
dest.ReleaseIdentifierAllocator = typeof(GuidReleaseIdentifierAllocator);

Rdmp.Core.Tests/CohortCreation/CohortCompilerRunnerTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using FAnsi.Discovery;
1212
using NUnit.Framework;
1313
using Rdmp.Core.CohortCreation.Execution;
14+
using Rdmp.Core.CommandExecution;
1415
using Rdmp.Core.Curation.Data;
1516
using Rdmp.Core.Curation.Data.Aggregation;
1617
using Rdmp.Core.Curation.Data.Cohort;
@@ -28,7 +29,7 @@ public void CacheIdentifierListWithRunner_SimpleCase()
2829
{
2930
SetupCohort(out var db, out var cic, out var dt);
3031

31-
var compiler = new CohortCompiler(cic);
32+
var compiler = new CohortCompiler(new ThrowImmediatelyActivator(RepositoryLocator,null), cic);
3233

3334
var runner = new CohortCompilerRunner(compiler, 5000);
3435
runner.Run(new CancellationToken());
@@ -62,7 +63,7 @@ public void CacheIdentifierListWithRunner_WithCaching()
6263
cic.QueryCachingServer_ID = serverReference.ID;
6364
cic.SaveToDatabase();
6465

65-
var compiler = new CohortCompiler(cic);
66+
var compiler = new CohortCompiler(new ThrowImmediatelyActivator(RepositoryLocator, null), cic);
6667

6768
var runner = new CohortCompilerRunner(compiler, 5000);
6869
runner.Run(new CancellationToken());

Rdmp.Core.Tests/CohortCreation/CohortCompilerTests.cs

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
using Rdmp.Core.CohortCreation;
1212
using Rdmp.Core.CohortCreation.Execution;
1313
using Rdmp.Core.CohortCreation.Execution.Joinables;
14+
using Rdmp.Core.CommandExecution;
15+
using Rdmp.Core.CommandExecution.AtomicCommands;
1416
using Rdmp.Core.Curation.Data;
1517
using Rdmp.Core.Curation.Data.Aggregation;
1618
using Rdmp.Core.Curation.Data.Cohort.Joinables;
19+
using Rdmp.Core.DataExport.Data;
1720

1821
namespace Rdmp.Core.Tests.CohortCreation;
1922

@@ -22,7 +25,7 @@ public class CohortCompilerTests : CohortIdentificationTests
2225
[Test]
2326
public void AddSameTaskTwice_StaysAtOne()
2427
{
25-
var compiler = new CohortCompiler(cohortIdentificationConfiguration);
28+
var compiler = new CohortCompiler(new ThrowImmediatelyActivator(RepositoryLocator,null), cohortIdentificationConfiguration);
2629
container1.AddChild(aggregate1, 0);
2730
try
2831
{
@@ -66,7 +69,7 @@ public void AddSameTaskTwice_StaysAtOne()
6669
[Test]
6770
public void AddContainer_StaysAtOne()
6871
{
69-
var compiler = new CohortCompiler(cohortIdentificationConfiguration);
72+
var compiler = new CohortCompiler(new ThrowImmediatelyActivator(RepositoryLocator, null), cohortIdentificationConfiguration);
7073
rootcontainer.AddChild(aggregate1, 1);
7174

7275
compiler.AddTask(rootcontainer, null); //add the root container
@@ -144,7 +147,7 @@ public void TestCompilerAddAllTasks(TestCompilerAddAllTasksTestCase testCase, bo
144147

145148
//Joinable:aggregate5 (patient index table, the other Aggregates could JOIN to this)
146149

147-
var compiler = new CohortCompiler(cohortIdentificationConfiguration);
150+
var compiler = new CohortCompiler(new ThrowImmediatelyActivator(RepositoryLocator, null), cohortIdentificationConfiguration);
148151
rootcontainer.AddChild(aggregate1, 1);
149152
rootcontainer.AddChild(container1);
150153
container1.Order = 2;
@@ -201,7 +204,7 @@ public void TestCompilerAddAllTasks(TestCompilerAddAllTasksTestCase testCase, bo
201204
[Test]
202205
public void TestCompilerWithInternalCatalogues()
203206
{
204-
var compiler = new CohortCompiler(cohortIdentificationConfiguration);
207+
var compiler = new CohortCompiler(new ThrowImmediatelyActivator(RepositoryLocator, null), cohortIdentificationConfiguration);
205208
testData.catalogue.IsInternalDataset = true;
206209
testData.catalogue.SaveToDatabase();
207210

@@ -217,4 +220,57 @@ public void TestCompilerWithInternalCatalogues()
217220
Assert.That(compiler.Tasks.Keys.Select(k => k.State).Where(s => s == CompilationState.Crashed).ToList(), Has.Count.EqualTo(3));
218221
Assert.That(compiler.Tasks.Keys.Where(s => s.State == CompilationState.Crashed).Select(k => k.CrashMessage.Message).ToList().Any(m => m.Contains(" is marked as Internal. Internal Catalogues cannot be used in Cohort Identification Configurations.")));
219222
}
223+
224+
225+
[Test]
226+
public void TestCompilerWithProjectSpecificCatalogues_Fail()
227+
{
228+
var compiler = new CohortCompiler(new ThrowImmediatelyActivator(RepositoryLocator, null), cohortIdentificationConfiguration);
229+
230+
var proj = new Project(DataExportRepository, "TestCompilerWithProjectSpecificCatalogues_Fail");
231+
proj.SaveToDatabase();
232+
233+
//having an issue making it project specific
234+
var cmd = new ExecuteCommandMakeCatalogueProjectSpecific(new ThrowImmediatelyActivator(RepositoryLocator), aggregate1.Catalogue, proj, true);
235+
Assert.DoesNotThrow(() => cmd.Execute());
236+
rootcontainer.AddChild(aggregate1, 1);
237+
rootcontainer.AddChild(container1);
238+
container1.Order = 2;
239+
container1.SaveToDatabase();
240+
241+
cohortIdentificationConfiguration.RootCohortAggregateContainer_ID = rootcontainer.ID;
242+
cohortIdentificationConfiguration.SaveToDatabase();
243+
244+
compiler.AddAllTasks(true);
245+
Assert.That(compiler.Tasks.Keys.Select(k => k.State).Where(s => s == CompilationState.Crashed).ToList(), Has.Count.EqualTo(3));
246+
Assert.That(compiler.Tasks.Keys.Where(s => s.State == CompilationState.Crashed).Select(k => k.CrashMessage.Message).ToList().Contains("Catalogue BulkData is marked as Project Specific, but this Cohort Identification Configurations is not associated with the same Project."));
247+
}
248+
[Test]
249+
public void TestCompilerWithProjectSpecificCatalogues_Pass()
250+
{
251+
var compiler = new CohortCompiler(new ThrowImmediatelyActivator(RepositoryLocator, null), cohortIdentificationConfiguration);
252+
253+
var proj = new Project(DataExportRepository, "TestCompilerWithProjectSpecificCatalogues_Fail");
254+
proj.SaveToDatabase();
255+
256+
//having an issue making it project specific
257+
var cmd = new ExecuteCommandMakeCatalogueProjectSpecific(new ThrowImmediatelyActivator(RepositoryLocator), aggregate1.Catalogue, proj, true);
258+
Assert.DoesNotThrow(() => cmd.Execute());
259+
rootcontainer.AddChild(aggregate1, 1);
260+
rootcontainer.AddChild(container1);
261+
container1.Order = 2;
262+
container1.SaveToDatabase();
263+
264+
cohortIdentificationConfiguration.RootCohortAggregateContainer_ID = rootcontainer.ID;
265+
cohortIdentificationConfiguration.SaveToDatabase();
266+
267+
var associateCmd = new ExecuteCommandAssociateCohortIdentificationConfigurationWithProject(new ThrowImmediatelyActivator(RepositoryLocator));
268+
associateCmd.SetTarget(proj);
269+
associateCmd.SetTarget(cohortIdentificationConfiguration);
270+
Assert.DoesNotThrow(() => associateCmd.Execute());
271+
272+
compiler.AddAllTasks(true);
273+
Assert.That(compiler.Tasks.Keys.Select(k => k.State).Where(s => s == CompilationState.Crashed).ToList(), Has.Count.EqualTo(2));
274+
Assert.That(!compiler.Tasks.Keys.Where(s => s.State == CompilationState.Crashed).Select(k => k.CrashMessage.Message).ToList().Contains("Catalogue BulkData is marked as Project Specific, but this Cohort Identification Configurations is not associated with the same Project."));
275+
}
220276
}

Rdmp.Core.Tests/CohortCreation/PluginCohortCompilerTests.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@
88
using NUnit.Framework;
99
using Rdmp.Core.CohortCommitting.Pipeline.Sources;
1010
using Rdmp.Core.CohortCreation.Execution;
11+
using Rdmp.Core.CommandExecution;
1112
using Rdmp.Core.CommandExecution.AtomicCommands;
1213
using Rdmp.Core.CommandExecution.Combining;
1314
using Rdmp.Core.CommandLine.Interactive;
1415
using Rdmp.Core.Curation.Data;
1516
using Rdmp.Core.Curation.Data.Cohort;
1617
using Rdmp.Core.Curation.Data.Cohort.Joinables;
1718
using Rdmp.Core.DataFlowPipeline;
19+
using Rdmp.Core.ReusableLibraryCode.Checks;
20+
using Rdmp.Core.ReusableLibraryCode.Progress;
1821
using Rdmp.Core.Tests.CohortCreation.QueryTests;
1922
using System;
2023
using System.Data;
21-
using Rdmp.Core.ReusableLibraryCode.Checks;
22-
using Rdmp.Core.ReusableLibraryCode.Progress;
2324

2425
namespace Rdmp.Core.Tests.CohortCreation;
2526

@@ -53,7 +54,7 @@ public void TestIPluginCohortCompiler_PopulatesCacheCorrectly()
5354

5455
// run the cic
5556
var source = new CohortIdentificationConfigurationSource();
56-
source.PreInitialize(cic, ThrowImmediatelyDataLoadEventListener.Quiet);
57+
source.PreInitialize(new ThrowImmediatelyActivator(RepositoryLocator, null), cic, ThrowImmediatelyDataLoadEventListener.Quiet);
5758
var dt = source.GetChunk(ThrowImmediatelyDataLoadEventListener.Quiet, new GracefulCancellationToken());
5859

5960
// 5 random chi numbers
@@ -65,7 +66,7 @@ public void TestIPluginCohortCompiler_PopulatesCacheCorrectly()
6566

6667
// run the cic again
6768
source = new CohortIdentificationConfigurationSource();
68-
source.PreInitialize(cic, ThrowImmediatelyDataLoadEventListener.Quiet);
69+
source.PreInitialize(new ThrowImmediatelyActivator(RepositoryLocator, null), cic, ThrowImmediatelyDataLoadEventListener.Quiet);
6970
dt = source.GetChunk(ThrowImmediatelyDataLoadEventListener.Quiet, new GracefulCancellationToken());
7071

7172
// because the rules changed to generate 2 chis only there should be a new result
@@ -76,7 +77,7 @@ public void TestIPluginCohortCompiler_PopulatesCacheCorrectly()
7677
// run the cic again with no changes, the results should be unchanged since there is no config changed
7778
// I.e. no new chis should be generated and the cached values returned
7879
source = new CohortIdentificationConfigurationSource();
79-
source.PreInitialize(cic, ThrowImmediatelyDataLoadEventListener.Quiet);
80+
source.PreInitialize(new ThrowImmediatelyActivator(RepositoryLocator, null), cic, ThrowImmediatelyDataLoadEventListener.Quiet);
8081
dt = source.GetChunk(ThrowImmediatelyDataLoadEventListener.Quiet, new GracefulCancellationToken());
8182

8283
Assert.That(dt.Rows, Has.Count.EqualTo(2));
@@ -223,7 +224,7 @@ public void TestIPluginCohortCompiler_AsPatientIndexTable()
223224

224225
// run the cic again
225226
var source = new CohortIdentificationConfigurationSource();
226-
source.PreInitialize(cic, ThrowImmediatelyDataLoadEventListener.Quiet);
227+
source.PreInitialize(new ThrowImmediatelyActivator(RepositoryLocator, null), cic, ThrowImmediatelyDataLoadEventListener.Quiet);
227228
var result = source.GetChunk(ThrowImmediatelyDataLoadEventListener.Quiet, new GracefulCancellationToken());
228229
Assert.That(result.Rows, Has.Count.EqualTo(1));
229230
}

Rdmp.Core.Tests/CohortCreation/QueryTests/CohortCompilerCacheJoinableTest.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66

77
using NUnit.Framework;
88
using Rdmp.Core.CohortCreation.Execution;
9+
using Rdmp.Core.CommandExecution;
910
using Rdmp.Core.Curation;
1011
using Rdmp.Core.Curation.Data;
1112
using Rdmp.Core.Curation.Data.Aggregation;
1213
using Rdmp.Core.Curation.Data.Cohort;
1314
using Rdmp.Core.Curation.Data.Cohort.Joinables;
1415
using Rdmp.Core.Databases;
16+
using Rdmp.Core.MapsDirectlyToDatabaseTable.Versioning;
17+
using Rdmp.Core.QueryCaching.Aggregation;
18+
using Rdmp.Core.ReusableLibraryCode.Checks;
1519
using System;
1620
using System.Data;
1721
using System.Linq;
18-
using Rdmp.Core.MapsDirectlyToDatabaseTable.Versioning;
1922
using Tests.Common.Scenarios;
20-
using Rdmp.Core.QueryCaching.Aggregation;
21-
using Rdmp.Core.ReusableLibraryCode.Checks;
2223
using static Rdmp.Core.CohortCreation.Execution.CohortCompilerRunner;
2324

2425
namespace Rdmp.Core.Tests.CohortCreation.QueryTests;
@@ -113,7 +114,7 @@ public void CohortIdentificationConfiguration_Join_PatientIndexTable()
113114
Assert.That(acPatIndex.IsJoinablePatientIndexTable());
114115
});
115116

116-
var compiler = new CohortCompiler(cic);
117+
var compiler = new CohortCompiler(new ThrowImmediatelyActivator(RepositoryLocator, null), cic);
117118

118119
var runner = new CohortCompilerRunner(compiler, 50);
119120

0 commit comments

Comments
 (0)