Skip to content

Commit fe41935

Browse files
authored
Fixes #2771 move individualcharacteristics class to core (#2772)
* Fixes #2771 Move IndividualCharacteristics class to Core * remove ontogeny * add file * PR feedback
1 parent 342331a commit fe41935

File tree

4 files changed

+121
-0
lines changed

4 files changed

+121
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using OSPSuite.Core.Domain;
2+
3+
namespace OSPSuite.Core.Snapshots;
4+
5+
public class DiseaseState : IWithName
6+
{
7+
/// <summary>
8+
/// Name of disease state associated with OriginData
9+
/// </summary>
10+
public string Name { get; set; }
11+
12+
/// <summary>
13+
/// List of disease state parameters associated with the selected disease state
14+
/// </summary>
15+
public Parameter[] Parameters { get; set; }
16+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System.ComponentModel.DataAnnotations;
2+
using OSPSuite.Utility.Extensions;
3+
4+
namespace OSPSuite.Core.Snapshots
5+
{
6+
public class OriginData
7+
{
8+
public CalculationMethodCache CalculationMethods { get; set; }
9+
10+
/// <summary>
11+
/// Id of species (as defined in the database)
12+
/// </summary>
13+
[Required]
14+
public string Species { get; set; }
15+
16+
/// <summary>
17+
/// Id of population (as defined in the database)
18+
/// </summary>
19+
public string Population { get; set; }
20+
21+
/// <summary>
22+
/// Id of gender (as defined in the database)
23+
/// </summary>
24+
public string Gender { get; set; }
25+
26+
/// <summary>
27+
/// Age of individual to create. This is a mandatory input for age dependent species
28+
/// </summary>
29+
public Parameter Age { get; set; }
30+
31+
/// <summary>
32+
/// Gestational age of individual to create in [weeks]. This is a mandatory input for age dependent species
33+
/// </summary>
34+
public Parameter GestationalAge { get; set; }
35+
36+
/// <summary>
37+
/// Weight of individual to create.
38+
/// </summary>
39+
public Parameter Weight { get; set; }
40+
41+
/// <summary>
42+
/// Height of individual to create in.
43+
/// </summary>
44+
public Parameter Height { get; set; }
45+
46+
public ValueOrigin ValueOrigin { get; set; }
47+
48+
//Null if no disease state defined
49+
public DiseaseState Disease { get; set; }
50+
51+
//Kept for compatibility reasons with old snapshots
52+
public string DiseaseState { get; set; }
53+
54+
//Kept for compatibility reasons with old snapshots
55+
public Parameter[] DiseaseStateParameters { get; set; }
56+
57+
public void AddCalculationMethods(params string[] calculationMethods)
58+
{
59+
if (CalculationMethods == null)
60+
CalculationMethods = new CalculationMethodCache();
61+
62+
calculationMethods?.Each(CalculationMethods.Add);
63+
}
64+
}
65+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.Collections.Generic;
2+
using OSPSuite.Core.Snapshots;
3+
4+
namespace OSPSuite.R.Domain;
5+
6+
/// <summary>
7+
/// Wrapper object for .net that encapsulates origin data and disease state and molecule ontogenies
8+
/// </summary>
9+
public class IndividualCharacteristics : OriginData
10+
{
11+
private readonly List<MoleculeOntogeny> _moleculeOntogenies = new List<MoleculeOntogeny>();
12+
13+
public IReadOnlyList<MoleculeOntogeny> MoleculeOntogenies => _moleculeOntogenies;
14+
15+
public MoleculeOntogeny[] MoleculeOntogeniesAsArray => _moleculeOntogenies.ToArray();
16+
17+
public void AddMoleculeOntogeny(MoleculeOntogeny moleculeOntogeny) => _moleculeOntogenies.Add(moleculeOntogeny);
18+
19+
public void AddDiseaseStateParameter(Parameter diseaseStateParameter)
20+
{
21+
DiseaseStateParameters = DiseaseStateParameters == null ? [diseaseStateParameter] : new List<Parameter>(DiseaseStateParameters) { diseaseStateParameter }.ToArray();
22+
}
23+
24+
public int? Seed { get; set; }
25+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace OSPSuite.R.Domain;
2+
3+
public class MoleculeOntogeny
4+
{
5+
/// <summary>
6+
/// Name of the molecule being used in the model
7+
/// </summary>
8+
public string Molecule { get; set; }
9+
10+
/// <summary>
11+
/// Name of the ontogeny associated with the molecule
12+
/// </summary>
13+
public string Ontogeny { get; set; }
14+
15+
}

0 commit comments

Comments
 (0)