コード例 #1
0
        public AggregateConfigurationMenu(RDMPContextMenuStripArgs args, AggregateConfiguration aggregate) : base(args, aggregate)
        {
            //if it is a cohort aggregate (but not joinables since they don't match patients they match records and select many columns)
            if (aggregate.IsCohortIdentificationAggregate && !aggregate.IsJoinablePatientIndexTable())
            {
                //with a cic (it really should do!)
                var cic = aggregate.GetCohortIdentificationConfigurationIfAny();

                if (cic != null)
                {
                    //find other non cohort aggregates (graphs)
                    AggregateConfiguration[] graphsAvailableInCatalogue;

                    try
                    {
                        graphsAvailableInCatalogue = CohortSummaryQueryBuilder.GetAllCompatibleSummariesForCohort(aggregate);
                    }
                    catch (System.Exception)
                    {
                        // Occurs if the AggregateConfiguration is badly set up e.g. has too many extraction identifiers
                        graphsAvailableInCatalogue = new AggregateConfiguration[0];
                    }

                    //and offer graph generation for the cohort subsets
                    var matchRecords     = new ToolStripMenuItem("Graph Matching Records Only", _activator.CoreIconProvider.GetImage(RDMPConcept.AggregateGraph));
                    var matchIdentifiers = new ToolStripMenuItem("Graph All Records For Matching Patients", _activator.CoreIconProvider.GetImage(RDMPConcept.AggregateGraph));

                    matchRecords.Enabled     = graphsAvailableInCatalogue.Any();
                    matchIdentifiers.Enabled = graphsAvailableInCatalogue.Any() && cic.QueryCachingServer_ID != null;

                    foreach (AggregateConfiguration graph in graphsAvailableInCatalogue)
                    {
                        //records in
                        Add(new ExecuteCommandViewCohortAggregateGraph(_activator, new CohortSummaryAggregateGraphObjectCollection(aggregate, graph, CohortSummaryAdjustment.WhereRecordsIn)),
                            Keys.None,
                            matchRecords);

                        //extraction identifiers in
                        Add(
                            new ExecuteCommandViewCohortAggregateGraph(_activator, new CohortSummaryAggregateGraphObjectCollection(aggregate, graph, CohortSummaryAdjustment.WhereExtractionIdentifiersIn)),
                            Keys.None,
                            matchIdentifiers
                            );
                    }

                    Items.Add(matchRecords);
                    Items.Add(matchIdentifiers);
                }
            }
        }
コード例 #2
0
        public AggregateConfigurationMenu(RDMPContextMenuStripArgs args, AggregateConfiguration aggregate) : base(args, aggregate)
        {
            _aggregate = aggregate;

            Add(new ExecuteCommandViewSample(args.ItemActivator, aggregate));

            Add(new ExecuteCommandDisableOrEnable(_activator, aggregate));

            //only allow them to execute graph if it is normal aggregate graph
            if (!aggregate.IsCohortIdentificationAggregate)
            {
                Add(new ExecuteCommandExecuteAggregateGraph(_activator, aggregate));
            }

            Add(new ExecuteCommandViewSqlParameters(_activator, aggregate));

            Items.Add(new ToolStripSeparator());

            var addFilterContainer = new ToolStripMenuItem("Add Filter Container", GetImage(RDMPConcept.FilterContainer, OverlayKind.Add), (s, e) => AddFilterContainer());

            //if it doesn't have a root container or a hijacked container shortcut
            addFilterContainer.Enabled = aggregate.RootFilterContainer_ID == null && aggregate.OverrideFiltersByUsingParentAggregateConfigurationInstead_ID == null;
            Items.Add(addFilterContainer);

            Add(new ExecuteCommandImportFilterContainerTree(_activator, aggregate));

            Add(new ExecuteCommandCreateNewFilter(_activator,
                                                  new AggregateFilterFactory(_activator.RepositoryLocator.CatalogueRepository),
                                                  () => {
                aggregate.CreateRootContainerIfNotExists();
                return(aggregate.RootFilterContainer);
            }));

            Add(new ExecuteCommandCreateNewFilterFromCatalogue(_activator,
                                                               aggregate.Catalogue,
                                                               () =>
            {
                aggregate.CreateRootContainerIfNotExists();
                return(aggregate.RootFilterContainer);
            }));

            Items.Add(new ToolStripSeparator());

            var addShortcutFilterContainer = new ToolStripMenuItem("Create Shortcut to Another AggregateConfigurations Filter Container",
                                                                   GetImage(aggregate, OverlayKind.Shortcut), (s, e) => ChooseHijacker());


            //if it doesn't have a root container or a hijacked container shortcut
            addShortcutFilterContainer.Enabled = aggregate.RootFilterContainer_ID == null && aggregate.OverrideFiltersByUsingParentAggregateConfigurationInstead_ID == null;

            Items.Add(addShortcutFilterContainer);

            var clearShortcutFilterContainer = new ToolStripMenuItem("Clear Shortcut", GetImage(aggregate, OverlayKind.Shortcut), (s, e) => ClearShortcut());

            clearShortcutFilterContainer.Enabled = aggregate.OverrideFiltersByUsingParentAggregateConfigurationInstead_ID != null;
            Items.Add(clearShortcutFilterContainer);

            Add(new ExecuteCommandCreateNewCatalogueByExecutingAnAggregateConfiguration(_activator).SetTarget(aggregate));

            //if it is a cohort aggregate (but not joinables since they don't match patients they match records and select many columns)
            if (aggregate.IsCohortIdentificationAggregate && !aggregate.IsJoinablePatientIndexTable())
            {
                //with a cic (it really should do!)
                var cic = aggregate.GetCohortIdentificationConfigurationIfAny();

                if (cic != null)
                {
                    //find other non cohort aggregates (graphs)
                    AggregateConfiguration[] graphsAvailableInCatalogue;

                    try
                    {
                        graphsAvailableInCatalogue = CohortSummaryQueryBuilder.GetAllCompatibleSummariesForCohort(aggregate);
                    }
                    catch (System.Exception)
                    {
                        // Occurs if the AggregateConfiguration is badly set up e.g. has too many extraction identifiers
                        graphsAvailableInCatalogue = new AggregateConfiguration[0];
                    }

                    //and offer graph generation for the cohort subsets
                    var matchRecords     = new ToolStripMenuItem("Graph Matching Records Only", _activator.CoreIconProvider.GetImage(RDMPConcept.AggregateGraph));
                    var matchIdentifiers = new ToolStripMenuItem("Graph All Records For Matching Patients", _activator.CoreIconProvider.GetImage(RDMPConcept.AggregateGraph));

                    matchRecords.Enabled     = graphsAvailableInCatalogue.Any();
                    matchIdentifiers.Enabled = graphsAvailableInCatalogue.Any() && cic.QueryCachingServer_ID != null;

                    foreach (AggregateConfiguration graph in graphsAvailableInCatalogue)
                    {
                        //records in
                        Add(new ExecuteCommandViewCohortAggregateGraph(_activator, new CohortSummaryAggregateGraphObjectCollection(aggregate, graph, CohortSummaryAdjustment.WhereRecordsIn)),
                            Keys.None,
                            matchRecords);

                        //extraction identifiers in
                        Add(
                            new ExecuteCommandViewCohortAggregateGraph(_activator, new CohortSummaryAggregateGraphObjectCollection(aggregate, graph, CohortSummaryAdjustment.WhereExtractionIdentifiersIn)),
                            Keys.None,
                            matchIdentifiers
                            );
                    }

                    Items.Add(matchRecords);
                    Items.Add(matchIdentifiers);
                }
            }
        }