• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

HicServices / RDMP / 6245535001

20 Sep 2023 07:44AM UTC coverage: 57.013%. First build
6245535001

push

github

web-flow
8.1.0 Release (#1628)

* Bump Newtonsoft.Json from 13.0.1 to 13.0.2

Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 13.0.1 to 13.0.2.
- [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/13.0.1...13.0.2)

---
updated-dependencies:
- dependency-name: Newtonsoft.Json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump NLog from 5.0.5 to 5.1.0

Bumps [NLog](https://github.com/NLog/NLog) from 5.0.5 to 5.1.0.
- [Release notes](https://github.com/NLog/NLog/releases)
- [Changelog](https://github.com/NLog/NLog/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/NLog/NLog/compare/v5.0.5...v5.1.0)

---
updated-dependencies:
- dependency-name: NLog
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump NLog from 5.0.5 to 5.1.0

* Fix -r flag - should have been --results-directory all along

* Bump Newtonsoft.Json from 13.0.1 to 13.0.2

* Bump YamlDotNet from 12.0.2 to 12.1.0

Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 12.0.2 to 12.1.0.
- [Release notes](https://github.com/aaubry/YamlDotNet/releases)
- [Commits](https://github.com/aaubry/YamlDotNet/compare/v12.0.2...v12.1.0)

---
updated-dependencies:
- dependency-name: YamlDotNet
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump Moq from 4.18.2 to 4.18.3

Bumps [Moq](https://github.com/moq/moq4) from 4.18.2 to 4.18.3.
- [Release notes](https://github.com/moq/moq4/releases)
- [Changelog](https://github.com/moq/moq4/blob/main/CHANGELOG.md)
- [Commits](https://github.com/moq/moq4/compare/v4.18.2...v4.18.3)

---
updated-dependencies:
- dependency-name: Moq
... (continued)

10732 of 20257 branches covered (0.0%)

Branch coverage included in aggregate %.

48141 of 48141 new or added lines in 1086 files covered. (100.0%)

30685 of 52388 relevant lines covered (58.57%)

7387.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.0
/Rdmp.Core/Curation/Data/ExtractionFilterParameterSet.cs
1
// Copyright (c) The University of Dundee 2018-2019
2
// This file is part of the Research Data Management Platform (RDMP).
3
// RDMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4
// 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.
5
// You should have received a copy of the GNU General Public License along with RDMP. If not, see <https://www.gnu.org/licenses/>.
6

7
using System;
8
using System.Collections.Generic;
9
using System.Data.Common;
10
using System.Linq;
11
using Rdmp.Core.MapsDirectlyToDatabaseTable;
12
using Rdmp.Core.Repositories;
13
using Rdmp.Core.ReusableLibraryCode.Annotations;
14

15
namespace Rdmp.Core.Curation.Data;
16

17
/// <summary>
18
/// Often an ExtractionFilter will have a parameter associated with it (or more than one).  In this case it can be that you want to curate various values and give them
19
/// meaningful titles.  For exmaple if you have a filter 'Hospitalised with condition X' which has parameter @ConditionList.  Then you decide that you want to curate
20
/// a list 'A101.23,B21.1' as 'People hospitalised with drug dependency'.  This 'known meaningful parameter values set' is called a ExtractionFilterParameterSet.  You
21
/// can provide a name and a description for the concept.  Then you create a value for each parameter in the associated filter.  See ExtractionFilterParameterSetValue for
22
/// the value recordings.
23
/// </summary>
24
public class ExtractionFilterParameterSet : DatabaseEntity, ICollectSqlParameters, INamed
25
{
26
    #region Database Properties
27

28
    private string _name;
29
    private string _description;
30
    private int _extractionFilterID;
31

32
    /// <inheritdoc/>
33
    [NotNull]
34
    public string Name
35
    {
36
        get => _name;
24✔
37
        set => SetField(ref _name, value);
34✔
38
    }
39

40
    /// <summary>
41
    /// Human readable description of what the parameter set identifies e.g. 'Diabetes Drugs' and any supporting information about how it works, quirks etc
42
    /// </summary>
43
    public string Description
44
    {
45
        get => _description;
10✔
46
        set => SetField(ref _description, value);
14✔
47
    }
48

49
    /// <summary>
50
    /// The filter which the parameter values are designed to work with
51
    /// </summary>
52
    public int ExtractionFilter_ID
53
    {
54
        get => _extractionFilterID;
30✔
55
        set => SetField(ref _extractionFilterID, value);
32✔
56
    }
57

58
    #endregion
59

60
    #region Relationships
61

62
    /// <inheritdoc cref ="ExtractionFilter_ID"/>
63
    [NoMappingToDatabase]
64
    public ExtractionFilter ExtractionFilter => Repository.GetObjectByID<ExtractionFilter>(ExtractionFilter_ID);
6✔
65

66
    /// <summary>
67
    /// Gets all the individual parameter values required for populating the filter to achieve this concept (e.g. 'Diabetes Drugs' might have 2 parameter values @DrugList='123.122.1,1.2... etc' and @DrugCodeFormat='bnf')
68
    /// </summary>
69
    [NoMappingToDatabase]
70
    public IEnumerable<ExtractionFilterParameterSetValue> Values =>
71
        Repository.GetAllObjectsWithParent<ExtractionFilterParameterSetValue>(this);
14✔
72

73
    #endregion
74

75
    public ExtractionFilterParameterSet()
×
76
    {
77
    }
×
78

79
    internal ExtractionFilterParameterSet(ICatalogueRepository repository, DbDataReader r)
80
        : base(repository, r)
8✔
81
    {
82
        Name = r["Name"].ToString();
8✔
83
        Description = r["Description"] as string;
8✔
84
        ExtractionFilter_ID = Convert.ToInt32(r["ExtractionFilter_ID"]);
8✔
85
    }
8✔
86

87
    /// <summary>
88
    /// 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"/>.
89
    /// <para>A single <see cref="ExtractionFilter"/> (e.g. 'Drug Prescriptions of X' with parameter @DrugList) could have many <see cref="ExtractionFilterParameterSet"/></para>
90
    /// </summary>
91
    /// <param name="repository"></param>
92
    /// <param name="filter"></param>
93
    /// <param name="name"></param>
94
    public ExtractionFilterParameterSet(ICatalogueRepository repository, ExtractionFilter filter, string name = null)
24✔
95
    {
96
        name ??= $"New ExtractionFilterParameterSet {Guid.NewGuid()}";
24!
97

98
        repository.InsertAndHydrate(this, new Dictionary<string, object>
24✔
99
        {
24✔
100
            { "Name", name },
24✔
101
            { "ExtractionFilter_ID", filter.ID }
24✔
102
        });
24✔
103
    }
24✔
104

105

106
    /// <inheritdoc/>
107
    public override string ToString() => Name;
12✔
108

109
    /// <inheritdoc cref="Values"/>
110
    public ISqlParameter[] GetAllParameters() => Values.ToArray();
×
111

112
    /// <summary>
113
    /// Identifies all parameters which do not exist yet as declared values
114
    /// </summary>
115
    /// <returns></returns>
116
    public IEnumerable<ExtractionFilterParameter> GetMissingEntries()
117
    {
118
        var existingCatalogueParameters =
4✔
119
            ExtractionFilter.GetAllParameters().Cast<ExtractionFilterParameter>().ToArray();
4✔
120

121
        var personalChildren = Values.ToArray();
4✔
122

123
        foreach (var catalogueParameter in existingCatalogueParameters)
16✔
124
            if (personalChildren.All(c => c.ExtractionFilterParameter_ID != catalogueParameter.ID))
4✔
125
                yield return catalogueParameter;
4✔
126
    }
4✔
127

128
    /// <summary>
129
    /// Creates new value entries for each parameter in the filter that does not yet have a value in this value set
130
    /// </summary>
131
    /// <returns></returns>
132
    public ExtractionFilterParameterSetValue[] CreateNewValueEntries()
133
    {
134
        var toReturn = new List<ExtractionFilterParameterSetValue>();
4✔
135

136
        foreach (var catalogueParameter in GetMissingEntries())
16✔
137
            //we have a master that does not have any child values yet
138
            toReturn.Add(new ExtractionFilterParameterSetValue((ICatalogueRepository)Repository, this,
4✔
139
                catalogueParameter));
4✔
140

141
        return toReturn.ToArray();
4✔
142
    }
143

144
    public override void DeleteInDatabase()
145
    {
146
        foreach (var v in Values) v.DeleteInDatabase();
18✔
147

148
        base.DeleteInDatabase();
6✔
149
    }
6✔
150
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc