/// <inheritdoc cref="ILoadProgress"/> public LoadProgress(ICatalogueRepository repository, LoadMetadata parent) { repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "Name", Guid.NewGuid().ToString() }, { "LoadMetadata_ID", parent.ID } }); }
/// <summary> /// Creates a new empty <see cref="Pipeline"/> in the database, this is a sequence of <see cref="PipelineComponent"/> which when combined /// with an <see cref="IPipelineUseCase"/> achieve a specific goal (e.g. loading records into the database from a flat file). /// </summary> /// <param name="repository"></param> /// <param name="name"></param> public Pipeline(ICatalogueRepository repository, string name = null) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name ?? "NewPipeline " + Guid.NewGuid() } }); ClearAllInjections(); }
/// <summary> /// Creates a new argument storage object for one of the arguments in <see cref="PipelineComponent"/>. /// /// <para>You should probably call <see cref="IArgumentHost.CreateArgumentsForClassIfNotExists{T}"/> intead</para> /// </summary> /// <param name="repository"></param> /// <param name="parent"></param> public PipelineComponentArgument(ICatalogueRepository repository, PipelineComponent parent) { repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "PipelineComponent_ID", parent.ID }, { "Name", "Parameter" + Guid.NewGuid() }, { "Type", typeof(string).ToString() } }); }
/// <summary> /// Creates a record of what value to use with the given <see cref="ISqlParameter"/> of the <see cref="ExtractionFilterParameterSet"/> <see cref="IFilter"/> to achieve the concept. /// /// <para>For example if there is an <see cref="ExtractionFilter"/> 'Prescribed Drug X' with a parameter @DrugList and you create an <see cref="ExtractionFilterParameterSet"/> /// 'Diabetic Drugs' then this will create a <see cref="ExtractionFilterParameterSetValue"/> of '@DrugList='123.23,121,2... etc'.</para> /// /// <para>If a filter has more than one parameter then you will need one <see cref="ExtractionFilterParameterSetValue"/> per parameter per <see cref="ExtractionFilterParameterSet"/></para> /// </summary> /// <param name="repository"></param> /// <param name="parent"></param> /// <param name="valueIsForParameter"></param> public ExtractionFilterParameterSetValue(ICatalogueRepository repository, ExtractionFilterParameterSet parent, ExtractionFilterParameter valueIsForParameter) { repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "ExtractionFilterParameterSet_ID", parent.ID }, { "ExtractionFilterParameter_ID", valueIsForParameter.ID } }); ClearAllInjections(); }
/// <summary> /// Defines a new set of known parameter values to achieve a given goal (e.g. identify 'diabetic drugs' in dataset prescriptions) in combination with a parent <see cref="IFilter"/>. /// <para>A single <see cref="ExtractionFilter"/> (e.g. 'Drug Prescriptions of X' with parameter @DrugList) could have many <see cref="ExtractionFilterParameterSet"/></para> /// </summary> /// <param name="repository"></param> /// <param name="filter"></param> /// <param name="name"></param> public ExtractionFilterParameterSet(ICatalogueRepository repository, ExtractionFilter filter, string name = null) { name = name ?? "New ExtractionFilterParameterSet " + Guid.NewGuid(); repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "Name", name }, { "ExtractionFilter_ID", filter.ID } }); }
/// <summary> /// Declares a new configuration for identifying patient lists matching a study requirements based on the results of cohort sets / patient index tables and set operations /// <see cref="CohortIdentificationConfiguration"/> /// </summary> /// <param name="repository"></param> /// <param name="name"></param> public CohortIdentificationConfiguration(ICatalogueRepository repository, string name) { var queryCache = repository.GetServerDefaults().GetDefaultFor(PermissableDefaults.CohortIdentificationQueryCachingServer_ID); repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name }, { "QueryCachingServer_ID", queryCache == null ? (object)DBNull.Value:queryCache.ID } }); }
/// <summary> /// Records the fact that the given <see cref="DashboardControl"/> targets the given object (and hopefully displays information about it) /// </summary> /// <param name="repository"></param> /// <param name="parentControl"></param> /// <param name="objectToSave"></param> public DashboardObjectUse(ICatalogueRepository repository, DashboardControl parentControl, IMapsDirectlyToDatabaseTable objectToSave) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "ReferencedObjectID", objectToSave.ID }, { "ReferencedObjectType", objectToSave.GetType().Name }, { "ReferencedObjectRepositoryType", objectToSave.Repository.GetType().Name }, { "DashboardControl_ID", parentControl.ID }, }); }
/// <summary> /// Declares that a new <see cref="ISqlParameter"/> (e.g. 'DECLARE @bob as varchar(10)') exists for the parent database object. The object /// should be of a type which passes <see cref="IsSupportedType"/>. When the object is used for query generation by an <see cref="QueryBuilding.ISqlQueryBuilder"/> /// then the parameter will be used /// </summary> /// <param name="repository"></param> /// <param name="parent"></param> /// <param name="parameterSQL"></param> public AnyTableSqlParameter(ICatalogueRepository repository, IMapsDirectlyToDatabaseTable parent, string parameterSQL) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "ReferencedObjectID", parent.ID }, { "ReferencedObjectType", parent.GetType().Name }, { "ReferencedObjectRepositoryType", parent.Repository.GetType().Name }, { "ParameterSQL", parameterSQL }, }); }
/// <summary> /// Creates a new <see cref="GovernancePeriod"/> in the database. This grants (ethical) permission to hold datasets referenced by <see cref="GovernedCatalogues"/>. /// </summary> /// <param name="repository"></param> public GovernancePeriod(ICatalogueRepository repository) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", "GovernancePeriod" + Guid.NewGuid() }, { "StartDate", DateTime.Now } }); _manager = CatalogueRepository.GovernanceManager; }
/// <summary> /// Creates a new empty dashboard with the given name ready for controls to be added by the user /// </summary> /// <param name="repository"></param> /// <param name="name"></param> public DashboardLayout(ICatalogueRepository repository, string name) { Repository = repository; Repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "Username", Environment.UserName }, { "Name", name } }); }
/// <summary> /// Defines a new collection of dlls that provide plugin functionality for RDMP /// </summary> /// <param name="repository"></param> /// <param name="pluginZipFile"></param> /// <param name="pluginVersion"></param> /// <param name="rdmpVersion"></param> public Plugin(ICatalogueRepository repository, FileInfo pluginZipFile, Version pluginVersion, Version rdmpVersion) { repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "Name", pluginZipFile.Name }, { "UploadedFromDirectory", pluginZipFile.DirectoryName }, { "PluginVersion", (pluginVersion ?? new Version(0, 0, 0, 0)) }, { "RdmpVersion", (rdmpVersion ?? new Version(0, 0, 0, 0)) } }); }
/// <summary> /// Creates a new WHERE SQL block for reuse with the <see cref="Catalogue"/> in which the <paramref name="parent"/> resides. This is a top level master filter and can be /// copied out in <see cref="CohortIdentificationConfiguration"/>, ExtractionConfiguration etc. This ensures a single curated block of /// logic that everyone shares. /// </summary> /// <param name="repository"></param> /// <param name="name"></param> /// <param name="parent"></param> public ExtractionFilter(ICatalogueRepository repository, string name, ExtractionInformation parent) { name = name ?? "New Filter " + Guid.NewGuid(); repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name }, { "ExtractionInformation_ID", parent.ID } }); }
/// <summary> /// Uploads the given dll file to the catalogue database ready for use as a plugin within RDMP (also uploads any pdb file in the same dir) /// </summary> /// <param name="repository"></param> /// <param name="f"></param> /// <param name="plugin"></param> public LoadModuleAssembly(ICatalogueRepository repository, FileInfo f, Plugin plugin) { var dictionaryParameters = GetDictionaryParameters(f, plugin); //so we can reference it in fetch requests to check for duplication (normaly Repository is set during hydration by the repo) Repository = repository; Repository.InsertAndHydrate(this, dictionaryParameters); ClearAllInjections(); }
/// <summary> /// Defines a new filter (line of WHERE SQL) in the specified AggregateFilterContainer (AND / OR). Calling this constructor creates a new object in the database /// </summary> /// <param name="repository"></param> /// <param name="name"></param> /// <param name="container"></param> public AggregateFilter(ICatalogueRepository repository, string name = null, AggregateFilterContainer container = null) { name = name ?? "New AggregateFilter" + Guid.NewGuid(); repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name }, { "FilterContainer_ID", container != null ? (object)container.ID : DBNull.Value } }); }
/// <summary> /// Create a new DLE load. This load will not have any <see cref="ProcessTask"/> and will not load any <see cref="TableInfo"/> yet. /// /// <para>To set the loaded tables, set <see cref="Catalogue.LoadMetadata_ID"/> on some of your datasets</para> /// </summary> /// <param name="repository"></param> /// <param name="name"></param> public LoadMetadata(ICatalogueRepository repository, string name = null) { if (name == null) { name = "NewLoadMetadata" + Guid.NewGuid(); } repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "Name", name } }); }
/// <summary> /// Creates a new container (which starts out as an oprhan) with the given <see cref="SetOperation"/>. You should either set a /// <see cref="CohortIdentificationConfiguration.RootCohortAggregateContainer_ID"/> to this.<see cref="IMapsDirectlyToDatabaseTable.ID"/> to make this container the root container /// or use <see cref="AddChild(CohortAggregateContainer)"/> on another container to make this a subcontainer of it. /// </summary> /// <param name="repository"></param> /// <param name="operation"></param> public CohortAggregateContainer(ICatalogueRepository repository, SetOperation operation) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Operation", operation.ToString() }, { "Order", 0 }, { "Name", operation.ToString() } }); _manager = repository.CohortContainerManager; }
/// <summary> /// Defines that the specified column (<see cref="AggregateDimension"/>) should function as the continuous axis of an <see cref="AggregateConfiguration"/> graph. /// For example if you are graphing the number of prescriptions given out each month then the axis would be applied to the 'PrescribedDate' <see cref="AggregateDimension"/> /// </summary> /// <remarks>To use this you will first have to create an AggregateConfiguration and setup the count(*)/sum(*) etc stuff and then add a new AggregateDimension <see cref="AggregateConfiguration.AddDimension"/> </remarks> /// <param name="repository"></param> /// <param name="dimension"></param> public AggregateContinuousDateAxis(ICatalogueRepository repository, AggregateDimension dimension) { var todaysDateFunction = dimension.AggregateConfiguration.GetQuerySyntaxHelper().GetScalarFunctionSql(MandatoryScalarFunctions.GetTodaysDate); repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "AggregateDimension_ID", dimension.ID }, { "EndDate", todaysDateFunction } }); }
/// <summary> /// Creates a new component in the <paramref name="parent"/> <see cref="Pipeline"/>. This will mean that when run the <see cref="Pipeline"/> /// will instantiate and run the given <paramref name="componentType"/>. /// </summary> /// <param name="repository"></param> /// <param name="parent"></param> /// <param name="componentType"></param> /// <param name="order"></param> /// <param name="name"></param> public PipelineComponent(ICatalogueRepository repository, IPipeline parent, Type componentType, int order, string name = null) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name ?? "Run " + componentType.Name }, { "Pipeline_ID", parent.ID }, { "Class", componentType.ToString() }, { "Order", order } }); }
/// <summary> /// Creates a new virtual column that will be created in RAW during data loads but does not appear in the LIVE table schema. This allows /// identifiable data to be loaded and processed in a data load without ever hitting the live database. /// </summary> /// <param name="repository"></param> /// <param name="parent"></param> /// <param name="name"></param> public PreLoadDiscardedColumn(ICatalogueRepository repository, ITableInfo parent, string name = null) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "TableInfo_ID", parent.ID }, { "Destination", DiscardedColumnDestination.Oblivion }, { "RuntimeColumnName", name ?? "NewColumn" + Guid.NewGuid() } }); ClearAllInjections(); }
/// <summary> /// Records that the current Environment.UserName wants to mark the <paramref name="objectToFavourite"/> as one of his favourite objects /// </summary> /// <param name="repository"></param> /// <param name="objectToFavourite"></param> public Favourite(ICatalogueRepository repository, IMapsDirectlyToDatabaseTable objectToFavourite) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "ReferencedObjectID", objectToFavourite.ID }, { "ReferencedObjectType", objectToFavourite.GetType().Name }, { "ReferencedObjectRepositoryType", objectToFavourite.Repository.GetType().Name }, { "Username", Environment.UserName }, { "FavouritedDate", DateTime.Now }, }); }
/// <summary> /// Records a new (initially blank) set of credentials that can be used to access a <see cref="TableInfo"/> or other object requiring authentication. /// <para>A single <see cref="DataAccessCredentials"/> can be shared by multiple tables</para> /// /// <para>You can also use <see cref="DataAccessCredentialsFactory"/> for easier credentials creation</para> /// </summary> /// <param name="repository"></param> /// <param name="name"></param> public DataAccessCredentials(ICatalogueRepository repository, string name = null) { name = name ?? "New Credentials " + Guid.NewGuid(); _encryptedPasswordHost = new EncryptedPasswordHost(repository); repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name } }); }
/// <summary> /// Creates a new virtual column description for for a column in the dataset (<paramref name="parent"/>) supplied with the given Name. /// <para><remarks>You should next choose which <see cref="ColumnInfo"/> powers it and optionally create an <see cref="ExtractionInformation"/> to /// make the column extractable</remarks></para> /// </summary> public CatalogueItem(ICatalogueRepository repository, Catalogue parent, string name) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name }, { "Catalogue_ID", parent.ID } }); ClearAllInjections(); parent.ClearAllInjections(); }
/// <summary> /// Documents that a given cache fetch request was not succesfully executed e.g. the remote endpoint returned an error for that date range. /// </summary> /// <param name="repository"></param> /// <param name="cacheProgress"></param> /// <param name="start"></param> /// <param name="end"></param> /// <param name="e"></param> public CacheFetchFailure(ICatalogueRepository repository, ICacheProgress cacheProgress, DateTime start, DateTime end, Exception e) { repository.InsertAndHydrate(this, new Dictionary <string, object> { { "CacheProgress_ID", cacheProgress.ID }, { "FetchRequestStart", start }, { "FetchRequestEnd", end }, { "ExceptionText", ExceptionHelper.ExceptionToListOfInnerMessages(e, true) }, { "LastAttempt", DateTime.Now }, { "ResolvedOn", DBNull.Value } }); }
/// <summary> /// Create a new DLE load. This load will not have any <see cref="ProcessTask"/> and will not load any <see cref="TableInfo"/> yet. /// /// <para>To set the loaded tables, set <see cref="Catalogue.LoadMetadata_ID"/> on some of your datasets</para> /// </summary> /// <param name="repository"></param> /// <param name="name"></param> public LoadMetadata(ICatalogueRepository repository, string name = null) { if (name == null) { name = "NewLoadMetadata" + Guid.NewGuid(); } repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "Name", name }, { "IgnoreTrigger", false /*todo could be system global default here*/ } }); }
/// <summary> /// Record the new layout in the database /// </summary> /// <param name="repository"></param> /// <param name="name">Human readable name for the layout</param> /// <param name="layoutXml">The layout Xml of RDMPMainForm, use GetCurrentLayoutXml to get this, cannot be null</param> public WindowLayout(ICatalogueRepository repository, string name, string layoutXml) { repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "Name", name }, { "LayoutData", layoutXml } }); if (ID == 0 || Repository != repository) { throw new ArgumentException("Repository failed to properly hydrate this class"); } }
/// <summary> /// Creates a new operation in the data load (e.g. copy files from A to B, load all CSV files to RAW table B etc) /// </summary> /// <param name="repository"></param> /// <param name="parent"></param> /// <param name="stage"></param> public ProcessTask(ICatalogueRepository repository, ILoadMetadata parent, LoadStage stage) { var order = repository.GetAllObjectsWithParent <ProcessTask>(parent).Select(t => t.Order).DefaultIfEmpty().Max() + 1; repository.InsertAndHydrate(this, new Dictionary <string, object> { { "LoadMetadata_ID", parent.ID }, { "ProcessTaskType", ProcessTaskType.Executable.ToString() }, { "LoadStage", stage }, { "Name", "New Process" + Guid.NewGuid() }, { "Order", order } }); }
/// <summary> /// Creates a new AggregateConfiguration (graph, cohort set or patient index table) in the ICatalogueRepository /// . database associated with the provided Catalogue (dataset). /// </summary> /// <param name="repository"></param> /// <param name="catalogue"></param> /// <param name="name"></param> public AggregateConfiguration(ICatalogueRepository repository, ICatalogue catalogue, string name) { //default values CountSQL = "count(*)"; dtCreated = DateTime.Now; repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name }, { "Catalogue_ID", catalogue.ID } }); ClearAllInjections(); }
/// <summary> /// Defines a new keyword that should be set on all connections to databases of <see cref="DatabaseType"/> when making new connections /// </summary> /// <param name="repository"></param> /// <param name="databaseType"></param> /// <param name="keyword"></param> /// <param name="value"></param> public ConnectionStringKeyword(ICatalogueRepository repository, DatabaseType databaseType, string keyword, string value) { repository.InsertAndHydrate(this, new Dictionary <string, object>() { { "DatabaseType", databaseType.ToString() }, { "Name", keyword }, { "Value", value }, }); if (ID == 0 || Repository != repository) { throw new ArgumentException("Repository failed to properly hydrate this class"); } }
/// <summary> /// Defines a new table reference in the platform database <paramref name="repository"/>. /// <para>Usually you should use <see cref="TableInfoImporter"/> instead</para> /// </summary> /// <param name="repository"></param> /// <param name="name"></param> public TableInfo(ICatalogueRepository repository, string name) { _catalogueRepository = repository; var dumpServer = repository.GetServerDefaults().GetDefaultFor(PermissableDefaults.IdentifierDumpServer_ID); repository.InsertAndHydrate(this, new Dictionary <string, object> { { "Name", name }, { "IdentifierDumpServer_ID", dumpServer == null ? (object)DBNull.Value:dumpServer.ID } }); ClearAllInjections(); }
/// <summary> /// Declares that a new ANOTable (anonymous mapping table) should exist in the referenced database. You can call this constructor without first creating the table. If you do /// you should set <see cref="NumberOfIntegersToUseInAnonymousRepresentation"/> and <see cref="NumberOfCharactersToUseInAnonymousRepresentation"/> then <see cref="PushToANOServerAsNewTable"/> /// </summary> /// <param name="repository"></param> /// <param name="externalDatabaseServer"></param> /// <param name="tableName"></param> /// <param name="suffix"></param> public ANOTable(ICatalogueRepository repository, ExternalDatabaseServer externalDatabaseServer, string tableName, string suffix) { if (string.IsNullOrWhiteSpace(tableName)) { throw new NullReferenceException("ANOTable must have a name"); } repository.InsertAndHydrate(this, new Dictionary <string, object> { { "TableName", tableName }, { "Suffix", suffix }, { "Server_ID", externalDatabaseServer.ID } }); }