Exemplo n.º 1
0
        /// <summary>
        /// Creates a new cohort set <see cref="AggregateConfiguration"/> which initially matches any patient appearing in the dataset (<see cref="Catalogue"/>).
        /// <para>IMPORTANT: It must be possible to select a single column from which to harvest the patient identifiers from <paramref name="resolveMultipleExtractionIdentifiers"/></para>
        /// </summary>
        /// <param name="catalogue">The catalogue to import as a patient identification set (you can import the same Catalogue multiple times e.g.
        /// 'People ever prescribed morphine' EXCEPT 'People ever prescribed percoset'</param>
        /// <param name="resolveMultipleExtractionIdentifiers">What to do if there are multiple <see cref="ExtractionInformation"/>
        ///  marked IsExtractionIdentifier</param>
        /// <param name="importMandatoryFilters"></param>
        /// <returns></returns>
        public AggregateConfiguration CreateNewEmptyConfigurationForCatalogue(ICatalogue catalogue, ChooseWhichExtractionIdentifierToUseFromManyHandler resolveMultipleExtractionIdentifiers, bool importMandatoryFilters = true)
        {
            var cataRepo = (ICatalogueRepository)Repository;

            AggregateConfiguration configuration = new AggregateConfiguration(cataRepo, catalogue, "People in " + catalogue);

            EnsureNamingConvention(configuration);

            if (!catalogue.IsApiCall())
            {
                var extractionIdentifier = (ExtractionInformation)GetExtractionIdentifierFrom(catalogue, resolveMultipleExtractionIdentifiers);
                //make the extraction identifier column into the sole dimension on the new configuration
                new AggregateDimension(cataRepo, extractionIdentifier, configuration);
            }

            //no count sql
            configuration.CountSQL = null;
            configuration.SaveToDatabase();

            if (importMandatoryFilters)
            {
                ImportMandatoryFilters(catalogue, configuration, GetAllParameters());
            }

            return(configuration);
        }