Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/RDMP-184 Fix RDMP Slow start Issue #1827

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@


# Changelog
All notable changes to this project will be documented in this file.

Expand All @@ -15,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix to remove stack trace button from non error popups
- Add ability to set Extraction Categort as "Not Extractable"
- Replace BadMedicine v1.2.1 with SynthEHR v2.0.0
- Fix issue with RDMP being slow to load when having numerous Load Metadatas

## [8.1.5] - 2024-04-03

Expand Down
30 changes: 15 additions & 15 deletions Rdmp.Core/Providers/CatalogueChildProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class CatalogueChildProvider : ICoreChildProvider
{
//Load System
public LoadMetadata[] AllLoadMetadatas { get; set; }

private LoadMetadataCatalogueLinkage[] AllLoadMetadataLinkage { get; set; }
public ProcessTask[] AllProcessTasks { get; set; }
public ProcessTaskArgument[] AllProcessTasksArguments { get; set; }

Expand Down Expand Up @@ -247,6 +249,7 @@ public CatalogueChildProvider(ICatalogueRepository repository, IChildProvider[]
AllDatasets = GetAllObjects<Curation.Data.Dataset>(repository);

AllLoadMetadatas = GetAllObjects<LoadMetadata>(repository);
AllLoadMetadataLinkage = GetAllObjects<LoadMetadataCatalogueLinkage>(repository);
AllProcessTasks = GetAllObjects<ProcessTask>(repository);
AllProcessTasksArguments = GetAllObjects<ProcessTaskArgument>(repository);
AllLoadProgresses = GetAllObjects<LoadProgress>(repository);
Expand Down Expand Up @@ -390,12 +393,10 @@ public CatalogueChildProvider(ICatalogueRepository repository, IChildProvider[]
LoadMetadataRootFolder = FolderHelper.BuildFolderTree(AllLoadMetadatas);
AddChildren(LoadMetadataRootFolder, new DescendancyList(LoadMetadataRootFolder));


CohortIdentificationConfigurationRootFolder =
FolderHelper.BuildFolderTree(AllCohortIdentificationConfigurations);
AddChildren(CohortIdentificationConfigurationRootFolder,
new DescendancyList(CohortIdentificationConfigurationRootFolder));

var templateAggregateConfigurationIds =
new HashSet<int>(
repository.GetExtendedProperties(ExtendedProperty.IsTemplate)
Expand All @@ -413,7 +414,6 @@ public CatalogueChildProvider(ICatalogueRepository repository, IChildProvider[]
dec.SetBetterRouteExists();
AddToDictionaries(new HashSet<object>(TemplateAggregateConfigurations), dec);


//Some AggregateConfigurations are 'Patient Index Tables', this happens when there is an existing JoinableCohortAggregateConfiguration declared where
//the AggregateConfiguration_ID is the AggregateConfiguration.ID. We can inject this knowledge now so to avoid database lookups later (e.g. at icon provision time)
var joinableDictionaryByAggregateConfigurationId =
Expand Down Expand Up @@ -824,7 +824,6 @@ private void AddChildren(FolderNode<LoadMetadata> folder, DescendancyList descen

//add loads in folder
foreach (var lmd in folder.ChildObjects) AddChildren(lmd, descendancy.Add(lmd));

// Children are the folders + objects
AddToDictionaries(new HashSet<object>(
folder.ChildFolders.Cast<object>()
Expand Down Expand Up @@ -987,23 +986,24 @@ private void AddChildren(ProcessTask procesTask, DescendancyList descendancy)
private void AddChildren(AllCataloguesUsedByLoadMetadataNode allCataloguesUsedByLoadMetadataNode,
DescendancyList descendancy)
{
var chilObjects = new HashSet<object>();
var childObjects = new HashSet<object>();


var loadMetadataId = allCataloguesUsedByLoadMetadataNode.LoadMetadata.ID;

var linkedCatalogueIDs = AllLoadMetadataLinkage.Where(link => link.LoadMetadataID == loadMetadataId).Select(link => link.CatalogueID);
List<Catalogue> usedCatalogues = new();
foreach (var catalogue in AllCatalogues)
foreach (var catalogueId in linkedCatalogueIDs)
{
var lmds = catalogue.LoadMetadatas();
if (lmds.Any() && lmds.Select(lmd => lmd.ID).ToList().Contains(allCataloguesUsedByLoadMetadataNode.LoadMetadata.ID))
{
usedCatalogues.Add(catalogue);
chilObjects.Add(new CatalogueUsedByLoadMetadataNode(allCataloguesUsedByLoadMetadataNode.LoadMetadata,
catalogue));
}
var foundCatalogue = AllCatalogues.Where(c => c.ID == catalogueId).FirstOrDefault();
if (foundCatalogue is null) continue;
usedCatalogues.Add(foundCatalogue);
childObjects.Add(new CatalogueUsedByLoadMetadataNode(allCataloguesUsedByLoadMetadataNode.LoadMetadata,
foundCatalogue));
}

allCataloguesUsedByLoadMetadataNode.UsedCatalogues = usedCatalogues;

AddToDictionaries(chilObjects, descendancy);
AddToDictionaries(childObjects, descendancy);
}

#endregion
Expand Down